libzypp 17.31.23
ZConfig.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12extern "C"
13{
14#include <features.h>
15#include <sys/utsname.h>
16#if __GLIBC_PREREQ (2,16)
17#include <sys/auxv.h> // getauxval for PPC64P7 detection
18#endif
19#include <unistd.h>
20#include <solv/solvversion.h>
21}
22#include <iostream>
23#include <fstream>
24#include <optional>
25#include <zypp/base/LogTools.h>
26#include <zypp/base/IOStream.h>
27#include <zypp-core/base/InputStream>
28#include <zypp/base/String.h>
29#include <zypp/base/Regex.h>
30
31#include <zypp/ZConfig.h>
32#include <zypp/ZYppFactory.h>
33#include <zypp/PathInfo.h>
34#include <zypp-core/parser/IniDict>
35
36#include <zypp/sat/Pool.h>
37#include <zypp/sat/detail/PoolImpl.h>
38
39#include <zypp-media/MediaConfig>
40
41using std::endl;
42using namespace zypp::filesystem;
43using namespace zypp::parser;
44
45#undef ZYPP_BASE_LOGGER_LOGGROUP
46#define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
47
49namespace zypp
50{
61 namespace
62 {
63
65 // From rpm's lib/rpmrc.c
66# if defined(__linux__) && defined(__x86_64__)
67 static inline void cpuid(uint32_t op, uint32_t op2, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
68 {
69 asm volatile (
70 "cpuid\n"
71 : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
72 : "a" (op), "c" (op2));
73 }
74
75 /* From gcc's gcc/config/i386/cpuid.h */
76 /* Features (%eax == 1) */
77 /* %ecx */
78 #define bit_SSE3 (1 << 0)
79 #define bit_SSSE3 (1 << 9)
80 #define bit_FMA (1 << 12)
81 #define bit_CMPXCHG16B (1 << 13)
82 #define bit_SSE4_1 (1 << 19)
83 #define bit_SSE4_2 (1 << 20)
84 #define bit_MOVBE (1 << 22)
85 #define bit_POPCNT (1 << 23)
86 #define bit_OSXSAVE (1 << 27)
87 #define bit_AVX (1 << 28)
88 #define bit_F16C (1 << 29)
89
90 /* Extended Features (%eax == 0x80000001) */
91 /* %ecx */
92 #define bit_LAHF_LM (1 << 0)
93 #define bit_LZCNT (1 << 5)
94
95 /* Extended Features (%eax == 7) */
96 /* %ebx */
97 #define bit_BMI (1 << 3)
98 #define bit_AVX2 (1 << 5)
99 #define bit_BMI2 (1 << 8)
100 #define bit_AVX512F (1 << 16)
101 #define bit_AVX512DQ (1 << 17)
102 #define bit_AVX512CD (1 << 28)
103 #define bit_AVX512BW (1 << 30)
104 #define bit_AVX512VL (1u << 31)
105
106 static int get_x86_64_level(void)
107 {
108 int level = 1;
109
110 unsigned int op_1_ecx = 0, op_80000001_ecx = 0, op_7_ebx = 0, unused;
111 cpuid(1, 0, &unused, &unused, &op_1_ecx, &unused);
112 cpuid(0x80000001, 0, &unused, &unused, &op_80000001_ecx, &unused);
113 cpuid(7, 0, &unused, &op_7_ebx, &unused, &unused);
114
115 const unsigned int op_1_ecx_lv2 = bit_SSE3 | bit_SSSE3 | bit_CMPXCHG16B | bit_SSE4_1 | bit_SSE4_2 | bit_POPCNT;
116 if ((op_1_ecx & op_1_ecx_lv2) == op_1_ecx_lv2 && (op_80000001_ecx & bit_LAHF_LM))
117 level = 2;
118
119 const unsigned int op_1_ecx_lv3 = bit_FMA | bit_MOVBE | bit_OSXSAVE | bit_AVX | bit_F16C;
120 const unsigned int op_7_ebx_lv3 = bit_BMI | bit_AVX2 | bit_BMI2;
121 if (level == 2 && (op_1_ecx & op_1_ecx_lv3) == op_1_ecx_lv3 && (op_7_ebx & op_7_ebx_lv3) == op_7_ebx_lv3
122 && (op_80000001_ecx & bit_LZCNT))
123 level = 3;
124
125 const unsigned int op_7_ebx_lv4 = bit_AVX512F | bit_AVX512DQ | bit_AVX512CD | bit_AVX512BW | bit_AVX512VL;
126 if (level == 3 && (op_7_ebx & op_7_ebx_lv4) == op_7_ebx_lv4)
127 level = 4;
128
129 return level;
130 }
131# endif
133
136 Arch _autodetectSystemArchitecture()
137 {
138 struct ::utsname buf;
139 if ( ::uname( &buf ) < 0 )
140 {
141 ERR << "Can't determine system architecture" << endl;
142 return Arch_noarch;
143 }
144
145 Arch architecture( buf.machine );
146 MIL << "Uname architecture is '" << buf.machine << "'" << endl;
147
148 if ( architecture == Arch_x86_64 )
149 {
150#if defined(__linux__) && defined(__x86_64__)
151 switch ( get_x86_64_level() )
152 {
153 case 2:
154 architecture = Arch_x86_64_v2;
155 WAR << "CPU has 'x86_64': architecture upgraded to '" << architecture << "'" << endl;
156 break;
157 case 3:
158 architecture = Arch_x86_64_v3;
159 WAR << "CPU has 'x86_64': architecture upgraded to '" << architecture << "'" << endl;
160 break;
161 case 4:
162 architecture = Arch_x86_64_v4;
163 WAR << "CPU has 'x86_64': architecture upgraded to '" << architecture << "'" << endl;
164 break;
165 }
166# endif
167 }
168 else if ( architecture == Arch_i686 )
169 {
170 // some CPUs report i686 but dont implement cx8 and cmov
171 // check for both flags in /proc/cpuinfo and downgrade
172 // to i586 if either is missing (cf bug #18885)
173 std::ifstream cpuinfo( "/proc/cpuinfo" );
174 if ( cpuinfo )
175 {
176 for( iostr::EachLine in( cpuinfo ); in; in.next() )
177 {
178 if ( str::hasPrefix( *in, "flags" ) )
179 {
180 if ( in->find( "cx8" ) == std::string::npos
181 || in->find( "cmov" ) == std::string::npos )
182 {
183 architecture = Arch_i586;
184 WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
185 }
186 break;
187 }
188 }
189 }
190 else
191 {
192 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
193 }
194 }
195 else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
196 {
197 // Check for sun4[vum] to get the real arch. (bug #566291)
198 std::ifstream cpuinfo( "/proc/cpuinfo" );
199 if ( cpuinfo )
200 {
201 for( iostr::EachLine in( cpuinfo ); in; in.next() )
202 {
203 if ( str::hasPrefix( *in, "type" ) )
204 {
205 if ( in->find( "sun4v" ) != std::string::npos )
206 {
207 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
208 WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
209 }
210 else if ( in->find( "sun4u" ) != std::string::npos )
211 {
212 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
213 WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
214 }
215 else if ( in->find( "sun4m" ) != std::string::npos )
216 {
217 architecture = Arch_sparcv8;
218 WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
219 }
220 break;
221 }
222 }
223 }
224 else
225 {
226 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
227 }
228 }
229 else if ( architecture == Arch_armv8l || architecture == Arch_armv7l || architecture == Arch_armv6l )
230 {
231 std::ifstream platform( "/etc/rpm/platform" );
232 if (platform)
233 {
234 for( iostr::EachLine in( platform ); in; in.next() )
235 {
236 if ( str::hasPrefix( *in, "armv8hl-" ) )
237 {
238 architecture = Arch_armv8hl;
239 WAR << "/etc/rpm/platform contains armv8hl-: architecture upgraded to '" << architecture << "'" << endl;
240 break;
241 }
242 if ( str::hasPrefix( *in, "armv7hl-" ) )
243 {
244 architecture = Arch_armv7hl;
245 WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture << "'" << endl;
246 break;
247 }
248 if ( str::hasPrefix( *in, "armv6hl-" ) )
249 {
250 architecture = Arch_armv6hl;
251 WAR << "/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture << "'" << endl;
252 break;
253 }
254 }
255 }
256 }
257#if __GLIBC_PREREQ (2,16)
258 else if ( architecture == Arch_ppc64 )
259 {
260 const char * platform = (const char *)getauxval( AT_PLATFORM );
261 int powerlvl;
262 if ( platform && sscanf( platform, "power%d", &powerlvl ) == 1 && powerlvl > 6 )
263 architecture = Arch_ppc64p7;
264 }
265#endif
266 return architecture;
267 }
268
286 Locale _autodetectTextLocale()
287 {
288 Locale ret( Locale::enCode );
289 const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
290 for ( const char ** envvar = envlist; *envvar; ++envvar )
291 {
292 const char * envlang = getenv( *envvar );
293 if ( envlang )
294 {
295 std::string envstr( envlang );
296 if ( envstr != "POSIX" && envstr != "C" )
297 {
298 Locale lang( envstr );
299 if ( lang )
300 {
301 MIL << "Found " << *envvar << "=" << envstr << endl;
302 ret = lang;
303 break;
304 }
305 }
306 }
307 }
308 MIL << "Default text locale is '" << ret << "'" << endl;
309#warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
310 setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
311 return ret;
312 }
313
314
315 inline Pathname _autodetectSystemRoot()
316 {
317 Target_Ptr target( getZYpp()->getTarget() );
318 return target ? target->root() : Pathname();
319 }
320
321 inline Pathname _autodetectZyppConfPath()
322 {
323 const char *env_confpath = getenv( "ZYPP_CONF" );
324 return env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
325 }
326
328 } // namespace zypp
330
332 template<class Tp>
333 struct Option
334 {
335 typedef Tp value_type;
336
338 Option( value_type initial_r )
339 : _val( std::move(initial_r) )
340 {}
341
343 { set( std::move(newval_r) ); return *this; }
344
346 const value_type & get() const
347 { return _val; }
348
350 operator const value_type &() const
351 { return _val; }
352
354 void set( value_type newval_r )
355 { _val = std::move(newval_r); }
356
357 private:
359 };
360
362 template<class Tp>
363 struct DefaultOption : public Option<Tp>
364 {
365 typedef Tp value_type;
367
368 explicit DefaultOption( value_type initial_r )
369 : Option<Tp>( initial_r )
370 , _default( std::move(initial_r) )
371 {}
372
374 { this->set( std::move(newval_r) ); return *this; }
375
378 { this->set( _default.get() ); }
379
382 { setDefault( std::move(newval_r) ); restoreToDefault(); }
383
385 const value_type & getDefault() const
386 { return _default.get(); }
387
389 void setDefault( value_type newval_r )
390 { _default.set( std::move(newval_r) ); }
391
392 private:
394 };
395
397 //
398 // CLASS NAME : ZConfig::Impl
399 //
406 {
407 typedef std::set<std::string> MultiversionSpec;
408
411 {
414 , solver_onlyRequires ( false )
415 , solver_allowVendorChange ( false )
416 , solver_dupAllowDowngrade ( true )
420 , solver_cleandepsOnRemove ( false )
423 {}
424
425 bool consume( const std::string & entry, const std::string & value )
426 {
427 if ( entry == "solver.focus" )
428 {
429 fromString( value, solver_focus );
430 }
431 else if ( entry == "solver.onlyRequires" )
432 {
434 }
435 else if ( entry == "solver.allowVendorChange" )
436 {
438 }
439 else if ( entry == "solver.dupAllowDowngrade" )
440 {
442 }
443 else if ( entry == "solver.dupAllowNameChange" )
444 {
446 }
447 else if ( entry == "solver.dupAllowArchChange" )
448 {
450 }
451 else if ( entry == "solver.dupAllowVendorChange" )
452 {
454 }
455 else if ( entry == "solver.cleandepsOnRemove" )
456 {
458 }
459 else if ( entry == "solver.upgradeTestcasesToKeep" )
460 {
461 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
462 }
463 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
464 {
466 }
467 else
468 return false;
469
470 return true;
471 }
472
483 };
484
485 public:
487 : _parsedZyppConf ( _autodetectZyppConfPath() )
490 , cfg_cache_path { "/var/cache/zypp" }
491 , cfg_metadata_path { "" } // empty - follows cfg_cache_path
492 , cfg_solvfiles_path { "" } // empty - follows cfg_cache_path
493 , cfg_packages_path { "" } // empty - follows cfg_cache_path
494 , updateMessagesNotify ( "" )
495 , repo_add_probe ( false )
496 , repo_refresh_delay ( 10 )
497 , repoLabelIsAlias ( false )
498 , download_use_deltarpm ( true )
501 , download_mediaMountdir ( "/var/adm/mount" )
503 , gpgCheck ( true )
504 , repoGpgCheck ( indeterminate )
505 , pkgGpgCheck ( indeterminate )
506 , apply_locks_file ( true )
507 , pluginsPath ( "/usr/lib/zypp/plugins" )
508 , geoipEnabled ( true )
509 , geoipHosts { "download.opensuse.org" }
510 {
511 MIL << "libzypp: " LIBZYPP_VERSION_STRING << endl;
512 if ( PathInfo(_parsedZyppConf).isExist() )
513 {
516 sit != dict.sectionsEnd();
517 ++sit )
518 {
519 std::string section(*sit);
520 //MIL << section << endl;
521 for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
522 it != dict.entriesEnd(*sit);
523 ++it )
524 {
525 std::string entry(it->first);
526 std::string value(it->second);
527
528 if ( _mediaConf.setConfigValue( section, entry, value ) )
529 continue;
530
531 //DBG << (*it).first << "=" << (*it).second << endl;
532 if ( section == "main" )
533 {
534 if ( _initialTargetDefaults.consume( entry, value ) )
535 continue;
536
537 if ( entry == "arch" )
538 {
539 Arch carch( value );
540 if ( carch != cfg_arch )
541 {
542 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
543 cfg_arch = carch;
544 }
545 }
546 else if ( entry == "cachedir" )
547 {
548 cfg_cache_path.restoreToDefault( value );
549 }
550 else if ( entry == "metadatadir" )
551 {
552 cfg_metadata_path.restoreToDefault( value );
553 }
554 else if ( entry == "solvfilesdir" )
555 {
556 cfg_solvfiles_path.restoreToDefault( value );
557 }
558 else if ( entry == "packagesdir" )
559 {
560 cfg_packages_path.restoreToDefault( value );
561 }
562 else if ( entry == "configdir" )
563 {
564 cfg_config_path = Pathname(value);
565 }
566 else if ( entry == "reposdir" )
567 {
569 }
570 else if ( entry == "servicesdir" )
571 {
573 }
574 else if ( entry == "varsdir" )
575 {
576 cfg_vars_path = Pathname(value);
577 }
578 else if ( entry == "repo.add.probe" )
579 {
581 }
582 else if ( entry == "repo.refresh.delay" )
583 {
585 }
586 else if ( entry == "repo.refresh.locales" )
587 {
588 std::vector<std::string> tmp;
589 str::split( value, back_inserter( tmp ), ", \t" );
590
591 boost::function<Locale(const std::string &)> transform(
592 [](const std::string & str_r)->Locale{ return Locale(str_r); }
593 );
594 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
595 make_transform_iterator( tmp.end(), transform ) );
596 }
597 else if ( entry == "download.use_deltarpm" )
598 {
600 }
601 else if ( entry == "download.use_deltarpm.always" )
602 {
604 }
605 else if ( entry == "download.media_preference" )
606 {
608 }
609 else if ( entry == "download.media_mountdir" )
610 {
611 download_mediaMountdir.restoreToDefault( Pathname(value) );
612 }
613 else if ( entry == "download.use_geoip_mirror") {
615 }
616 else if ( entry == "commit.downloadMode" )
617 {
618 commit_downloadMode.set( deserializeDownloadMode( value ) );
619 }
620 else if ( entry == "gpgcheck" )
621 {
623 }
624 else if ( entry == "repo_gpgcheck" )
625 {
627 }
628 else if ( entry == "pkg_gpgcheck" )
629 {
631 }
632 else if ( entry == "vendordir" )
633 {
634 cfg_vendor_path = Pathname(value);
635 }
636 else if ( entry == "multiversiondir" )
637 {
639 }
640 else if ( entry == "multiversion.kernels" )
641 {
642 cfg_kernel_keep_spec = value;
643 }
644 else if ( entry == "solver.checkSystemFile" )
645 {
647 }
648 else if ( entry == "solver.checkSystemFileDir" )
649 {
651 }
652 else if ( entry == "multiversion" )
653 {
655 str::splitEscaped( value, std::inserter( defSpec, defSpec.end() ), ", \t" );
656 }
657 else if ( entry == "locksfile.path" )
658 {
659 locks_file = Pathname(value);
660 }
661 else if ( entry == "locksfile.apply" )
662 {
664 }
665 else if ( entry == "update.datadir" )
666 {
667 update_data_path = Pathname(value);
668 }
669 else if ( entry == "update.scriptsdir" )
670 {
672 }
673 else if ( entry == "update.messagessdir" )
674 {
676 }
677 else if ( entry == "update.messages.notify" )
678 {
679 updateMessagesNotify.set( value );
680 }
681 else if ( entry == "rpm.install.excludedocs" )
682 {
684 str::strToBool( value, false ) );
685 }
686 else if ( entry == "history.logfile" )
687 {
688 history_log_path = Pathname(value);
689 }
690 else if ( entry == "techpreview.ZYPP_SINGLE_RPMTRANS" )
691 {
692 DBG << "techpreview.ZYPP_SINGLE_RPMTRANS=" << value << endl;
693 ::setenv( "ZYPP_SINGLE_RPMTRANS", value.c_str(), 1 );
694 }
695 else if ( entry == "techpreview.ZYPP_MEDIANETWORK" )
696 {
697 DBG << "techpreview.ZYPP_MEDIANETWORK=" << value << endl;
698 ::setenv( "ZYPP_MEDIANETWORK", value.c_str(), 1 );
699 }
700 }
701 }
702 }
703 }
704 else
705 {
706 MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
707 _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
708 }
709
710 // legacy:
711 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
712 {
713 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
714 if ( carch != cfg_arch )
715 {
716 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
717 cfg_arch = carch;
718 }
719 }
720 MIL << "ZConfig singleton created." << endl;
721 }
722
724 {}
725
727 {
728 Pathname newRoot { _autodetectSystemRoot() };
729 MIL << "notifyTargetChanged (" << newRoot << ")" << endl;
730
731 if ( newRoot.emptyOrRoot() ) {
732 _currentTargetDefaults.reset(); // to initial settigns from /
733 }
734 else {
736
737 Pathname newConf { newRoot/_autodetectZyppConfPath() };
738 if ( PathInfo(newConf).isExist() ) {
739 parser::IniDict dict( newConf );
740 for ( const auto & [entry,value] : dict.entries( "main" ) ) {
741 (*_currentTargetDefaults).consume( entry, value );
742 }
743 }
744 else {
745 MIL << _parsedZyppConf << " not found, using defaults." << endl;
746 }
747 }
748 }
749
750 public:
753
756
757 DefaultOption<Pathname> cfg_cache_path; // Settings from the config file are also remembered
758 DefaultOption<Pathname> cfg_metadata_path; // 'default'. Cleanup in RepoManager e.g needs to tell
759 DefaultOption<Pathname> cfg_solvfiles_path; // whether settings in effect are config values or
760 DefaultOption<Pathname> cfg_packages_path; // custom settings applied vie set...Path().
761
767
772
777
782
787
789
793
796
798 const MultiversionSpec & multiversion() const { return getMultiversion(); }
799
801
802 target::rpm::RpmInstFlags rpmInstallFlags;
803
805
806 std::string userData;
807
809
811
812 std::vector<std::string> geoipHosts;
813
814 /* Other config singleton instances */
816
817
818 public:
821 private:
823 std::optional<TargetDefaults> _currentTargetDefaults;
824
825 private:
826 // HACK for bnc#906096: let pool re-evaluate multiversion spec
827 // if target root changes. ZConfig returns data sensitive to
828 // current target root.
829 // TODO Actually we'd need to scan the target systems zypp.conf and
830 // overlay all system specific values.
832 {
833 typedef std::map<Pathname,MultiversionSpec> SpecMap;
834
835 MultiversionSpec & getSpec( Pathname root_r, const Impl & zConfImpl_r ) // from system at root
836 {
837 // _specMap[] - the plain zypp.conf value
838 // _specMap[/] - combine [] and multiversion.d scan
839 // _specMap[root] - scan root/zypp.conf and root/multiversion.d
840
841 if ( root_r.empty() )
842 root_r = "/";
843 bool cacheHit = _specMap.count( root_r );
844 MultiversionSpec & ret( _specMap[root_r] ); // creates new entry on the fly
845
846 if ( ! cacheHit )
847 {
848 // bsc#1193488: If no (/root)/.../zypp.conf exists use the default zypp.conf
849 // multiversion settings. It is a legacy that the packaged multiversion setting
850 // in zypp.conf (the kernel) may differ from the builtin default (empty).
851 // But we want a missing config to behave similar to the default one, otherwise
852 // a bare metal install easily runs into trouble.
853 if ( root_r == "/" || scanConfAt( root_r, ret, zConfImpl_r ) == 0 )
854 ret = _specMap[Pathname()];
855 scanDirAt( root_r, ret, zConfImpl_r ); // add multiversion.d at root_r
856 using zypp::operator<<;
857 MIL << "MultiversionSpec '" << root_r << "' = " << ret << endl;
858 }
859 return ret;
860 }
861
862 MultiversionSpec & getDefaultSpec() // Spec from zypp.conf parsing; called before any getSpec
863 { return _specMap[Pathname()]; }
864
865 private:
866 int scanConfAt( const Pathname root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
867 {
868 static const str::regex rx( "^multiversion *= *(.*)" );
869 str::smatch what;
870 return iostr::simpleParseFile( InputStream( Pathname::assertprefix( root_r, _autodetectZyppConfPath() ) ),
871 [&]( int num_r, std::string line_r )->bool
872 {
873 if ( line_r[0] == 'm' && str::regex_match( line_r, what, rx ) )
874 {
875 str::splitEscaped( what[1], std::inserter( spec_r, spec_r.end() ), ", \t" );
876 return false; // stop after match
877 }
878 return true;
879 } );
880 }
881
882 void scanDirAt( const Pathname root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
883 {
884 // NOTE: Actually we'd need to scan and use the root_r! zypp.conf values.
885 Pathname multiversionDir( zConfImpl_r.cfg_multiversion_path );
886 if ( multiversionDir.empty() )
887 multiversionDir = ( zConfImpl_r.cfg_config_path.empty()
888 ? Pathname("/etc/zypp")
889 : zConfImpl_r.cfg_config_path ) / "multiversion.d";
890
891 filesystem::dirForEach( Pathname::assertprefix( root_r, multiversionDir ),
892 [&spec_r]( const Pathname & dir_r, const char *const & name_r )->bool
893 {
894 MIL << "Parsing " << dir_r/name_r << endl;
895 iostr::simpleParseFile( InputStream( dir_r/name_r ),
896 [&spec_r]( int num_r, std::string line_r )->bool
897 {
898 DBG << " found " << line_r << endl;
899 spec_r.insert( std::move(line_r) );
900 return true;
901 } );
902 return true;
903 } );
904 }
905
906 private:
908 };
909
911 { return _multiversionMap.getSpec( _autodetectSystemRoot(), *this ); }
912
914 };
916
918 //
919 // METHOD NAME : ZConfig::instance
920 // METHOD TYPE : ZConfig &
921 //
923 {
924 static ZConfig _instance; // The singleton
925 return _instance;
926 }
927
929 //
930 // METHOD NAME : ZConfig::ZConfig
931 // METHOD TYPE : Ctor
932 //
934 : _pimpl( new Impl )
935 {
936 about( MIL );
937 }
938
940 //
941 // METHOD NAME : ZConfig::~ZConfig
942 // METHOD TYPE : Dtor
943 //
945 {}
946
948 { return _pimpl->notifyTargetChanged(); }
949
951 { return _autodetectSystemRoot(); }
952
954 {
955 return ( _pimpl->cfg_repo_mgr_root_path.empty()
956 ? systemRoot() : _pimpl->cfg_repo_mgr_root_path );
957 }
958
960 { _pimpl->cfg_repo_mgr_root_path = root; }
961
963 //
964 // system architecture
965 //
967
969 {
970 static Arch _val( _autodetectSystemArchitecture() );
971 return _val;
972 }
973
975 { return _pimpl->cfg_arch; }
976
978 {
979 if ( arch_r != _pimpl->cfg_arch )
980 {
981 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
982 _pimpl->cfg_arch = arch_r;
983 }
984 }
985
987 //
988 // text locale
989 //
991
993 {
994 static Locale _val( _autodetectTextLocale() );
995 return _val;
996 }
997
999 { return _pimpl->cfg_textLocale; }
1000
1001 void ZConfig::setTextLocale( const Locale & locale_r )
1002 {
1003 if ( locale_r != _pimpl->cfg_textLocale )
1004 {
1005 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
1006 _pimpl->cfg_textLocale = locale_r;
1007 // Propagate changes
1008 sat::Pool::instance().setTextLocale( locale_r );
1009 }
1010 }
1011
1013 // user data
1015
1017 { return !_pimpl->userData.empty(); }
1018
1019 std::string ZConfig::userData() const
1020 { return _pimpl->userData; }
1021
1022 bool ZConfig::setUserData( const std::string & str_r )
1023 {
1024 for_( ch, str_r.begin(), str_r.end() )
1025 {
1026 if ( *ch < ' ' && *ch != '\t' )
1027 {
1028 ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl;
1029 return false;
1030 }
1031 }
1032 MIL << "Set user data string to '" << str_r << "'" << endl;
1033 _pimpl->userData = str_r;
1034 return true;
1035 }
1036
1038
1040 {
1041 return ( _pimpl->cfg_cache_path.get().empty()
1042 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.get() );
1043 }
1044
1046 {
1047 return repoCachePath()/"pubkeys";
1048 }
1049
1051 {
1052 _pimpl->cfg_cache_path = path_r;
1053 }
1054
1056 {
1057 return ( _pimpl->cfg_metadata_path.get().empty()
1058 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path.get() );
1059 }
1060
1062 {
1063 _pimpl->cfg_metadata_path = path_r;
1064 }
1065
1067 {
1068 return ( _pimpl->cfg_solvfiles_path.get().empty()
1069 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.get() );
1070 }
1071
1073 {
1074 _pimpl->cfg_solvfiles_path = path_r;
1075 }
1076
1078 {
1079 return ( _pimpl->cfg_packages_path.get().empty()
1080 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path.get() );
1081 }
1082
1084 {
1085 _pimpl->cfg_packages_path = path_r;
1086 }
1087
1089 { return _pimpl->cfg_cache_path.getDefault().empty() ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.getDefault(); }
1090
1092 { return _pimpl->cfg_metadata_path.getDefault().empty() ? (builtinRepoCachePath()/"raw") : _pimpl->cfg_metadata_path.getDefault(); }
1093
1095 { return _pimpl->cfg_solvfiles_path.getDefault().empty() ? (builtinRepoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.getDefault(); }
1096
1098 { return _pimpl->cfg_packages_path.getDefault().empty() ? (builtinRepoCachePath()/"packages") : _pimpl->cfg_packages_path.getDefault(); }
1099
1101
1103 {
1104 return ( _pimpl->cfg_config_path.empty()
1105 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
1106 }
1107
1109 {
1110 return ( _pimpl->cfg_known_repos_path.empty()
1111 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
1112 }
1113
1115 {
1116 return ( _pimpl->cfg_known_services_path.empty()
1117 ? (configPath()/"services.d") : _pimpl->cfg_known_services_path );
1118 }
1119
1121 { return configPath()/"needreboot"; }
1122
1124 { return configPath()/"needreboot.d"; }
1125
1126 void ZConfig::setGeoipEnabled( bool enable )
1127 { _pimpl->geoipEnabled = enable; }
1128
1130 { return _pimpl->geoipEnabled; }
1131
1133 { return builtinRepoCachePath()/"geoip.d"; }
1134
1135 const std::vector<std::string> ZConfig::geoipHostnames () const
1136 { return _pimpl->geoipHosts; }
1137
1139 {
1140 return ( _pimpl->cfg_vars_path.empty()
1141 ? (configPath()/"vars.d") : _pimpl->cfg_vars_path );
1142 }
1143
1145 {
1146 return ( _pimpl->cfg_vendor_path.empty()
1147 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
1148 }
1149
1151 {
1152 return ( _pimpl->locks_file.empty()
1153 ? (configPath()/"locks") : _pimpl->locks_file );
1154 }
1155
1157
1159 { return _pimpl->repo_add_probe; }
1160
1162 { return _pimpl->repo_refresh_delay; }
1163
1165 { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
1166
1168 { return _pimpl->repoLabelIsAlias; }
1169
1170 void ZConfig::repoLabelIsAlias( bool yesno_r )
1171 { _pimpl->repoLabelIsAlias = yesno_r; }
1172
1174 { return _pimpl->download_use_deltarpm; }
1175
1177 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
1178
1180 { return _pimpl->download_media_prefer_download; }
1181
1183 { _pimpl->download_media_prefer_download.set( yesno_r ); }
1184
1186 { _pimpl->download_media_prefer_download.restoreToDefault(); }
1187
1189 { return _pimpl->_mediaConf.download_max_concurrent_connections(); }
1190
1192 { return _pimpl->_mediaConf.download_min_download_speed(); }
1193
1195 { return _pimpl->_mediaConf.download_max_download_speed(); }
1196
1198 { return _pimpl->_mediaConf.download_max_silent_tries(); }
1199
1201 { return _pimpl->_mediaConf.download_transfer_timeout(); }
1202
1203 Pathname ZConfig::download_mediaMountdir() const { return _pimpl->download_mediaMountdir; }
1204 void ZConfig::set_download_mediaMountdir( Pathname newval_r ) { _pimpl->download_mediaMountdir.set( std::move(newval_r) ); }
1205 void ZConfig::set_default_download_mediaMountdir() { _pimpl->download_mediaMountdir.restoreToDefault(); }
1206
1208 { return _pimpl->commit_downloadMode; }
1209
1210
1211 bool ZConfig::gpgCheck() const { return _pimpl->gpgCheck; }
1212 TriBool ZConfig::repoGpgCheck() const { return _pimpl->repoGpgCheck; }
1213 TriBool ZConfig::pkgGpgCheck() const { return _pimpl->pkgGpgCheck; }
1214
1215 void ZConfig::setGpgCheck( bool val_r ) { _pimpl->gpgCheck.set( val_r ); }
1216 void ZConfig::setRepoGpgCheck( TriBool val_r ) { _pimpl->repoGpgCheck.set( val_r ); }
1217 void ZConfig::setPkgGpgCheck( TriBool val_r ) { _pimpl->pkgGpgCheck.set( val_r ); }
1218
1219 void ZConfig::resetGpgCheck() { _pimpl->gpgCheck.restoreToDefault(); }
1220 void ZConfig::resetRepoGpgCheck() { _pimpl->repoGpgCheck.restoreToDefault(); }
1221 void ZConfig::resetPkgGpgCheck() { _pimpl->pkgGpgCheck.restoreToDefault(); }
1222
1223
1224 ResolverFocus ZConfig::solver_focus() const { return _pimpl->targetDefaults().solver_focus; }
1225 bool ZConfig::solver_onlyRequires() const { return _pimpl->targetDefaults().solver_onlyRequires; }
1226 bool ZConfig::solver_allowVendorChange() const { return _pimpl->targetDefaults().solver_allowVendorChange; }
1227 bool ZConfig::solver_dupAllowDowngrade() const { return _pimpl->targetDefaults().solver_dupAllowDowngrade; }
1228 bool ZConfig::solver_dupAllowNameChange() const { return _pimpl->targetDefaults().solver_dupAllowNameChange; }
1229 bool ZConfig::solver_dupAllowArchChange() const { return _pimpl->targetDefaults().solver_dupAllowArchChange; }
1230 bool ZConfig::solver_dupAllowVendorChange() const { return _pimpl->targetDefaults().solver_dupAllowVendorChange; }
1231 bool ZConfig::solver_cleandepsOnRemove() const { return _pimpl->targetDefaults().solver_cleandepsOnRemove; }
1232 unsigned ZConfig::solver_upgradeTestcasesToKeep() const { return _pimpl->targetDefaults().solver_upgradeTestcasesToKeep; }
1233
1234 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages; }
1235 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.set( val_r ); }
1236 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
1237
1238
1240 { return ( _pimpl->solver_checkSystemFile.empty()
1241 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
1242
1244 { return ( _pimpl->solver_checkSystemFileDir.empty()
1245 ? (configPath()/"systemCheck.d") : _pimpl->solver_checkSystemFileDir ); }
1246
1247
1248 namespace
1249 {
1250 inline void sigMultiversionSpecChanged()
1251 {
1253 }
1254 }
1255
1256 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); }
1257 void ZConfig::multiversionSpec( std::set<std::string> new_r ) { _pimpl->multiversion().swap( new_r ); sigMultiversionSpecChanged(); }
1258 void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); sigMultiversionSpecChanged(); }
1259 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); sigMultiversionSpecChanged(); }
1260 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); sigMultiversionSpecChanged(); }
1261
1263 { return _pimpl->apply_locks_file; }
1264
1266 {
1267 return ( _pimpl->update_data_path.empty()
1268 ? Pathname("/var/adm") : _pimpl->update_data_path );
1269 }
1270
1272 {
1273 return ( _pimpl->update_messages_path.empty()
1274 ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
1275 }
1276
1278 {
1279 return ( _pimpl->update_scripts_path.empty()
1280 ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
1281 }
1282
1284 { return _pimpl->updateMessagesNotify; }
1285
1286 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
1287 { _pimpl->updateMessagesNotify.set( val_r ); }
1288
1290 { _pimpl->updateMessagesNotify.restoreToDefault(); }
1291
1293
1294 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
1295 { return _pimpl->rpmInstallFlags; }
1296
1297
1299 {
1300 return ( _pimpl->history_log_path.empty() ?
1301 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
1302 }
1303
1305 {
1306 return _pimpl->_mediaConf.credentialsGlobalDir();
1307 }
1308
1310 {
1311 return _pimpl->_mediaConf.credentialsGlobalFile();
1312 }
1313
1315
1316 std::string ZConfig::distroverpkg() const
1317 { return "system-release"; }
1318
1320
1322 { return _pimpl->pluginsPath.get(); }
1323
1325 {
1326 return _pimpl->cfg_kernel_keep_spec;
1327 }
1328
1330
1331 std::ostream & ZConfig::about( std::ostream & str ) const
1332 {
1333 str << "libzypp: " LIBZYPP_VERSION_STRING << endl;
1334
1335 str << "libsolv: " << solv_version;
1336 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
1337 str << " (built against " << LIBSOLV_VERSION_STRING << ")";
1338 str << endl;
1339
1340 str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
1341 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
1342 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
1343 return str;
1344 }
1345
1347} // namespace zypp
#define LIBZYPP_VERSION_STRING
Definition: APIConfig.h:15
Architecture.
Definition: Arch.h:37
Helper to create and pass std::istream.
Definition: inputstream.h:57
'Language[_Country]' codes.
Definition: Locale.h:50
static const Locale enCode
Last resort "en".
Definition: Locale.h:77
bool setConfigValue(const std::string &section, const std::string &entry, const std::string &value)
Definition: mediaconfig.cc:52
static MediaConfig & instance()
Definition: mediaconfig.cc:46
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition: Target.cc:94
ZConfig implementation.
Definition: ZConfig.cc:406
Pathname cfg_multiversion_path
Definition: ZConfig.cc:769
DefaultOption< Pathname > download_mediaMountdir
Definition: ZConfig.cc:786
MediaConfig & _mediaConf
Definition: ZConfig.cc:815
std::set< std::string > MultiversionSpec
Definition: ZConfig.cc:407
DefaultOption< Pathname > cfg_metadata_path
Definition: ZConfig.cc:758
Pathname cfg_known_repos_path
Definition: ZConfig.cc:763
Pathname cfg_known_services_path
Definition: ZConfig.cc:764
Pathname cfg_vars_path
Definition: ZConfig.cc:765
DefaultOption< Pathname > cfg_packages_path
Definition: ZConfig.cc:760
bool download_use_deltarpm_always
Definition: ZConfig.cc:784
Pathname _parsedZyppConf
Remember any parsed zypp.conf.
Definition: ZConfig.cc:752
void notifyTargetChanged()
Definition: ZConfig.cc:726
Pathname solver_checkSystemFile
Definition: ZConfig.cc:794
MultiversionMap _multiversionMap
Definition: ZConfig.cc:913
Pathname update_data_path
Definition: ZConfig.cc:773
Pathname history_log_path
Definition: ZConfig.cc:804
Pathname locks_file
Definition: ZConfig.cc:771
const TargetDefaults & targetDefaults() const
Definition: ZConfig.cc:819
MultiversionSpec & getMultiversion() const
Definition: ZConfig.cc:910
LocaleSet repoRefreshLocales
Definition: ZConfig.cc:780
DefaultOption< Pathname > cfg_cache_path
Definition: ZConfig.cc:757
std::vector< std::string > geoipHosts
Definition: ZConfig.cc:812
TargetDefaults & targetDefaults()
Definition: ZConfig.cc:820
Pathname update_scripts_path
Definition: ZConfig.cc:774
Option< Pathname > pluginsPath
Definition: ZConfig.cc:808
std::string userData
Definition: ZConfig.cc:806
std::string cfg_kernel_keep_spec
Definition: ZConfig.cc:770
DefaultOption< TriBool > repoGpgCheck
Definition: ZConfig.cc:791
unsigned repo_refresh_delay
Definition: ZConfig.cc:779
Option< DownloadMode > commit_downloadMode
Definition: ZConfig.cc:788
std::optional< TargetDefaults > _currentTargetDefaults
TargetDefaults while –root.
Definition: ZConfig.cc:823
MultiversionSpec & multiversion()
Definition: ZConfig.cc:797
Locale cfg_textLocale
Definition: ZConfig.cc:755
DefaultOption< bool > download_media_prefer_download
Definition: ZConfig.cc:785
bool download_use_deltarpm
Definition: ZConfig.cc:783
Pathname solver_checkSystemFileDir
Definition: ZConfig.cc:795
Pathname cfg_config_path
Definition: ZConfig.cc:762
TargetDefaults _initialTargetDefaults
Initial TargetDefaults from /.
Definition: ZConfig.cc:822
target::rpm::RpmInstFlags rpmInstallFlags
Definition: ZConfig.cc:802
Pathname update_messages_path
Definition: ZConfig.cc:775
const MultiversionSpec & multiversion() const
Definition: ZConfig.cc:798
Pathname cfg_repo_mgr_root_path
Definition: ZConfig.cc:766
DefaultOption< TriBool > pkgGpgCheck
Definition: ZConfig.cc:792
DefaultOption< std::string > updateMessagesNotify
Definition: ZConfig.cc:776
Pathname cfg_vendor_path
Definition: ZConfig.cc:768
DefaultOption< Pathname > cfg_solvfiles_path
Definition: ZConfig.cc:759
DefaultOption< bool > gpgCheck
Definition: ZConfig.cc:790
Interim helper class to collect global options and settings.
Definition: ZConfig.h:64
bool hasUserData() const
Whether a (non empty) user data sting is defined.
Definition: ZConfig.cc:1016
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Definition: ZConfig.cc:1231
std::string userData() const
User defined string value to be passed to log, history, plugins...
Definition: ZConfig.cc:1019
Pathname knownServicesPath() const
Path where the known services .service files are kept (configPath()/services.d).
Definition: ZConfig.cc:1114
void removeMultiversionSpec(const std::string &name_r)
Definition: ZConfig.cc:1260
Pathname repoPackagesPath() const
Path where the repo packages are downloaded and kept (repoCachePath()/packages).
Definition: ZConfig.cc:1077
unsigned repo_refresh_delay() const
Amount of time in minutes that must pass before another refresh.
Definition: ZConfig.cc:1161
Arch systemArchitecture() const
The system architecture zypp uses.
Definition: ZConfig.cc:974
Locale textLocale() const
The locale for translated texts zypp uses.
Definition: ZConfig.cc:998
const std::vector< std::string > geoipHostnames() const
All hostnames we want to rewrite using the geoip feature.
Definition: ZConfig.cc:1135
Pathname update_dataPath() const
Path where the update items are kept (/var/adm)
Definition: ZConfig.cc:1265
ResolverFocus solver_focus() const
The resolver's general attitude when resolving jobs.
Definition: ZConfig.cc:1224
Pathname update_messagesPath() const
Path where the repo solv files are created and kept (update_dataPath()/solv).
Definition: ZConfig.cc:1271
Pathname builtinRepoSolvfilesPath() const
The builtin config file value.
Definition: ZConfig.cc:1094
Pathname pluginsPath() const
Defaults to /usr/lib/zypp/plugins.
Definition: ZConfig.cc:1321
Pathname repoManagerRoot() const
The RepoManager root directory.
Definition: ZConfig.cc:953
void resetRepoGpgCheck()
Reset to the zconfig default.
Definition: ZConfig.cc:1220
bool gpgCheck() const
Turn signature checking on/off (on)
Definition: ZConfig.cc:1211
Pathname knownReposPath() const
Path where the known repositories .repo files are kept (configPath()/repos.d).
Definition: ZConfig.cc:1108
Pathname update_scriptsPath() const
Path where the repo metadata is downloaded and kept (update_dataPath()/).
Definition: ZConfig.cc:1277
long download_transfer_timeout() const
Maximum time in seconds that you allow a transfer operation to take.
Definition: ZConfig.cc:1200
void setRepoManagerRoot(const Pathname &root)
Sets the RepoManager root directory.
Definition: ZConfig.cc:959
bool solver_dupAllowArchChange() const
DUP tune: Whether to allow package arch changes upon DUP.
Definition: ZConfig.cc:1229
void setTextLocale(const Locale &locale_r)
Set the preferred locale for translated texts.
Definition: ZConfig.cc:1001
bool solverUpgradeRemoveDroppedPackages() const
Whether dist upgrade should remove a products dropped packages (true).
Definition: ZConfig.cc:1234
void notifyTargetChanged()
internal
Definition: ZConfig.cc:947
static Locale defaultTextLocale()
The autodetected preferred locale for translated texts.
Definition: ZConfig.cc:992
Pathname download_mediaMountdir() const
Path where media are preferably mounted or downloaded.
Definition: ZConfig.cc:1203
void resetSolverUpgradeRemoveDroppedPackages()
Reset solverUpgradeRemoveDroppedPackages to the zypp.conf default.
Definition: ZConfig.cc:1236
bool apply_locks_file() const
Whether locks file should be read and applied after start (true)
Definition: ZConfig.cc:1262
bool solver_allowVendorChange() const
Whether vendor check is by default enabled.
Definition: ZConfig.cc:1226
void set_default_download_mediaMountdir()
Reset to zypp.cong default.
Definition: ZConfig.cc:1205
Pathname repoCachePath() const
Path where the caches are kept (/var/cache/zypp)
Definition: ZConfig.cc:1039
void setPkgGpgCheck(TriBool val_r)
Change the value.
Definition: ZConfig.cc:1217
Pathname needrebootPath() const
Path where the custom needreboot config files are kept (configPath()/needreboot.d).
Definition: ZConfig.cc:1123
bool setUserData(const std::string &str_r)
Set a new userData string.
Definition: ZConfig.cc:1022
Pathname systemRoot() const
The target root directory.
Definition: ZConfig.cc:950
long download_max_silent_tries() const
Maximum silent tries.
Definition: ZConfig.cc:1197
bool repo_add_probe() const
Whether repository urls should be probed.
Definition: ZConfig.cc:1158
target::rpm::RpmInstFlags rpmInstallFlags() const
The default target::rpm::RpmInstFlags for ZYppCommitPolicy.
Definition: ZConfig.cc:1294
void setUpdateMessagesNotify(const std::string &val_r)
Set a new command definition (see update.messages.notify in zypp.conf).
Definition: ZConfig.cc:1286
unsigned solver_upgradeTestcasesToKeep() const
When committing a dist upgrade (e.g.
Definition: ZConfig.cc:1232
Pathname repoMetadataPath() const
Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
Definition: ZConfig.cc:1055
Pathname geoipCachePath() const
Path where the geoip caches are kept (/var/cache/zypp/geoip)
Definition: ZConfig.cc:1132
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d)
Definition: ZConfig.cc:1144
long download_min_download_speed() const
Minimum download speed (bytes per second) until the connection is dropped.
Definition: ZConfig.cc:1191
DownloadMode commit_downloadMode() const
Commit download policy to use as default.
Definition: ZConfig.cc:1207
Pathname needrebootFile() const
Path of the default needreboot config file (configPath()/needreboot).
Definition: ZConfig.cc:1120
void setGpgCheck(bool val_r)
Change the value.
Definition: ZConfig.cc:1215
bool solver_dupAllowVendorChange() const
DUP tune: Whether to allow package vendor changes upon DUP.
Definition: ZConfig.cc:1230
~ZConfig()
Dtor.
Definition: ZConfig.cc:944
void setGeoipEnabled(bool enable=true)
Enables or disables the use of the geoip feature of download.opensuse.org.
Definition: ZConfig.cc:1126
Pathname locksFile() const
Path where zypp can find or create lock file (configPath()/locks)
Definition: ZConfig.cc:1150
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Pointer to implementation.
Definition: ZConfig.h:593
Pathname repoSolvfilesPath() const
Path where the repo solv files are created and kept (repoCachePath()/solv).
Definition: ZConfig.cc:1066
bool geoipEnabled() const
Returns true if zypp should use the geoip feature of download.opensuse.org.
Definition: ZConfig.cc:1129
Pathname historyLogFile() const
Path where ZYpp install history is logged.
Definition: ZConfig.cc:1298
void setSystemArchitecture(const Arch &arch_r)
Override the zypp system architecture.
Definition: ZConfig.cc:977
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1213
static ZConfig & instance()
Singleton ctor.
Definition: ZConfig.cc:922
void setRepoPackagesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:1083
void setRepoSolvfilesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:1072
void resetUpdateMessagesNotify()
Reset to the zypp.conf default.
Definition: ZConfig.cc:1289
std::ostream & about(std::ostream &str) const
Print some detail about the current libzypp version.
Definition: ZConfig.cc:1331
const std::set< std::string > & multiversionSpec() const
Definition: ZConfig.cc:1256
void set_download_mediaMountdir(Pathname newval_r)
Set alternate value.
Definition: ZConfig.cc:1204
bool download_use_deltarpm() const
Whether to consider using a deltarpm when downloading a package.
Definition: ZConfig.cc:1173
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1212
void set_download_media_prefer_download(bool yesno_r)
Set download_media_prefer_download to a specific value.
Definition: ZConfig.cc:1182
std::string updateMessagesNotify() const
Command definition for sending update messages.
Definition: ZConfig.cc:1283
void addMultiversionSpec(const std::string &name_r)
Definition: ZConfig.cc:1259
Pathname builtinRepoCachePath() const
The builtin config file value.
Definition: ZConfig.cc:1088
Pathname builtinRepoPackagesPath() const
The builtin config file value.
Definition: ZConfig.cc:1097
Pathname solver_checkSystemFile() const
File in which dependencies described which has to be fulfilled for a running system.
Definition: ZConfig.cc:1239
Pathname builtinRepoMetadataPath() const
The builtin config file value.
Definition: ZConfig.cc:1091
void set_default_download_media_prefer_download()
Set download_media_prefer_download to the configfiles default.
Definition: ZConfig.cc:1185
Pathname solver_checkSystemFileDir() const
Directory, which may or may not contain files in which dependencies described which has to be fulfill...
Definition: ZConfig.cc:1243
void resetGpgCheck()
Reset to the zconfig default.
Definition: ZConfig.cc:1219
void setSolverUpgradeRemoveDroppedPackages(bool val_r)
Set solverUpgradeRemoveDroppedPackages to val_r.
Definition: ZConfig.cc:1235
Pathname configPath() const
Path where the configfiles are kept (/etc/zypp).
Definition: ZConfig.cc:1102
static Arch defaultSystemArchitecture()
The autodetected system architecture.
Definition: ZConfig.cc:968
ZConfig()
Default ctor.
Definition: ZConfig.cc:933
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Definition: ZConfig.cc:1045
long download_max_concurrent_connections() const
Maximum number of concurrent connections for a single transfer.
Definition: ZConfig.cc:1188
void resetPkgGpgCheck()
Reset to the zconfig default.
Definition: ZConfig.cc:1221
bool solver_onlyRequires() const
Solver regards required packages,patterns,... only.
Definition: ZConfig.cc:1225
Pathname varsPath() const
Path containing custom repo variable definitions (configPath()/vars.d).
Definition: ZConfig.cc:1138
bool solver_dupAllowNameChange() const
DUP tune: Whether to follow package renames upon DUP.
Definition: ZConfig.cc:1228
bool repoLabelIsAlias() const
Whether to use repository alias or name in user messages (progress, exceptions, .....
Definition: ZConfig.cc:1167
void clearMultiversionSpec()
Definition: ZConfig.cc:1258
LocaleSet repoRefreshLocales() const
List of locales for which translated package descriptions should be downloaded.
Definition: ZConfig.cc:1164
long download_max_download_speed() const
Maximum download speed (bytes per second)
Definition: ZConfig.cc:1194
void setRepoMetadataPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:1061
bool solver_dupAllowDowngrade() const
DUP tune: Whether to allow version downgrades upon DUP.
Definition: ZConfig.cc:1227
std::string multiversionKernels() const
Definition: ZConfig.cc:1324
std::string distroverpkg() const
Package telling the "product version" on systems not using /etc/product.d/baseproduct.
Definition: ZConfig.cc:1316
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Definition: ZConfig.cc:1176
void setRepoCachePath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:1050
void setRepoGpgCheck(TriBool val_r)
Change the value.
Definition: ZConfig.cc:1216
Pathname credentialsGlobalDir() const
Defaults to /etc/zypp/credentials.d.
Definition: ZConfig.cc:1304
bool download_media_prefer_download() const
Hint which media to prefer when installing packages (download vs.
Definition: ZConfig.cc:1179
Pathname credentialsGlobalFile() const
Defaults to /etc/zypp/credentials.cat.
Definition: ZConfig.cc:1309
Wrapper class for stat/lstat.
Definition: PathInfo.h:221
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
Definition: Pathname.h:173
bool empty() const
Test for an empty path.
Definition: Pathname.h:114
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Definition: Pathname.cc:272
Simple lineparser: Traverse each line in a file.
Definition: IOStream.h:112
bool next()
Advance to next line.
Definition: IOStream.cc:72
Parses a INI file and offers its structure as a dictionary.
Definition: inidict.h:42
section_const_iterator sectionsEnd() const
Definition: inidict.cc:113
EntrySet::const_iterator entry_const_iterator
Definition: inidict.h:48
MapKVIteratorTraits< SectionSet >::Key_const_iterator section_const_iterator
Definition: inidict.h:47
entry_const_iterator entriesBegin(const std::string &section) const
Definition: inidict.cc:75
Iterable< entry_const_iterator > entries(const std::string &section) const
Definition: inidict.cc:97
section_const_iterator sectionsBegin() const
Definition: inidict.cc:108
entry_const_iterator entriesEnd(const std::string &section) const
Definition: inidict.cc:86
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:233
static Pool instance()
Singleton ctor.
Definition: Pool.h:55
Regular expression.
Definition: Regex.h:95
Regular expression match result.
Definition: Regex.h:168
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:30
Definition: Arch.h:361
String related utilities and Regular expression matching.
Types and functions for filesystem operations.
Definition: Glob.cc:24
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
Definition: PathInfo.cc:32
int simpleParseFile(std::istream &str_r, ParseFlags flags_r, function< bool(int, std::string)> consume_r)
Simple lineparser optionally trimming and skipping comments.
Definition: IOStream.cc:124
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1027
TriBool strToTriBool(const C_Str &str)
Parse str into a bool if it's a legal true or false string; else indeterminate.
Definition: String.cc:93
bool regex_match(const std::string &s, smatch &matches, const regex &regex)
\relates regex \ingroup ZYPP_STR_REGEX \relates regex \ingroup ZYPP_STR_REGEX
Definition: Regex.h:70
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
Definition: String.h:429
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", const Trim trim_r=NO_TRIM)
Split line_r into words.
Definition: String.h:531
TInt strtonum(const C_Str &str)
Parsing numbers from string.
unsigned splitEscaped(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false)
Split line_r into words with respect to escape delimeters.
Definition: String.h:595
int compareCI(const C_Str &lhs, const C_Str &rhs)
Definition: String.h:984
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
bool fromString(const std::string &val_r, ResolverFocus &ret_r)
ResolverFocus
The resolver's general attitude.
Definition: ResolverFocus.h:22
@ Default
Request the standard behavior (as defined in zypp.conf or 'Job')
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:28
DownloadMode
Supported commit download policies.
Definition: DownloadMode.h:23
@ DownloadDefault
libzypp will decide what to do.
Definition: DownloadMode.h:24
Mutable option with initial value also remembering a config value.
Definition: ZConfig.cc:364
DefaultOption(value_type initial_r)
Definition: ZConfig.cc:368
option_type _default
Definition: ZConfig.cc:393
void setDefault(value_type newval_r)
Set a new default value.
Definition: ZConfig.cc:389
void restoreToDefault(value_type newval_r)
Reset value to a new default.
Definition: ZConfig.cc:381
DefaultOption & operator=(value_type newval_r)
Definition: ZConfig.cc:373
Option< Tp > option_type
Definition: ZConfig.cc:366
void restoreToDefault()
Reset value to the current default.
Definition: ZConfig.cc:377
const value_type & getDefault() const
Get the current default value.
Definition: ZConfig.cc:385
Mutable option.
Definition: ZConfig.cc:334
const value_type & get() const
Get the value.
Definition: ZConfig.cc:346
Option & operator=(value_type newval_r)
Definition: ZConfig.cc:342
void set(value_type newval_r)
Set a new value.
Definition: ZConfig.cc:354
Option(value_type initial_r)
No default ctor, explicit initialisation!
Definition: ZConfig.cc:338
value_type _val
Definition: ZConfig.cc:358
MultiversionSpec & getSpec(Pathname root_r, const Impl &zConfImpl_r)
Definition: ZConfig.cc:835
void scanDirAt(const Pathname root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition: ZConfig.cc:882
MultiversionSpec & getDefaultSpec()
Definition: ZConfig.cc:862
std::map< Pathname, MultiversionSpec > SpecMap
Definition: ZConfig.cc:833
int scanConfAt(const Pathname root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition: ZConfig.cc:866
Settings that follow a changed Target.
Definition: ZConfig.cc:411
Option< bool > solver_dupAllowVendorChange
Definition: ZConfig.cc:479
DefaultOption< bool > solverUpgradeRemoveDroppedPackages
Definition: ZConfig.cc:482
Option< unsigned > solver_upgradeTestcasesToKeep
Definition: ZConfig.cc:481
Option< bool > solver_dupAllowDowngrade
Definition: ZConfig.cc:476
Option< bool > solver_dupAllowArchChange
Definition: ZConfig.cc:478
bool consume(const std::string &entry, const std::string &value)
Definition: ZConfig.cc:425
Option< bool > solver_cleandepsOnRemove
Definition: ZConfig.cc:480
Option< bool > solver_allowVendorChange
Definition: ZConfig.cc:475
Option< bool > solver_dupAllowNameChange
Definition: ZConfig.cc:477
static PoolImpl & myPool()
Definition: PoolImpl.cc:184
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
#define DBG
Definition: Logger.h:95
#define MIL
Definition: Logger.h:96
#define ERR
Definition: Logger.h:98
#define WAR
Definition: Logger.h:97