libzypp 17.38.5

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