15 #include <sys/utsname.h> 16 #if __GLIBC_PREREQ (2,16) 20 #include <solv/solvversion.h> 27 #include <zypp-core/base/InputStream> 34 #include <zypp-core/parser/IniDict> 39 #include <zypp-media/MediaConfig> 45 #undef ZYPP_BASE_LOGGER_LOGGROUP 46 #define ZYPP_BASE_LOGGER_LOGGROUP "zconfig" 66 # if defined(__linux__) && defined(__x86_64__) 67 static inline void cpuid(uint32_t op, uint32_t op2, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
71 :
"=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
72 :
"a" (op),
"c" (op2));
78 #define bit_SSE3 (1 << 0) 79 #define bit_SSSE3 (1 << 9) 80 #define bit_FMA (1 << 12) 81 #define bit_CMPXCHG16B (1 << 13) 82 #define bit_SSE4_1 (1 << 19) 83 #define bit_SSE4_2 (1 << 20) 84 #define bit_MOVBE (1 << 22) 85 #define bit_POPCNT (1 << 23) 86 #define bit_OSXSAVE (1 << 27) 87 #define bit_AVX (1 << 28) 88 #define bit_F16C (1 << 29) 92 #define bit_LAHF_LM (1 << 0) 93 #define bit_LZCNT (1 << 5) 97 #define bit_BMI (1 << 3) 98 #define bit_AVX2 (1 << 5) 99 #define bit_BMI2 (1 << 8) 100 #define bit_AVX512F (1 << 16) 101 #define bit_AVX512DQ (1 << 17) 102 #define bit_AVX512CD (1 << 28) 103 #define bit_AVX512BW (1 << 30) 104 #define bit_AVX512VL (1u << 31) 106 static int get_x86_64_level(
void)
110 unsigned int op_1_ecx = 0, op_80000001_ecx = 0, op_7_ebx = 0, unused = 0;
111 cpuid(1, 0, &unused, &unused, &op_1_ecx, &unused);
112 cpuid(0x80000001, 0, &unused, &unused, &op_80000001_ecx, &unused);
113 cpuid(7, 0, &unused, &op_7_ebx, &unused, &unused);
115 const unsigned int op_1_ecx_lv2 = bit_SSE3 | bit_SSSE3 | bit_CMPXCHG16B | bit_SSE4_1 | bit_SSE4_2 | bit_POPCNT;
116 if ((op_1_ecx & op_1_ecx_lv2) == op_1_ecx_lv2 && (op_80000001_ecx & bit_LAHF_LM))
119 const unsigned int op_1_ecx_lv3 = bit_FMA | bit_MOVBE | bit_OSXSAVE | bit_AVX | bit_F16C;
120 const unsigned int op_7_ebx_lv3 = bit_BMI | bit_AVX2 | bit_BMI2;
121 if (level == 2 && (op_1_ecx & op_1_ecx_lv3) == op_1_ecx_lv3 && (op_7_ebx & op_7_ebx_lv3) == op_7_ebx_lv3
122 && (op_80000001_ecx & bit_LZCNT))
125 const unsigned int op_7_ebx_lv4 = bit_AVX512F | bit_AVX512DQ | bit_AVX512CD | bit_AVX512BW | bit_AVX512VL;
126 if (level == 3 && (op_7_ebx & op_7_ebx_lv4) == op_7_ebx_lv4)
136 Arch _autodetectSystemArchitecture()
138 struct ::utsname buf;
139 if ( ::uname( &buf ) < 0 )
141 ERR <<
"Can't determine system architecture" << endl;
145 Arch architecture( buf.machine );
146 MIL <<
"Uname architecture is '" << buf.machine <<
"'" << endl;
148 if ( architecture == Arch_x86_64 )
150 #if defined(__linux__) && defined(__x86_64__) 151 switch ( get_x86_64_level() )
154 architecture = Arch_x86_64_v2;
155 WAR <<
"CPU has 'x86_64': architecture upgraded to '" << architecture <<
"'" << endl;
158 architecture = Arch_x86_64_v3;
159 WAR <<
"CPU has 'x86_64': architecture upgraded to '" << architecture <<
"'" << endl;
162 architecture = Arch_x86_64_v4;
163 WAR <<
"CPU has 'x86_64': architecture upgraded to '" << architecture <<
"'" << endl;
168 else if ( architecture == Arch_i686 )
173 std::ifstream cpuinfo(
"/proc/cpuinfo" );
176 for( iostr::EachLine in( cpuinfo ); in; in.next() )
180 if ( in->find(
"cx8" ) == std::string::npos
181 || in->find(
"cmov" ) == std::string::npos )
183 architecture = Arch_i586;
184 WAR <<
"CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture <<
"'" << endl;
192 ERR <<
"Cant open " <<
PathInfo(
"/proc/cpuinfo") << endl;
195 else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
198 std::ifstream cpuinfo(
"/proc/cpuinfo" );
201 for( iostr::EachLine in( cpuinfo ); in; in.next() )
205 if ( in->find(
"sun4v" ) != std::string::npos )
207 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
208 WAR <<
"CPU has 'sun4v': architecture upgraded to '" << architecture <<
"'" << endl;
210 else if ( in->find(
"sun4u" ) != std::string::npos )
212 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
213 WAR <<
"CPU has 'sun4u': architecture upgraded to '" << architecture <<
"'" << endl;
215 else if ( in->find(
"sun4m" ) != std::string::npos )
217 architecture = Arch_sparcv8;
218 WAR <<
"CPU has 'sun4m': architecture upgraded to '" << architecture <<
"'" << endl;
226 ERR <<
"Cant open " <<
PathInfo(
"/proc/cpuinfo") << endl;
229 else if ( architecture == Arch_armv8l || architecture == Arch_armv7l || architecture == Arch_armv6l )
231 std::ifstream platform(
"/etc/rpm/platform" );
234 for( iostr::EachLine in( platform ); in; in.next() )
238 architecture = Arch_armv8hl;
239 WAR <<
"/etc/rpm/platform contains armv8hl-: architecture upgraded to '" << architecture <<
"'" << endl;
244 architecture = Arch_armv7hl;
245 WAR <<
"/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture <<
"'" << endl;
250 architecture = Arch_armv6hl;
251 WAR <<
"/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture <<
"'" << endl;
257 #if __GLIBC_PREREQ (2,16) 258 else if ( architecture == Arch_ppc64 )
260 const char * platform = (
const char *)getauxval( AT_PLATFORM );
262 if ( platform && sscanf( platform,
"power%d", &powerlvl ) == 1 && powerlvl > 6 )
263 architecture = Arch_ppc64p7;
286 Locale _autodetectTextLocale()
289 const char * envlist[] = {
"LC_ALL",
"LC_MESSAGES",
"LANG", NULL };
290 for (
const char ** envvar = envlist; *envvar; ++envvar )
292 const char * envlang = getenv( *envvar );
295 std::string envstr( envlang );
296 if ( envstr !=
"POSIX" && envstr !=
"C" )
298 Locale lang( envstr );
301 MIL <<
"Found " << *envvar <<
"=" << envstr << endl;
308 MIL <<
"Default text locale is '" << ret <<
"'" << endl;
309 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS 310 setenv(
"BOOST_TEST_CATCH_SYSTEM_ERRORS",
"no", 1 );
315 inline Pathname _autodetectSystemRoot()
318 return target ? target->root() :
Pathname();
321 inline Pathname _autodetectZyppConfPath()
323 const char *env_confpath = getenv(
"ZYPP_CONF" );
324 return env_confpath ? env_confpath :
"/etc/zypp/zypp.conf";
339 : _val(
std::move(initial_r) )
343 {
set( std::move(newval_r) );
return *
this; }
355 { _val = std::move(newval_r); }
370 , _default(
std::move(initial_r) )
374 { this->
set( std::move(newval_r) );
return *
this; }
378 { this->
set( _default.get() ); }
382 { setDefault( std::move(newval_r) ); restoreToDefault(); }
386 {
return _default.get(); }
390 { _default.set( std::move(newval_r) ); }
414 , solver_onlyRequires ( false )
415 , solver_allowVendorChange ( false )
416 , solver_dupAllowDowngrade ( true )
417 , solver_dupAllowNameChange ( true )
418 , solver_dupAllowArchChange ( true )
419 , solver_dupAllowVendorChange ( true )
420 , solver_cleandepsOnRemove ( false )
421 , solver_upgradeTestcasesToKeep ( 2 )
422 , solverUpgradeRemoveDroppedPackages ( true )
425 bool consume(
const std::string & entry,
const std::string & value )
427 if ( entry ==
"solver.focus" )
431 else if ( entry ==
"solver.onlyRequires" )
433 solver_onlyRequires.set(
str::strToBool( value, solver_onlyRequires ) );
435 else if ( entry ==
"solver.allowVendorChange" )
437 solver_allowVendorChange.set(
str::strToBool( value, solver_allowVendorChange ) );
439 else if ( entry ==
"solver.dupAllowDowngrade" )
441 solver_dupAllowDowngrade.set(
str::strToBool( value, solver_dupAllowDowngrade ) );
443 else if ( entry ==
"solver.dupAllowNameChange" )
445 solver_dupAllowNameChange.set(
str::strToBool( value, solver_dupAllowNameChange ) );
447 else if ( entry ==
"solver.dupAllowArchChange" )
449 solver_dupAllowArchChange.set(
str::strToBool( value, solver_dupAllowArchChange ) );
451 else if ( entry ==
"solver.dupAllowVendorChange" )
453 solver_dupAllowVendorChange.set(
str::strToBool( value, solver_dupAllowVendorChange ) );
455 else if ( entry ==
"solver.cleandepsOnRemove" )
457 solver_cleandepsOnRemove.set(
str::strToBool( value, solver_cleandepsOnRemove ) );
459 else if ( entry ==
"solver.upgradeTestcasesToKeep" )
461 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
463 else if ( entry ==
"solver.upgradeRemoveDroppedPackages" )
465 solverUpgradeRemoveDroppedPackages.restoreToDefault(
str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
487 : _parsedZyppConf ( _autodetectZyppConfPath() )
488 , cfg_arch ( defaultSystemArchitecture() )
489 , cfg_textLocale ( defaultTextLocale() )
490 , cfg_cache_path {
"/var/cache/zypp" }
491 , cfg_metadata_path {
"" }
492 , cfg_solvfiles_path {
"" }
493 , cfg_packages_path {
"" }
494 , updateMessagesNotify (
"" )
495 , repo_add_probe (
false )
496 , repo_refresh_delay ( 10 )
497 , repoLabelIsAlias (
false )
498 , download_use_deltarpm (
true )
499 , download_use_deltarpm_always (
false )
500 , download_media_prefer_download(
true )
501 , download_mediaMountdir (
"/var/adm/mount" )
504 , repoGpgCheck ( indeterminate )
505 , pkgGpgCheck ( indeterminate )
506 , apply_locks_file (
true )
507 , pluginsPath (
"/usr/lib/zypp/plugins" )
508 , geoipEnabled (
true )
509 , geoipHosts {
"download.opensuse.org" }
511 MIL <<
"libzypp: " LIBZYPP_VERSION_STRING << endl;
512 if (
PathInfo(_parsedZyppConf).isExist() )
514 parser::IniDict dict( _parsedZyppConf );
516 sit != dict.sectionsEnd();
519 const std::string& section(*sit);
522 it != dict.entriesEnd(*sit);
525 std::string entry(it->first);
526 std::string value(it->second);
528 if ( _mediaConf.setConfigValue( section, entry, value ) )
532 if ( section ==
"main" )
534 if ( _initialTargetDefaults.consume( entry, value ) )
537 if ( entry ==
"arch" )
540 if ( carch != cfg_arch )
542 WAR <<
"Overriding system architecture (" << cfg_arch <<
"): " << carch << endl;
546 else if ( entry ==
"cachedir" )
548 cfg_cache_path.restoreToDefault( value );
550 else if ( entry ==
"metadatadir" )
552 cfg_metadata_path.restoreToDefault( value );
554 else if ( entry ==
"solvfilesdir" )
556 cfg_solvfiles_path.restoreToDefault( value );
558 else if ( entry ==
"packagesdir" )
560 cfg_packages_path.restoreToDefault( value );
562 else if ( entry ==
"configdir" )
566 else if ( entry ==
"reposdir" )
568 cfg_known_repos_path =
Pathname(value);
570 else if ( entry ==
"servicesdir" )
572 cfg_known_services_path =
Pathname(value);
574 else if ( entry ==
"varsdir" )
578 else if ( entry ==
"repo.add.probe" )
582 else if ( entry ==
"repo.refresh.delay" )
586 else if ( entry ==
"repo.refresh.locales" )
588 std::vector<std::string> tmp;
589 str::split( value, back_inserter( tmp ),
", \t" );
591 boost::function<Locale(const std::string &)> transform(
592 [](
const std::string & str_r)->Locale{
return Locale(str_r); }
594 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
595 make_transform_iterator( tmp.end(), transform ) );
597 else if ( entry ==
"download.use_deltarpm" )
599 download_use_deltarpm =
str::strToBool( value, download_use_deltarpm );
601 else if ( entry ==
"download.use_deltarpm.always" )
603 download_use_deltarpm_always =
str::strToBool( value, download_use_deltarpm_always );
605 else if ( entry ==
"download.media_preference" )
607 download_media_prefer_download.restoreToDefault(
str::compareCI( value,
"volatile" ) != 0 );
609 else if ( entry ==
"download.media_mountdir" )
611 download_mediaMountdir.restoreToDefault(
Pathname(value) );
613 else if ( entry ==
"download.use_geoip_mirror") {
616 else if ( entry ==
"commit.downloadMode" )
618 commit_downloadMode.set( deserializeDownloadMode( value ) );
620 else if ( entry ==
"gpgcheck" )
624 else if ( entry ==
"repo_gpgcheck" )
628 else if ( entry ==
"pkg_gpgcheck" )
632 else if ( entry ==
"vendordir" )
636 else if ( entry ==
"multiversiondir" )
638 cfg_multiversion_path =
Pathname(value);
640 else if ( entry ==
"multiversion.kernels" )
642 cfg_kernel_keep_spec = value;
644 else if ( entry ==
"solver.checkSystemFile" )
646 solver_checkSystemFile =
Pathname(value);
648 else if ( entry ==
"solver.checkSystemFileDir" )
650 solver_checkSystemFileDir =
Pathname(value);
652 else if ( entry ==
"multiversion" )
654 MultiversionSpec & defSpec( _multiversionMap.getDefaultSpec() );
657 else if ( entry ==
"locksfile.path" )
661 else if ( entry ==
"locksfile.apply" )
665 else if ( entry ==
"update.datadir" )
669 else if ( entry ==
"update.scriptsdir" )
671 update_scripts_path =
Pathname(value);
673 else if ( entry ==
"update.messagessdir" )
675 update_messages_path =
Pathname(value);
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;
731 Pathname newRoot { _autodetectSystemRoot() };
732 MIL <<
"notifyTargetChanged (" << newRoot <<
")" << endl;
734 if ( newRoot.emptyOrRoot() ) {
735 _currentTargetDefaults.reset();
740 Pathname newConf { newRoot/_autodetectZyppConfPath() };
741 if (
PathInfo(newConf).isExist() ) {
743 for (
const auto & [entry,value] : dict.
entries(
"main" ) ) {
744 (*_currentTargetDefaults).consume( entry, value );
748 MIL << _parsedZyppConf <<
" not found, using defaults." << endl;
836 using SpecMap = std::map<Pathname, MultiversionSpec>;
844 if ( root_r.
empty() )
846 bool cacheHit = _specMap.count( root_r );
856 if ( root_r ==
"/" || scanConfAt( root_r, ret, zConfImpl_r ) == 0 )
858 scanDirAt( root_r, ret, zConfImpl_r );
859 using zypp::operator<<;
860 MIL <<
"MultiversionSpec '" << root_r <<
"' = " << ret << endl;
871 static const str::regex rx(
"^multiversion *= *(.*)" );
874 [&](
int num_r, std::string line_r )->
bool 889 if ( multiversionDir.
empty() )
895 [&spec_r](
const Pathname & dir_r,
const char *
const & name_r )->
bool 897 MIL <<
"Parsing " << dir_r/name_r << endl;
899 [&spec_r](
int num_r, std::string line_r )->
bool 901 DBG <<
" found " << line_r << endl;
902 spec_r.insert( std::move(line_r) );
914 {
return _multiversionMap.getSpec( _autodetectSystemRoot(), *
this ); }
951 {
return _pimpl->notifyTargetChanged(); }
954 {
return _autodetectSystemRoot(); }
958 return (
_pimpl->cfg_repo_mgr_root_path.empty()
963 {
_pimpl->cfg_repo_mgr_root_path = root; }
973 static Arch _val( _autodetectSystemArchitecture() );
978 {
return _pimpl->cfg_arch; }
982 if ( arch_r !=
_pimpl->cfg_arch )
984 WAR <<
"Overriding system architecture (" <<
_pimpl->cfg_arch <<
"): " << arch_r << endl;
985 _pimpl->cfg_arch = arch_r;
997 static Locale _val( _autodetectTextLocale() );
1002 {
return _pimpl->cfg_textLocale; }
1006 if ( locale_r !=
_pimpl->cfg_textLocale )
1008 WAR <<
"Overriding text locale (" <<
_pimpl->cfg_textLocale <<
"): " << locale_r << endl;
1009 _pimpl->cfg_textLocale = locale_r;
1020 {
return !
_pimpl->userData.empty(); }
1023 {
return _pimpl->userData; }
1027 for_( ch, str_r.begin(), str_r.end() )
1029 if ( *ch <
' ' && *ch !=
'\t' )
1031 ERR <<
"New user data string rejectded: char " << (int)*ch <<
" at position " << (ch - str_r.begin()) << endl;
1035 MIL <<
"Set user data string to '" << str_r <<
"'" << endl;
1036 _pimpl->userData = str_r;
1044 return (
_pimpl->cfg_cache_path.get().empty()
1055 _pimpl->cfg_cache_path = path_r;
1060 return (
_pimpl->cfg_metadata_path.get().empty()
1066 _pimpl->cfg_metadata_path = path_r;
1071 return (
_pimpl->cfg_solvfiles_path.get().empty()
1077 _pimpl->cfg_solvfiles_path = path_r;
1082 return (
_pimpl->cfg_packages_path.get().empty()
1088 _pimpl->cfg_packages_path = path_r;
1092 {
return _pimpl->cfg_cache_path.getDefault().empty() ?
Pathname(
"/var/cache/zypp") :
_pimpl->cfg_cache_path.getDefault(); }
1107 return (
_pimpl->cfg_config_path.empty()
1113 return (
_pimpl->cfg_known_repos_path.empty()
1119 return (
_pimpl->cfg_known_services_path.empty()
1130 {
_pimpl->geoipEnabled = enable; }
1133 {
return _pimpl->geoipEnabled; }
1139 {
return _pimpl->geoipHosts; }
1143 return (
_pimpl->cfg_vars_path.empty()
1149 return (
_pimpl->cfg_vendor_path.empty()
1155 return (
_pimpl->locks_file.empty()
1162 {
return _pimpl->repo_add_probe; }
1165 {
return _pimpl->repo_refresh_delay; }
1171 {
return _pimpl->repoLabelIsAlias; }
1174 {
_pimpl->repoLabelIsAlias = yesno_r; }
1177 {
return _pimpl->download_use_deltarpm; }
1183 {
return _pimpl->download_media_prefer_download; }
1186 {
_pimpl->download_media_prefer_download.set( yesno_r ); }
1189 {
_pimpl->download_media_prefer_download.restoreToDefault(); }
1192 {
return _pimpl->_mediaConf.download_max_concurrent_connections(); }
1195 {
return _pimpl->_mediaConf.download_min_download_speed(); }
1198 {
return _pimpl->_mediaConf.download_max_download_speed(); }
1201 {
return _pimpl->_mediaConf.download_max_silent_tries(); }
1204 {
return _pimpl->_mediaConf.download_transfer_timeout(); }
1211 {
return _pimpl->commit_downloadMode; }
1243 {
return (
_pimpl->solver_checkSystemFile.empty()
1247 {
return (
_pimpl->solver_checkSystemFileDir.empty()
1253 inline void sigMultiversionSpecChanged()
1266 {
return _pimpl->apply_locks_file; }
1270 return (
_pimpl->update_data_path.empty()
1276 return (
_pimpl->update_messages_path.empty()
1282 return (
_pimpl->update_scripts_path.empty()
1287 {
return _pimpl->updateMessagesNotify; }
1290 {
_pimpl->updateMessagesNotify.set( val_r ); }
1293 {
_pimpl->updateMessagesNotify.restoreToDefault(); }
1298 {
return _pimpl->rpmInstallFlags; }
1303 return (
_pimpl->history_log_path.empty() ?
1309 return _pimpl->_mediaConf.credentialsGlobalDir();
1314 return _pimpl->_mediaConf.credentialsGlobalFile();
1320 {
return "system-release"; }
1325 {
return _pimpl->pluginsPath.get(); }
1329 return _pimpl->cfg_kernel_keep_spec;
1336 str <<
"libzypp: " LIBZYPP_VERSION_STRING << endl;
1338 str <<
"libsolv: " << solv_version;
1339 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
1340 str <<
" (built against " << LIBSOLV_VERSION_STRING <<
")";
1343 str <<
"zypp.conf: '" <<
_pimpl->_parsedZyppConf <<
"'" << endl;
std::set< std::string > MultiversionSpec
TriBool strToTriBool(const C_Str &str)
Parse str into a bool if it's a legal true or false string; else indeterminate.
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 update_scripts_path
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).
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)
Pathname update_messages_path
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.
Pathname update_scriptsPath() const
Path where the repo metadata is downloaded and kept (update_dataPath()/).
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.
Pathname download_mediaMountdir() const
Path where media are preferably mounted or downloaded.
Pathname repoManagerRoot() const
The RepoManager root directory.
MultiversionMap _multiversionMap
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)
int simpleParseFile(std::istream &str_r, ParseFlags flags_r, function< bool(int, std::string)> consume_r)
Simple lineparser optionally trimming and skipping comments.
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 update_data_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 credentialsGlobalFile() const
Defaults to /etc/zypp/credentials.cat.
bool solver_dupAllowDowngrade() const
DUP tune: Whether to allow version downgrades upon DUP.
DefaultOption< bool > solverUpgradeRemoveDroppedPackages
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).
Pathname update_dataPath() const
Path where the update items are kept (/var/adm)
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.
Pathname update_messagesPath() const
Path where the repo solv files are created and kept (update_dataPath()/solv).
bool download_use_deltarpm_always
int compareCI(const C_Str &lhs, const C_Str &rhs)
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
std::map< Pathname, MultiversionSpec > SpecMap
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