15 #include <sys/utsname.h> 16 #if __GLIBC_PREREQ (2,16) 20 #include <solv/solvversion.h> 25 #include <zypp-core/APIConfig.h> 28 #include <zypp-core/base/InputStream> 35 #include <zypp-core/parser/IniDict> 40 #include <zypp-media/MediaConfig> 46 #undef ZYPP_BASE_LOGGER_LOGGROUP 47 #define ZYPP_BASE_LOGGER_LOGGROUP "zconfig" 67 # if defined(__linux__) && defined(__x86_64__) 68 static inline void cpuid(uint32_t op, uint32_t op2, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
72 :
"=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
73 :
"a" (op),
"c" (op2));
79 #define bit_SSE3 (1 << 0) 80 #define bit_SSSE3 (1 << 9) 81 #define bit_FMA (1 << 12) 82 #define bit_CMPXCHG16B (1 << 13) 83 #define bit_SSE4_1 (1 << 19) 84 #define bit_SSE4_2 (1 << 20) 85 #define bit_MOVBE (1 << 22) 86 #define bit_POPCNT (1 << 23) 87 #define bit_OSXSAVE (1 << 27) 88 #define bit_AVX (1 << 28) 89 #define bit_F16C (1 << 29) 93 #define bit_LAHF_LM (1 << 0) 94 #define bit_LZCNT (1 << 5) 98 #define bit_BMI (1 << 3) 99 #define bit_AVX2 (1 << 5) 100 #define bit_BMI2 (1 << 8) 101 #define bit_AVX512F (1 << 16) 102 #define bit_AVX512DQ (1 << 17) 103 #define bit_AVX512CD (1 << 28) 104 #define bit_AVX512BW (1 << 30) 105 #define bit_AVX512VL (1u << 31) 107 static int get_x86_64_level(
void)
111 unsigned int op_1_ecx = 0, op_80000001_ecx = 0, op_7_ebx = 0, unused = 0;
112 cpuid(1, 0, &unused, &unused, &op_1_ecx, &unused);
113 cpuid(0x80000001, 0, &unused, &unused, &op_80000001_ecx, &unused);
114 cpuid(7, 0, &unused, &op_7_ebx, &unused, &unused);
116 const unsigned int op_1_ecx_lv2 = bit_SSE3 | bit_SSSE3 | bit_CMPXCHG16B | bit_SSE4_1 | bit_SSE4_2 | bit_POPCNT;
117 if ((op_1_ecx & op_1_ecx_lv2) == op_1_ecx_lv2 && (op_80000001_ecx & bit_LAHF_LM))
120 const unsigned int op_1_ecx_lv3 = bit_FMA | bit_MOVBE | bit_OSXSAVE | bit_AVX | bit_F16C;
121 const unsigned int op_7_ebx_lv3 = bit_BMI | bit_AVX2 | bit_BMI2;
122 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
123 && (op_80000001_ecx & bit_LZCNT))
126 const unsigned int op_7_ebx_lv4 = bit_AVX512F | bit_AVX512DQ | bit_AVX512CD | bit_AVX512BW | bit_AVX512VL;
127 if (level == 3 && (op_7_ebx & op_7_ebx_lv4) == op_7_ebx_lv4)
137 Arch _autodetectSystemArchitecture()
139 struct ::utsname buf;
140 if ( ::uname( &buf ) < 0 )
142 ERR <<
"Can't determine system architecture" << endl;
146 Arch architecture( buf.machine );
147 MIL <<
"Uname architecture is '" << buf.machine <<
"'" << endl;
149 if ( architecture == Arch_x86_64 )
151 #if defined(__linux__) && defined(__x86_64__) 152 switch ( get_x86_64_level() )
155 architecture = Arch_x86_64_v2;
156 WAR <<
"CPU has 'x86_64': architecture upgraded to '" << architecture <<
"'" << endl;
159 architecture = Arch_x86_64_v3;
160 WAR <<
"CPU has 'x86_64': architecture upgraded to '" << architecture <<
"'" << endl;
163 architecture = Arch_x86_64_v4;
164 WAR <<
"CPU has 'x86_64': architecture upgraded to '" << architecture <<
"'" << endl;
169 else if ( architecture == Arch_i686 )
174 std::ifstream cpuinfo(
"/proc/cpuinfo" );
177 for( iostr::EachLine in( cpuinfo ); in; in.next() )
181 if ( in->find(
"cx8" ) == std::string::npos
182 || in->find(
"cmov" ) == std::string::npos )
184 architecture = Arch_i586;
185 WAR <<
"CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture <<
"'" << endl;
193 ERR <<
"Cant open " <<
PathInfo(
"/proc/cpuinfo") << endl;
196 else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
199 std::ifstream cpuinfo(
"/proc/cpuinfo" );
202 for( iostr::EachLine in( cpuinfo ); in; in.next() )
206 if ( in->find(
"sun4v" ) != std::string::npos )
208 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
209 WAR <<
"CPU has 'sun4v': architecture upgraded to '" << architecture <<
"'" << endl;
211 else if ( in->find(
"sun4u" ) != std::string::npos )
213 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
214 WAR <<
"CPU has 'sun4u': architecture upgraded to '" << architecture <<
"'" << endl;
216 else if ( in->find(
"sun4m" ) != std::string::npos )
218 architecture = Arch_sparcv8;
219 WAR <<
"CPU has 'sun4m': architecture upgraded to '" << architecture <<
"'" << endl;
227 ERR <<
"Cant open " <<
PathInfo(
"/proc/cpuinfo") << endl;
230 else if ( architecture == Arch_armv8l || architecture == Arch_armv7l || architecture == Arch_armv6l )
232 std::ifstream platform(
"/etc/rpm/platform" );
235 for( iostr::EachLine in( platform ); in; in.next() )
239 architecture = Arch_armv8hl;
240 WAR <<
"/etc/rpm/platform contains armv8hl-: architecture upgraded to '" << architecture <<
"'" << endl;
245 architecture = Arch_armv7hl;
246 WAR <<
"/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture <<
"'" << endl;
251 architecture = Arch_armv6hl;
252 WAR <<
"/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture <<
"'" << endl;
258 #if __GLIBC_PREREQ (2,16) 259 else if ( architecture == Arch_ppc64 )
261 const char * platform = (
const char *)getauxval( AT_PLATFORM );
263 if ( platform && sscanf( platform,
"power%d", &powerlvl ) == 1 && powerlvl > 6 )
264 architecture = Arch_ppc64p7;
287 Locale _autodetectTextLocale()
290 const char * envlist[] = {
"LC_ALL",
"LC_MESSAGES",
"LANG", NULL };
291 for (
const char ** envvar = envlist; *envvar; ++envvar )
293 const char * envlang = getenv( *envvar );
296 std::string envstr( envlang );
297 if ( envstr !=
"POSIX" && envstr !=
"C" )
299 Locale lang( envstr );
302 MIL <<
"Found " << *envvar <<
"=" << envstr << endl;
309 MIL <<
"Default text locale is '" << ret <<
"'" << endl;
310 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS 311 setenv(
"BOOST_TEST_CATCH_SYSTEM_ERRORS",
"no", 1 );
315 inline Pathname _autodetectZyppConfPath()
317 const char *env_confpath = getenv(
"ZYPP_CONF" );
318 return env_confpath ? env_confpath :
"/etc/zypp/zypp.conf";
333 : _val(
std::move(initial_r) )
337 {
set( std::move(newval_r) );
return *
this; }
349 { _val = std::move(newval_r); }
364 , _default(
std::move(initial_r) )
368 { this->
set( std::move(newval_r) );
return *
this; }
372 { this->
set( _default.get() ); }
376 { setDefault( std::move(newval_r) ); restoreToDefault(); }
380 {
return _default.get(); }
384 { _default.set( std::move(newval_r) ); }
408 , solver_onlyRequires ( true )
409 , solver_allowVendorChange ( false )
410 , solver_dupAllowDowngrade ( true )
411 , solver_dupAllowNameChange ( true )
412 , solver_dupAllowArchChange ( true )
413 , solver_dupAllowVendorChange ( false )
414 , solver_cleandepsOnRemove ( false )
415 , solver_upgradeTestcasesToKeep ( 2 )
416 , solverUpgradeRemoveDroppedPackages ( true )
419 bool consume(
const std::string & entry,
const std::string & value )
421 if ( entry ==
"solver.focus" )
425 else if ( entry ==
"solver.onlyRequires" )
427 solver_onlyRequires.set(
str::strToBool( value, solver_onlyRequires ) );
429 else if ( entry ==
"solver.allowVendorChange" )
431 solver_allowVendorChange.set(
str::strToBool( value, solver_allowVendorChange ) );
433 else if ( entry ==
"solver.dupAllowDowngrade" )
435 solver_dupAllowDowngrade.set(
str::strToBool( value, solver_dupAllowDowngrade ) );
437 else if ( entry ==
"solver.dupAllowNameChange" )
439 solver_dupAllowNameChange.set(
str::strToBool( value, solver_dupAllowNameChange ) );
441 else if ( entry ==
"solver.dupAllowArchChange" )
443 solver_dupAllowArchChange.set(
str::strToBool( value, solver_dupAllowArchChange ) );
445 else if ( entry ==
"solver.dupAllowVendorChange" )
447 solver_dupAllowVendorChange.set(
str::strToBool( value, solver_dupAllowVendorChange ) );
449 else if ( entry ==
"solver.cleandepsOnRemove" )
451 solver_cleandepsOnRemove.set(
str::strToBool( value, solver_cleandepsOnRemove ) );
453 else if ( entry ==
"solver.upgradeTestcasesToKeep" )
455 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
457 else if ( entry ==
"solver.upgradeRemoveDroppedPackages" )
459 solverUpgradeRemoveDroppedPackages.restoreToDefault(
str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
481 : _parsedZyppConf ( _autodetectZyppConfPath() )
482 , cfg_arch ( defaultSystemArchitecture() )
483 , cfg_textLocale ( defaultTextLocale() )
484 , cfg_cache_path {
"/var/cache/zypp" }
485 , cfg_metadata_path {
"" }
486 , cfg_solvfiles_path {
"" }
487 , cfg_packages_path {
"" }
488 , updateMessagesNotify (
"" )
489 , repo_add_probe (
false )
490 , repo_refresh_delay ( 10 )
491 , repoLabelIsAlias (
false )
492 , download_use_deltarpm ( LIBZYPP_CONFIG_USE_DELTARPM_BY_DEFAULT )
493 , download_use_deltarpm_always (
false )
494 , download_media_prefer_download(
true )
495 , download_mediaMountdir (
"/var/adm/mount" )
498 , repoGpgCheck ( indeterminate )
499 , pkgGpgCheck ( indeterminate )
500 , apply_locks_file (
true )
501 , pluginsPath (
"/usr/lib/zypp/plugins" )
502 , geoipEnabled (
true )
503 , geoipHosts {
"download.opensuse.org" }
505 MIL <<
"libzypp: " LIBZYPP_VERSION_STRING <<
" (" << LIBZYPP_CODESTREAM <<
")" << endl;
506 if (
PathInfo(_parsedZyppConf).isExist() )
508 parser::IniDict dict( _parsedZyppConf );
510 sit != dict.sectionsEnd();
513 const std::string& section(*sit);
516 it != dict.entriesEnd(*sit);
519 std::string entry(it->first);
520 std::string value(it->second);
522 if ( _mediaConf.setConfigValue( section, entry, value ) )
526 if ( section ==
"main" )
528 if ( _initialTargetDefaults.consume( entry, value ) )
531 if ( entry ==
"lock_timeout" ) {
534 else if ( entry ==
"arch" )
537 if ( carch != cfg_arch )
539 WAR <<
"Overriding system architecture (" << cfg_arch <<
"): " << carch << endl;
543 else if ( entry ==
"cachedir" )
545 cfg_cache_path.restoreToDefault( value );
547 else if ( entry ==
"metadatadir" )
549 cfg_metadata_path.restoreToDefault( value );
551 else if ( entry ==
"solvfilesdir" )
553 cfg_solvfiles_path.restoreToDefault( value );
555 else if ( entry ==
"packagesdir" )
557 cfg_packages_path.restoreToDefault( value );
559 else if ( entry ==
"configdir" )
563 else if ( entry ==
"reposdir" )
565 cfg_known_repos_path =
Pathname(value);
567 else if ( entry ==
"servicesdir" )
569 cfg_known_services_path =
Pathname(value);
571 else if ( entry ==
"varsdir" )
575 else if ( entry ==
"repo.add.probe" )
579 else if ( entry ==
"repo.refresh.delay" )
583 else if ( entry ==
"repo.refresh.locales" )
585 std::vector<std::string> tmp;
586 str::split( value, back_inserter( tmp ),
", \t" );
588 boost::function<Locale(const std::string &)>
transform(
589 [](
const std::string & str_r)->Locale{
return Locale(str_r); }
591 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(),
transform ),
592 make_transform_iterator( tmp.end(),
transform ) );
594 else if ( entry ==
"download.use_deltarpm" )
596 download_use_deltarpm =
str::strToBool( value, download_use_deltarpm );
598 else if ( entry ==
"download.use_deltarpm.always" )
600 download_use_deltarpm_always =
str::strToBool( value, download_use_deltarpm_always );
602 else if ( entry ==
"download.media_preference" )
604 download_media_prefer_download.restoreToDefault(
str::compareCI( value,
"volatile" ) != 0 );
606 else if ( entry ==
"download.media_mountdir" )
608 download_mediaMountdir.restoreToDefault(
Pathname(value) );
610 else if ( entry ==
"download.use_geoip_mirror") {
613 else if ( entry ==
"commit.downloadMode" )
615 commit_downloadMode.set( deserializeDownloadMode( value ) );
617 else if ( entry ==
"gpgcheck" )
621 else if ( entry ==
"repo_gpgcheck" )
625 else if ( entry ==
"pkg_gpgcheck" )
629 else if ( entry ==
"vendordir" )
633 else if ( entry ==
"multiversiondir" )
635 cfg_multiversion_path =
Pathname(value);
637 else if ( entry ==
"multiversion.kernels" )
639 cfg_kernel_keep_spec = value;
641 else if ( entry ==
"solver.checkSystemFile" )
643 solver_checkSystemFile =
Pathname(value);
645 else if ( entry ==
"solver.checkSystemFileDir" )
647 solver_checkSystemFileDir =
Pathname(value);
649 else if ( entry ==
"multiversion" )
651 MultiversionSpec & defSpec( _multiversionMap.getDefaultSpec() );
654 else if ( entry ==
"locksfile.path" )
658 else if ( entry ==
"locksfile.apply" )
662 else if ( entry ==
"update.datadir" )
667 else if ( entry ==
"update.scriptsdir" )
672 else if ( entry ==
"update.messagessdir" )
677 else if ( entry ==
"update.messages.notify" )
679 updateMessagesNotify.set( value );
681 else if ( entry ==
"rpm.install.excludedocs" )
686 else if ( entry ==
"history.logfile" )
690 else if ( entry ==
"techpreview.ZYPP_SINGLE_RPMTRANS" )
692 DBG <<
"techpreview.ZYPP_SINGLE_RPMTRANS=" << value << endl;
693 ::setenv(
"ZYPP_SINGLE_RPMTRANS", value.c_str(), 1 );
695 else if ( entry ==
"techpreview.ZYPP_MEDIANETWORK" )
697 DBG <<
"techpreview.ZYPP_MEDIANETWORK=" << value << endl;
698 ::setenv(
"ZYPP_MEDIANETWORK", value.c_str(), 1 );
706 MIL << _parsedZyppConf <<
" not found, using defaults instead." << endl;
707 _parsedZyppConf = _parsedZyppConf.extend(
" (NOT FOUND)" );
711 if ( getenv(
"ZYPP_TESTSUITE_FAKE_ARCH" ) )
713 Arch carch( getenv(
"ZYPP_TESTSUITE_FAKE_ARCH" ) );
714 if ( carch != cfg_arch )
716 WAR <<
"ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch <<
"): " << carch << endl;
720 MIL <<
"ZConfig singleton created." << endl;
725 Impl &operator=(
const Impl &) =
delete;
739 return target ? target->root() : _announced_root_path;
746 Pathname newRoot { _autodetectSystemRoot() };
747 MIL <<
"notifyTargetChanged (" << newRoot <<
")" << endl;
749 if ( newRoot.emptyOrRoot() ) {
750 _currentTargetDefaults.reset();
755 Pathname newConf { newRoot/_autodetectZyppConfPath() };
756 if (
PathInfo(newConf).isExist() ) {
758 for (
const auto & [entry,value] : dict.
entries(
"main" ) ) {
759 (*_currentTargetDefaults).consume( entry, value );
763 MIL << _parsedZyppConf <<
" not found, using defaults." << endl;
773 long cfg_lockTimeout = 0;
851 using SpecMap = std::map<Pathname, MultiversionSpec>;
859 if ( root_r.
empty() )
861 bool cacheHit = _specMap.count( root_r );
871 if ( root_r ==
"/" || scanConfAt( root_r, ret, zConfImpl_r ) == 0 )
873 scanDirAt( root_r, ret, zConfImpl_r );
874 using zypp::operator<<;
875 MIL <<
"MultiversionSpec '" << root_r <<
"' = " << ret << endl;
886 static const str::regex rx(
"^multiversion *= *(.*)" );
889 [&](
int num_r, std::string line_r )->
bool 904 if ( multiversionDir.
empty() )
910 [&spec_r](
const Pathname & dir_r,
const char *
const & name_r )->
bool 912 MIL <<
"Parsing " << dir_r/name_r << endl;
914 [&spec_r](
int num_r, std::string line_r )->
bool 916 DBG <<
" found " << line_r << endl;
917 spec_r.insert( std::move(line_r) );
929 {
return _multiversionMap.getSpec( _autodetectSystemRoot(), *
this ); }
967 const char *
env = getenv(
"ZYPP_LOCK_TIMEOUT");
969 return str::strtonum<long>(
env );
971 return _pimpl->cfg_lockTimeout;
975 {
return _pimpl->notifyTargetChanged(); }
978 {
return _pimpl->_autodetectSystemRoot(); }
982 return (
_pimpl->cfg_repo_mgr_root_path.empty()
987 {
_pimpl->cfg_repo_mgr_root_path = root; }
990 {
_pimpl->_announced_root_path = root_r; }
1000 static Arch _val( _autodetectSystemArchitecture() );
1005 {
return _pimpl->cfg_arch; }
1009 if ( arch_r !=
_pimpl->cfg_arch )
1011 WAR <<
"Overriding system architecture (" <<
_pimpl->cfg_arch <<
"): " << arch_r << endl;
1012 _pimpl->cfg_arch = arch_r;
1024 static Locale _val( _autodetectTextLocale() );
1029 {
return _pimpl->cfg_textLocale; }
1033 if ( locale_r !=
_pimpl->cfg_textLocale )
1035 WAR <<
"Overriding text locale (" <<
_pimpl->cfg_textLocale <<
"): " << locale_r << endl;
1036 _pimpl->cfg_textLocale = locale_r;
1047 {
return !
_pimpl->userData.empty(); }
1050 {
return _pimpl->userData; }
1054 for_( ch, str_r.begin(), str_r.end() )
1056 if ( *ch <
' ' && *ch !=
'\t' )
1058 ERR <<
"New user data string rejectded: char " << (int)*ch <<
" at position " << (ch - str_r.begin()) << endl;
1062 MIL <<
"Set user data string to '" << str_r <<
"'" << endl;
1063 _pimpl->userData = str_r;
1071 return (
_pimpl->cfg_cache_path.get().empty()
1082 _pimpl->cfg_cache_path = path_r;
1087 return (
_pimpl->cfg_metadata_path.get().empty()
1093 _pimpl->cfg_metadata_path = path_r;
1098 return (
_pimpl->cfg_solvfiles_path.get().empty()
1104 _pimpl->cfg_solvfiles_path = path_r;
1109 return (
_pimpl->cfg_packages_path.get().empty()
1115 _pimpl->cfg_packages_path = path_r;
1119 {
return _pimpl->cfg_cache_path.getDefault().empty() ?
Pathname(
"/var/cache/zypp") :
_pimpl->cfg_cache_path.getDefault(); }
1134 return (
_pimpl->cfg_config_path.empty()
1140 return (
_pimpl->cfg_known_repos_path.empty()
1146 return (
_pimpl->cfg_known_services_path.empty()
1157 {
_pimpl->geoipEnabled = enable; }
1160 {
return _pimpl->geoipEnabled; }
1166 {
return _pimpl->geoipHosts; }
1170 return (
_pimpl->cfg_vars_path.empty()
1176 return (
_pimpl->cfg_vendor_path.empty()
1182 return (
_pimpl->locks_file.empty()
1189 {
return _pimpl->repo_add_probe; }
1192 {
return _pimpl->repo_refresh_delay; }
1198 {
return _pimpl->repoLabelIsAlias; }
1201 {
_pimpl->repoLabelIsAlias = yesno_r; }
1204 {
return _pimpl->download_use_deltarpm; }
1210 {
return _pimpl->download_media_prefer_download; }
1213 {
_pimpl->download_media_prefer_download.set( yesno_r ); }
1216 {
_pimpl->download_media_prefer_download.restoreToDefault(); }
1219 {
return _pimpl->_mediaConf.download_max_concurrent_connections(); }
1222 {
return _pimpl->_mediaConf.download_min_download_speed(); }
1225 {
return _pimpl->_mediaConf.download_max_download_speed(); }
1228 {
return _pimpl->_mediaConf.download_max_silent_tries(); }
1231 {
return _pimpl->_mediaConf.download_transfer_timeout(); }
1238 {
return _pimpl->commit_downloadMode; }
1270 {
return (
_pimpl->solver_checkSystemFile.empty()
1274 {
return (
_pimpl->solver_checkSystemFileDir.empty()
1280 inline void sigMultiversionSpecChanged()
1293 {
return _pimpl->apply_locks_file; }
1308 return Pathname(update_dataPath()/
"update-messages");
1316 return Pathname(update_dataPath()/
"update-scripts");
1320 {
return _pimpl->updateMessagesNotify; }
1323 {
_pimpl->updateMessagesNotify.set( val_r ); }
1326 {
_pimpl->updateMessagesNotify.restoreToDefault(); }
1331 {
return _pimpl->rpmInstallFlags; }
1336 return (
_pimpl->history_log_path.empty() ?
1342 return _pimpl->_mediaConf.credentialsGlobalDir();
1347 return _pimpl->_mediaConf.credentialsGlobalFile();
1353 {
return "system-release"; }
1358 {
return _pimpl->pluginsPath.get(); }
1362 return _pimpl->cfg_kernel_keep_spec;
1369 str <<
"libzypp: " LIBZYPP_VERSION_STRING <<
" (" << LIBZYPP_CODESTREAM <<
")" << endl;
1371 str <<
"libsolv: " << solv_version;
1372 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
1373 str <<
" (built against " << LIBSOLV_VERSION_STRING <<
")";
1376 str <<
"zypp.conf: '" <<
_pimpl->_parsedZyppConf <<
"'" << endl;
std::set< std::string > MultiversionSpec
void setDefault(value_type newval_r)
Set a new default value.
bool hasUserData() const
Whether a (non empty) user data sting is defined.
Option< bool > solver_dupAllowDowngrade
static Locale defaultTextLocale()
The autodetected preferred locale for translated texts.
Pathname repoSolvfilesPath() const
Path where the repo solv files are created and kept (repoCachePath()/solv).
Pathname credentialsGlobalDir() const
Defaults to /etc/zypp/credentials.d.
Pathname builtinRepoPackagesPath() const
The builtin config file value.
Pathname cfg_known_repos_path
void setGeoipEnabled(bool enable=true)
Enables or disables the use of the geoip feature of download.opensuse.org.
void setGpgCheck(bool val_r)
Change the value.
std::ostream & about(std::ostream &str) const
Print some detail about the current libzypp version.
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Namespace intended to collect all environment variables we use.
void setUpdateMessagesNotify(const std::string &val_r)
Set a new command definition (see update.messages.notify in zypp.conf).
void setRepoGpgCheck(TriBool val_r)
Change the value.
Pathname knownReposPath() const
Path where the known repositories .repo files are kept (configPath()/repos.d).
long download_transfer_timeout() const
Maximum time in seconds that you allow a transfer operation to take.
unsigned splitEscaped(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \, bool withEmpty=false)
Split line_r into words with respect to escape delimeters.
Pathname cfg_known_services_path
static ZConfig & instance()
Singleton ctor.
long download_max_download_speed() const
Maximum download speed (bytes per second)
static Pathname update_messagesPath()
Path where the update messages are stored ( /var/adm/update-messages )
MultiversionSpec & multiversion()
static const Locale enCode
Last resort "en".
Locale textLocale() const
The locale for translated texts zypp uses.
bool repoLabelIsAlias() const
Whether to use repository alias or name in user messages (progress, exceptions, ...).
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
bool download_use_deltarpm
void setRepoPackagesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Pathname varsPath() const
Path containing custom repo variable definitions (configPath()/vars.d).
ResolverFocus
The resolver's general attitude.
Pathname pubkeyCachePath() const
Path where the pubkey caches.
std::unordered_set< Locale > LocaleSet
LocaleSet repoRefreshLocales
Iterable< entry_const_iterator > entries(const std::string §ion) const
Pathname builtinRepoMetadataPath() const
The builtin config file value.
Option< bool > solver_onlyRequires
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
DefaultOption< Pathname > cfg_metadata_path
bool repo_add_probe() const
Whether repository urls should be probed.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
void restoreToDefault()
Reset value to the current default.
String related utilities and Regular expression matching.
void removeMultiversionSpec(const std::string &name_r)
bool geoipEnabled() const
Returns true if zypp should use the geoip feature of download.opensuse.org.
void setSystemArchitecture(const Arch &arch_r)
Override the zypp system architecture.
unsigned solver_upgradeTestcasesToKeep() const
When committing a dist upgrade (e.g.
Option< bool > solver_allowVendorChange
std::vector< std::string > geoipHosts
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d)
target::rpm::RpmInstFlags rpmInstallFlags
bool setUserData(const std::string &str_r)
Set a new userData string.
std::string cfg_kernel_keep_spec
Request the standard behavior (as defined in zypp.conf or 'Job')
void set_download_mediaMountdir(Pathname newval_r)
Set alternate value.
bool solver_dupAllowArchChange() const
DUP tune: Whether to allow package arch changes upon DUP.
MultiversionSpec & getDefaultSpec()
void resetSolverUpgradeRemoveDroppedPackages()
Reset solverUpgradeRemoveDroppedPackages to the zypp.conf default.
Pathname _parsedZyppConf
Remember any parsed zypp.conf.
std::string userData() const
User defined string value to be passed to log, history, plugins...
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Pointer to implementation.
const std::set< std::string > & multiversionSpec() const
void set_default_download_mediaMountdir()
Reset to zypp.cong default.
void addMultiversionSpec(const std::string &name_r)
void resetGpgCheck()
Reset to the zconfig default.
void set_download_media_prefer_download(bool yesno_r)
Set download_media_prefer_download to a specific value.
DefaultOption< Pathname > download_mediaMountdir
bool solverUpgradeRemoveDroppedPackages() const
Whether dist upgrade should remove a products dropped packages (true).
DownloadMode commit_downloadMode() const
Commit download policy to use as default.
DefaultOption< bool > download_media_prefer_download
LocaleSet repoRefreshLocales() const
List of locales for which translated package descriptions should be downloaded.
TriBool strToTriBool(const C_Str &str)
Parse str into a bool if it's a legal true or false string; else indeterminate.
Pathname download_mediaMountdir() const
Path where media are preferably mounted or downloaded.
Pathname repoManagerRoot() const
The RepoManager root directory.
MultiversionMap _multiversionMap
Container< Ret > transform(Container< Msg, CArgs... > &&val, Transformation &&transformation)
DefaultOption< bool > gpgCheck
bool empty() const
Test for an empty path.
void setTextLocale(const Locale &locale_r)
Set the preferred locale for translated texts.
int scanConfAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \, const Trim trim_r=NO_TRIM)
Split line_r into words.
static Pool instance()
Singleton ctor.
Pathname _announced_root_path
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck)
Pathname solver_checkSystemFileDir() const
Directory, which may or may not contain files in which dependencies described which has to be fulfill...
std::optional< TargetDefaults > _currentTargetDefaults
TargetDefaults while –root.
void set_default_download_media_prefer_download()
Set download_media_prefer_download to the configfiles default.
Pathname solver_checkSystemFile() const
File in which dependencies described which has to be fulfilled for a running system.
LocaleSet requestedLocales() const
Languages to be supported by the system.
Pathname locksFile() const
Path where zypp can find or create lock file (configPath()/locks)
Option & operator=(value_type newval_r)
unsigned repo_refresh_delay() const
Amount of time in minutes that must pass before another refresh.
libzypp will decide what to do.
bool gpgCheck() const
Turn signature checking on/off (on)
Pathname repoCachePath() const
Path where the caches are kept (/var/cache/zypp)
Option< bool > solver_cleandepsOnRemove
bool solver_dupAllowVendorChange() const
DUP tune: Whether to allow package vendor changes upon DUP.
Option(value_type initial_r)
No default ctor, explicit initialisation!
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Interim helper class to collect global options and settings.
Pathname _autodetectSystemRoot() const
bsc#1237044: Provide announceSystemRoot to allow commands using –root without launching a Target...
Pathname credentialsGlobalFile() const
Defaults to /etc/zypp/credentials.cat.
bool solver_dupAllowDowngrade() const
DUP tune: Whether to allow version downgrades upon DUP.
DefaultOption< bool > solverUpgradeRemoveDroppedPackages
static Pathname update_dataPath()
Path where the update items are kept (/var/adm)
Types and functions for filesystem operations.
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck)
bool apply_locks_file() const
Whether locks file should be read and applied after start (true)
void restoreToDefault(value_type newval_r)
Reset value to a new default.
bool solver_dupAllowNameChange() const
DUP tune: Whether to follow package renames upon DUP.
TInt strtonum(const C_Str &str)
Parsing numbers from string.
Pathname needrebootPath() const
Path where the custom needreboot config files are kept (configPath()/needreboot.d).
void clearMultiversionSpec()
Pathname repoPackagesPath() const
Path where the repo packages are downloaded and kept (repoCachePath()/packages).
static PoolImpl & myPool()
Pathname geoipCachePath() const
Path where the geoip caches are kept (/var/cache/zypp/geoip)
bool fromString(const std::string &val_r, ResolverFocus &ret_r)
long download_max_silent_tries() const
Maximum silent tries.
Mutable option with initial value also remembering a config value.
target::rpm::RpmInstFlags rpmInstallFlags() const
The default target::rpm::RpmInstFlags for ZYppCommitPolicy.
bool download_use_deltarpm_always
int compareCI(const C_Str &lhs, const C_Str &rhs)
long lockTimeout() const
The number of seconds to wait for the zypp lock to become available.
static Pathname update_scriptsPath()
Path where the update scripts are stored ( /var/adm/update-scripts )
bool solver_onlyRequires() const
Solver regards required packages,patterns,...
TargetDefaults _initialTargetDefaults
Initial TargetDefaults from /.
Pathname configPath() const
Path where the configfiles are kept (/etc/zypp).
'Language[_Country]' codes.
Option< Pathname > pluginsPath
DefaultOption< Pathname > cfg_cache_path
Parses a INI file and offers its structure as a dictionary.
DefaultOption< Pathname > cfg_packages_path
Option< bool > solver_dupAllowArchChange
Pathname builtinRepoSolvfilesPath() const
The builtin config file value.
static Arch defaultSystemArchitecture()
The autodetected system architecture.
Regular expression match result.
void resetRepoGpgCheck()
Reset to the zconfig default.
ResolverFocus solver_focus() const
The resolver's general attitude when resolving jobs.
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
DefaultOption< std::string > updateMessagesNotify
int simpleParseFile(std::istream &str_r, ParseFlags flags_r, function< bool(int, std::string)> consume_r)
Simple lineparser optionally trimming and skipping comments.
std::map< Pathname, MultiversionSpec > SpecMap
void announceSystemRoot(const Pathname &root_r)
Announce a target root directory without launching the Target.
Pathname cfg_repo_mgr_root_path
bool download_media_prefer_download() const
Hint which media to prefer when installing packages (download vs.
Pathname solver_checkSystemFile
bool consume(const std::string &entry, const std::string &value)
Pathname needrebootFile() const
Path of the default needreboot config file (configPath()/needreboot).
Pathname historyLogFile() const
Path where ZYpp install history is logged.
Pathname history_log_path
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
std::string distroverpkg() const
Package telling the "product version" on systems not using /etc/product.d/baseproduct.
MultiversionSpec & getMultiversion() const
const TargetDefaults & targetDefaults() const
std::string multiversionKernels() const
TargetDefaults & targetDefaults()
void setRepoMetadataPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Wrapper class for ::stat/::lstat.
Pathname knownServicesPath() const
Path where the known services .service files are kept (configPath()/services.d).
void resetUpdateMessagesNotify()
Reset to the zypp.conf default.
Arch systemArchitecture() const
The system architecture zypp uses.
void setSolverUpgradeRemoveDroppedPackages(bool val_r)
Set solverUpgradeRemoveDroppedPackages to val_r.
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
regex ZYPP_STR_REGEX regex ZYPP_STR_REGEX
DefaultOption(value_type initial_r)
std::string updateMessagesNotify() const
Command definition for sending update messages.
Pathname systemRoot() const
The target root directory.
Pathname builtinRepoCachePath() const
The builtin config file value.
EntrySet::const_iterator entry_const_iterator
Pathname solver_checkSystemFileDir
Pathname cfg_multiversion_path
Option< bool > solver_dupAllowVendorChange
void setPkgGpgCheck(TriBool val_r)
Change the value.
MapKVIteratorTraits< SectionSet >::Key_const_iterator section_const_iterator
const value_type & getDefault() const
Get the current default value.
DefaultOption< Pathname > cfg_solvfiles_path
void notifyTargetChanged()
bool solver_allowVendorChange() const
Whether vendor check is by default enabled.
Easy-to use interface to the ZYPP dependency resolver.
void setRepoSolvfilesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
DefaultOption & operator=(value_type newval_r)
ResolverFocus solver_focus
const std::vector< std::string > geoipHostnames() const
All hostnames we want to rewrite using the geoip feature.
void notifyTargetChanged()
internal
bool download_use_deltarpm() const
Whether to consider using a deltarpm when downloading a package.
void setRepoCachePath(const Pathname &path_r)
Set a new path as the default repo cache path.
const MultiversionSpec & multiversion() const
void setRepoManagerRoot(const Pathname &root)
Sets the RepoManager root directory.
MultiversionSpec & getSpec(Pathname root_r, const Impl &zConfImpl_r)
Pathname pluginsPath() const
Defaults to /usr/lib/zypp/plugins.
DefaultOption< TriBool > repoGpgCheck
void scanDirAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Option< DownloadMode > commit_downloadMode
DefaultOption< TriBool > pkgGpgCheck
unsigned repo_refresh_delay
void resetPkgGpgCheck()
Reset to the zconfig default.
void multiversionSpecChanged()
Pathname repoMetadataPath() const
Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
Settings that follow a changed Target.
long download_min_download_speed() const
Minimum download speed (bytes per second) until the connection is dropped.
long download_max_concurrent_connections() const
Maximum number of concurrent connections for a single transfer.
DownloadMode
Supported commit download policies.
Option< unsigned > solver_upgradeTestcasesToKeep
Option< bool > solver_dupAllowNameChange