libzypp  17.38.17
ZConfig.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <cstdlib>
13 #include <iostream>
14 #include <optional>
15 #include <map>
16 #include <zypp-core/APIConfig.h>
19 #include <zypp-core/base/InputStream>
20 #include <zypp-core/base/Errno.h>
21 #include <zypp-core/base/String.h>
22 #include <zypp-core/base/Regex.h>
23 
24 #include <zypp/ZConfig.h>
25 #include <zypp/ZYppFactory.h>
26 #include <zypp/PathInfo.h>
27 #include <zypp-core/parser/EconfDict>
28 
29 #include <zypp/sat/Pool.h>
31 
32 #include <zypp-media/MediaConfig>
33 
34 using std::endl;
35 using namespace zypp::filesystem;
36 using namespace zypp::parser;
37 
38 #undef ZYPP_BASE_LOGGER_LOGGROUP
39 #define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
40 
42 namespace zypp
43 {
44 
45  namespace env {
46  inline std::optional<Pathname> ZYPP_CONF()
47  {
48  const char *env_confpath = getenv( "ZYPP_CONF" );
49  if ( env_confpath )
50  return env_confpath;
51  return std::nullopt;
52  }
53  } // namespace env
54 
55 
56 
66  namespace
68  {
69 
87  Locale _autodetectTextLocale()
88  {
89  Locale ret( Locale::enCode );
90  const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
91  for ( const char ** envvar = envlist; *envvar; ++envvar )
92  {
93  const char * envlang = getenv( *envvar );
94  if ( envlang )
95  {
96  std::string envstr( envlang );
97  if ( envstr != "POSIX" && envstr != "C" )
98  {
99  Locale lang( envstr );
100  if ( lang )
101  {
102  MIL << "Found " << *envvar << "=" << envstr << endl;
103  ret = lang;
104  break;
105  }
106  }
107  }
108  }
109  MIL << "Default text locale is '" << ret << "'" << endl;
110 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
111  setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
112  return ret;
113  }
114 
125  struct ZyppConfIniMap : public IniDict {
126  ZyppConfIniMap( Pathname root_r = "/" )
127  : IniDict { iniMapReadFrom(root_r) }
128  {
129  pMIL( str::sconcat("zypp.conf(", root_r, "):"), *this );
130  pDBG( dump(*this) );
131  }
132 
133  private:
135  IniDict iniMapReadFrom( const Pathname & root_r )
136  {
137  pMIL( "Reading zypp.conf for root", root_r );
138  std::optional<Pathname> ZYPP_CONF { env::ZYPP_CONF() };
139  if ( ZYPP_CONF ) {
140  // Read the plain file requested by $ZYPP_CONF
141  pMIL( "$ZYPP_CONF is set to", str::sconcat("'",*ZYPP_CONF,"'") );
142  PathInfo conf { root_r / *ZYPP_CONF };
143  if ( conf.isFile() ) {
144  pMIL( "$ZYPP_CONF requests reading file", conf );
145  return parser::IniDict( conf.path() );
146  } else {
147  pMIL( "$ZYPP_CONF denotes no file below root. Using builtin defaults." );
148  return parser::IniDict();
149  }
150  } else {
151  // Econf mode reading the systems settings
152  return parser::EconfDict( "/zypp/zypp.conf", root_r );
153  }
154  }
155  };
156 
158  } // namespace zypp
160 
162  template<class Tp>
163  struct Option
164  {
165  using value_type = Tp;
166 
168  Option( value_type initial_r )
169  : _val( std::move(initial_r) )
170  {}
171 
173  { set( std::move(newval_r) ); return *this; }
174 
176  const value_type & get() const
177  { return _val; }
178 
180  operator const value_type &() const
181  { return _val; }
182 
184  void set( value_type newval_r )
185  { _val = std::move(newval_r); }
186 
187  private:
189  };
190 
192  template<class Tp>
193  struct DefaultOption : public Option<Tp>
194  {
195  using value_type = Tp;
197 
198  explicit DefaultOption( value_type initial_r )
199  : Option<Tp>( initial_r )
200  , _default( std::move(initial_r) )
201  {}
202 
204  { this->set( std::move(newval_r) ); return *this; }
205 
208  { this->set( _default.get() ); }
209 
211  void restoreToDefault( value_type newval_r )
212  { setDefault( std::move(newval_r) ); restoreToDefault(); }
213 
215  const value_type & getDefault() const
216  { return _default.get(); }
217 
219  void setDefault( value_type newval_r )
220  { _default.set( std::move(newval_r) ); }
221 
222  private:
224  };
225 
227  //
228  // CLASS NAME : ZConfig::Impl
229  //
236  {
237  using MultiversionSpec = std::set<std::string>;
238 
241  {
243  : solver_focus ( ResolverFocus::Default )
244  , solver_onlyRequires ( false )
245  , solver_allowVendorChange ( false )
246  , solver_dupAllowDowngrade ( true )
247  , solver_dupAllowNameChange ( true )
248  , solver_dupAllowArchChange ( true )
249  , solver_dupAllowVendorChange ( false )
250  , solver_cleandepsOnRemove ( false )
251  , solver_noUpdateProvide ( false )
252  , solver_upgradeTestcasesToKeep ( 2 )
253  , solverUpgradeRemoveDroppedPackages ( true )
254  {}
255 
256  bool consume( const std::string & section, const std::string & entry, const std::string & value )
257  {
258  if ( section != "main" )
259  return false;
260 
261  if ( entry == "solver.focus" )
262  {
263  fromString( value, solver_focus );
264  }
265  else if ( entry == "solver.onlyRequires" )
266  {
267  solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
268  }
269  else if ( entry == "solver.allowVendorChange" )
270  {
271  solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
272  }
273  else if ( entry == "solver.dupAllowDowngrade" )
274  {
275  solver_dupAllowDowngrade.set( str::strToBool( value, solver_dupAllowDowngrade ) );
276  }
277  else if ( entry == "solver.dupAllowNameChange" )
278  {
279  solver_dupAllowNameChange.set( str::strToBool( value, solver_dupAllowNameChange ) );
280  }
281  else if ( entry == "solver.dupAllowArchChange" )
282  {
283  solver_dupAllowArchChange.set( str::strToBool( value, solver_dupAllowArchChange ) );
284  }
285  else if ( entry == "solver.dupAllowVendorChange" )
286  {
287  solver_dupAllowVendorChange.set( str::strToBool( value, solver_dupAllowVendorChange ) );
288  }
289  else if ( entry == "solver.cleandepsOnRemove" )
290  {
291  solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
292  }
293  else if ( entry == "solver.noUpdateProvide" )
294  {
295  solver_noUpdateProvide.set( str::strToBool( value, solver_noUpdateProvide ) );
296  }
297  else if ( entry == "solver.upgradeTestcasesToKeep" )
298  {
299  solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
300  }
301  else if ( entry == "solver.upgradeRemoveDroppedPackages" )
302  {
303  solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
304  }
305  else
306  return false;
307 
308  return true;
309  }
310 
322  };
323 
324  public:
326  : cfg_arch ( defaultSystemArchitecture() )
327  , cfg_textLocale ( defaultTextLocale() )
328  , cfg_cache_path { "/var/cache/zypp" }
329  , cfg_metadata_path { "" } // empty - follows cfg_cache_path
330  , cfg_solvfiles_path { "" } // empty - follows cfg_cache_path
331  , cfg_packages_path { "" } // empty - follows cfg_cache_path
332  , updateMessagesNotify ( "" )
333  , repo_add_probe ( false )
334  , repo_refresh_delay ( 10 )
335  , repoLabelIsAlias ( false )
336  , download_use_deltarpm ( APIConfig(LIBZYPP_CONFIG_USE_DELTARPM_BY_DEFAULT) )
337  , download_use_deltarpm_always ( false )
338  , download_media_prefer_download( true )
339  , download_mediaMountdir ( "/var/adm/mount" )
340  , commit_downloadMode ( DownloadDefault )
341  , gpgCheck ( true )
342  , repoGpgCheck ( indeterminate )
343  , pkgGpgCheck ( indeterminate )
344  , apply_locks_file ( true )
345  , pluginsPath ( "/usr/lib/zypp/plugins" )
346  , geoipEnabled ( true )
347  , geoipHosts { "download.opensuse.org" }
348  {
349  MIL << "libzypp: " LIBZYPP_VERSION_STRING << " (" << LIBZYPP_CODESTREAM << ")" << endl;
350 
351  ZyppConfIniMap iniMap; // Scan the default zypp.conf settings
352 
353  using EnvMap = std::map<std::string,std::string>;
354  std::optional<EnvMap> envMap;
355  for ( const auto & section : iniMap.sections() ) {
356  for ( const auto & [entry,value] : iniMap.entries( section ) ) {
357 
358  if ( _initialTargetDefaults.consume( section, entry, value ) )
359  continue;
360 
361  if ( _mediaConf.setConfigValue( section, entry, value ) )
362  continue;
363 
364  if ( section == "main" )
365  {
366  if ( entry == "lock_timeout" )
367  {
368  str::strtonum( value, cfg_lockTimeout );
369  }
370  else if ( entry == "arch" )
371  {
372  Arch carch( value );
373  if ( carch != cfg_arch ) {
374  WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
375  cfg_arch = carch;
376  }
377  }
378  else if ( entry == "cachedir" )
379  {
380  cfg_cache_path.restoreToDefault( value );
381  }
382  else if ( entry == "metadatadir" )
383  {
384  cfg_metadata_path.restoreToDefault( value );
385  }
386  else if ( entry == "solvfilesdir" )
387  {
388  cfg_solvfiles_path.restoreToDefault( value );
389  }
390  else if ( entry == "packagesdir" )
391  {
392  cfg_packages_path.restoreToDefault( value );
393  }
394  else if ( entry == "configdir" )
395  {
396  cfg_config_path = Pathname(value);
397  }
398  else if ( entry == "reposdir" )
399  {
400  cfg_known_repos_path = Pathname(value);
401  }
402  else if ( entry == "servicesdir" )
403  {
404  cfg_known_services_path = Pathname(value);
405  }
406  else if ( entry == "varsdir" )
407  {
408  cfg_vars_path = Pathname(value);
409  }
410  else if ( entry == "repo.add.probe" )
411  {
412  repo_add_probe = str::strToBool( value, repo_add_probe );
413  }
414  else if ( entry == "repo.refresh.delay" )
415  {
416  str::strtonum(value, repo_refresh_delay);
417  }
418  else if ( entry == "repo.refresh.locales" )
419  {
420  std::vector<std::string> tmp;
421  str::split( value, back_inserter( tmp ), ", \t" );
422 
423  boost::function<Locale(const std::string &)> transform(
424  [](const std::string & str_r)->Locale{ return Locale(str_r); }
425  );
426  repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
427  make_transform_iterator( tmp.end(), transform ) );
428  }
429  else if ( entry == "download.use_deltarpm" )
430  {
431  download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
432  }
433  else if ( entry == "download.use_deltarpm.always" )
434  {
435  download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
436  }
437  else if ( entry == "download.media_preference" )
438  {
439  download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
440  }
441  else if ( entry == "download.media_mountdir" )
442  {
443  download_mediaMountdir.restoreToDefault( Pathname(value) );
444  }
445  else if ( entry == "download.use_geoip_mirror") {
446  geoipEnabled = str::strToBool( value, geoipEnabled );
447  }
448  else if ( entry == "commit.downloadMode" )
449  {
450  commit_downloadMode.set( deserializeDownloadMode( value ) );
451  }
452  else if ( entry == "gpgcheck" )
453  {
454  gpgCheck.restoreToDefault( str::strToBool( value, gpgCheck ) );
455  }
456  else if ( entry == "repo_gpgcheck" )
457  {
458  repoGpgCheck.restoreToDefault( str::strToTriBool( value ) );
459  }
460  else if ( entry == "pkg_gpgcheck" )
461  {
462  pkgGpgCheck.restoreToDefault( str::strToTriBool( value ) );
463  }
464  else if ( entry == "vendordir" )
465  {
466  cfg_vendor_path = Pathname(value);
467  }
468  else if ( entry == "multiversiondir" )
469  {
470  cfg_multiversion_path = Pathname(value);
471  }
472  else if ( entry == "multiversion.kernels" )
473  {
474  cfg_kernel_keep_spec = value;
475  }
476  else if ( entry == "solver.checkSystemFile" )
477  {
478  solver_checkSystemFile = Pathname(value);
479  }
480  else if ( entry == "solver.checkSystemFileDir" )
481  {
482  solver_checkSystemFileDir = Pathname(value);
483  }
484  else if ( entry == "multiversion" )
485  {
486  MultiversionSpec & defSpec( _multiversionMap.getDefaultSpec() );
487  str::splitEscaped( value, std::inserter( defSpec, defSpec.end() ), ", \t" );
488  }
489  else if ( entry == "locksfile.path" )
490  {
491  locks_file = Pathname(value);
492  }
493  else if ( entry == "locksfile.apply" )
494  {
495  apply_locks_file = str::strToBool( value, apply_locks_file );
496  }
497  else if ( entry == "update.datadir" )
498  {
499  // ignore, this is a constant anyway and should not be user configurabe
500  // update_data_path = Pathname(value);
501  }
502  else if ( entry == "update.scriptsdir" )
503  {
504  // ignore, this is a constant anyway and should not be user configurabe
505  // update_scripts_path = Pathname(value);
506  }
507  else if ( entry == "update.messagessdir" )
508  {
509  // ignore, this is a constant anyway and should not be user configurabe
510  // update_messages_path = Pathname(value);
511  }
512  else if ( entry == "update.messages.notify" )
513  {
514  updateMessagesNotify.set( value );
515  }
516  else if ( entry == "rpm.install.excludedocs" )
517  {
518  rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
519  str::strToBool( value, false ) );
520  }
521  else if ( entry == "history.logfile" )
522  {
523  history_log_path = Pathname(value);
524  }
525  else if ( entry == "ZYPP_SINGLE_RPMTRANS" || entry == "techpreview.ZYPP_SINGLE_RPMTRANS" )
526  {
527  DBG << "ZYPP_SINGLE_RPMTRANS=" << value << endl;
528  ::setenv( "ZYPP_SINGLE_RPMTRANS", value.c_str(), 0 );
529  }
530  else if ( entry == "techpreview.ZYPP_MEDIANETWORK" )
531  {
532  DBG << "techpreview.ZYPP_MEDIANETWORK=" << value << endl;
533  ::setenv( "ZYPP_MEDIANETWORK", value.c_str(), 1 );
534  }
535  else { // unknown entry
536  pWAR( "zypp.conf: Unknown entry in [main]:", entry, "=", value );
537  }
538  }
539  else if ( section == "env" )
540  {
541  if ( !envMap )
542  envMap = EnvMap();
543  auto [it, inserted] = envMap->emplace( entry, value );
544  if ( !inserted ) {
545  WAR << "zypp.conf [env]: duplicate key '" << entry << "', shadowing previous value '" << it->second << "' with '" << value << "'" << endl;
546  it->second = value;
547  }
548  }
549  else { // unknown section {
550  pWAR( "zypp.conf: Unknown section:", str::sconcat("[",section,"]"), entry, "=", value );
551  }
552  }
553  }
554 
555  if ( envMap ) {
556  for ( const auto & [entry, value] : *envMap ) {
557  const char* exists = ::getenv( entry.c_str() );
558  if ( exists == nullptr ) {
559  if ( ::setenv( entry.c_str(), value.c_str(), 0 ) != 0 ) {
560  pWAR( "zypp.conf [env]: set", str::sconcat("'",entry,"=",value,"'"), ": failed", Errno() );
561  }
562  else {
563  pMIL( "zypp.conf [env]: set", str::sconcat("'",entry,"=",value,"'") );
564  }
565  }
566  else {
567  pWAR( "zypp.conf [env]: skip", str::sconcat("'",entry,"=",value,"'"), ": is already set to", str::sconcat("'",exists,"'") );
568  }
569  }
570  }
571 
572  // legacy:
573  if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
574  {
575  Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
576  if ( carch != cfg_arch )
577  {
578  WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
579  cfg_arch = carch;
580  }
581  }
582  MIL << "ZConfig singleton created." << endl;
583  }
584 
585  Impl(const Impl &) = delete;
586  Impl(Impl &&) = delete;
587  Impl &operator=(const Impl &) = delete;
588  Impl &operator=(Impl &&) = delete;
589  ~Impl() {}
590 
599  {
600  Target_Ptr target( getZYpp()->getTarget() );
601  return target ? target->root() : _announced_root_path;
602  }
603 
605  {
606  _announced_root_path = Pathname(); // first of all reset any previously _announced_root_path
607 
608  Pathname newRoot { _autodetectSystemRoot() };
609  MIL << "notifyTargetChanged (" << newRoot << ")" << endl;
610 
611  if ( newRoot.emptyOrRoot() ) {
612  _currentTargetDefaults.reset(); // to initial settigns from /
613  }
614  else {
615  _currentTargetDefaults = TargetDefaults();
616  ZyppConfIniMap iniMap { newRoot }; // Scan the zypp.conf settings for newRoot
617  for ( const auto & section : iniMap.sections() ) {
618  for ( const auto & [entry,value] : iniMap.entries( section ) ) {
619  (*_currentTargetDefaults).consume( section, entry, value );
620  }
621  }
622  }
623  }
624 
625  public:
627 
628  long cfg_lockTimeout = 0; // signed!
629 
632 
633  DefaultOption<Pathname> cfg_cache_path; // Settings from the config file are also remembered
634  DefaultOption<Pathname> cfg_metadata_path; // 'default'. Cleanup in RepoManager e.g needs to tell
635  DefaultOption<Pathname> cfg_solvfiles_path; // whether settings in effect are config values or
636  DefaultOption<Pathname> cfg_packages_path; // custom settings applied vie set...Path().
637 
643 
646  std::string cfg_kernel_keep_spec;
648 
650 
655 
660 
662 
666 
669 
670  MultiversionSpec & multiversion() { return getMultiversion(); }
671  const MultiversionSpec & multiversion() const { return getMultiversion(); }
672 
674 
675  target::rpm::RpmInstFlags rpmInstallFlags;
676 
678 
679  std::string userData;
680 
682 
684 
685  std::vector<std::string> geoipHosts;
686 
687  /* Other config singleton instances */
689 
690 
691  public:
692  const TargetDefaults & targetDefaults() const { return _currentTargetDefaults ? *_currentTargetDefaults : _initialTargetDefaults; }
693  TargetDefaults & targetDefaults() { return _currentTargetDefaults ? *_currentTargetDefaults : _initialTargetDefaults; }
694  private:
696  std::optional<TargetDefaults> _currentTargetDefaults;
697 
698  private:
699  // HACK for bnc#906096: let pool re-evaluate multiversion spec
700  // if target root changes. ZConfig returns data sensitive to
701  // current target root.
702  // TODO Actually we'd need to scan the target systems zypp.conf and
703  // overlay all system specific values.
705  {
706  using SpecMap = std::map<Pathname, MultiversionSpec>;
707 
708  MultiversionSpec & getSpec( Pathname root_r, const Impl & zConfImpl_r ) // from system at root
709  {
710  // _specMap[] - the plain zypp.conf value
711  // _specMap[/] - combine [] and multiversion.d scan
712  // _specMap[root] - scan root/zypp.conf and root/multiversion.d
713 
714  if ( root_r.empty() )
715  root_r = "/";
716  bool cacheHit = _specMap.count( root_r );
717  MultiversionSpec & ret( _specMap[root_r] ); // creates new entry on the fly
718 
719  if ( ! cacheHit )
720  {
721  // bsc#1193488: If no (/root)/.../zypp.conf exists use the default zypp.conf
722  // multiversion settings. It is a legacy that the packaged multiversion setting
723  // in zypp.conf (the kernel) may differ from the builtin default (empty).
724  // But we want a missing config to behave similar to the default one, otherwise
725  // a bare metal install easily runs into trouble.
726  if ( root_r == "/" || not scanConfAt( root_r, ret, zConfImpl_r ) )
727  ret = _specMap[Pathname()];
728  scanDirAt( root_r, ret, zConfImpl_r ); // add multiversion.d at root_r
729  using zypp::operator<<;
730  MIL << "MultiversionSpec '" << root_r << "' = " << ret << endl;
731  }
732  return ret;
733  }
734 
735  MultiversionSpec & getDefaultSpec() // Spec from zypp.conf parsing; called before any getSpec
736  { return _specMap[Pathname()]; }
737 
738  private:
739  bool scanConfAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
740  {
741  ZyppConfIniMap iniMap { root_r }; // Scan the zypp.conf settings for root
742  // TODO: iniDict lacks direct value access :(
743  for ( const auto & section : iniMap.sections() ) {
744  for ( const auto & [entry,value] : iniMap.entries( section ) ) {
745  if ( entry == "multiversion" ) {
746  str::splitEscaped( value, std::inserter( spec_r, spec_r.end() ), ", \t" );
747  return true;
748  }
749  }
750  }
751  return false;
752  }
753 
754  void scanDirAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
755  {
756  // NOTE: Actually we'd need to scan and use the root_r! zypp.conf values.
757  Pathname multiversionDir( zConfImpl_r.cfg_multiversion_path );
758  if ( multiversionDir.empty() )
759  multiversionDir = ( zConfImpl_r.cfg_config_path.empty()
760  ? Pathname("/etc/zypp")
761  : zConfImpl_r.cfg_config_path ) / "multiversion.d";
762 
763  filesystem::dirForEach( Pathname::assertprefix( root_r, multiversionDir ),
764  [&spec_r]( const Pathname & dir_r, const char *const & name_r )->bool
765  {
766  MIL << "Parsing " << dir_r/name_r << endl;
767  iostr::simpleParseFile( InputStream( dir_r/name_r ),
768  [&spec_r]( int num_r, std::string line_r )->bool
769  {
770  DBG << " found " << line_r << endl;
771  spec_r.insert( std::move(line_r) );
772  return true;
773  } );
774  return true;
775  } );
776  }
777 
778  private:
780  };
781 
783  { return _multiversionMap.getSpec( _autodetectSystemRoot(), *this ); }
784 
786  };
788 
790  //
791  // METHOD NAME : ZConfig::instance
792  // METHOD TYPE : ZConfig &
793  //
795  {
796  static ZConfig _instance; // The singleton
797  return _instance;
798  }
799 
801  //
802  // METHOD NAME : ZConfig::ZConfig
803  // METHOD TYPE : Ctor
804  //
806  : _pimpl( new Impl )
807  {
808  about( MIL );
809  }
810 
812  //
813  // METHOD NAME : ZConfig::~ZConfig
814  // METHOD TYPE : Dtor
815  //
817  {}
818 
819  long ZConfig::lockTimeout() const
820  {
821  const char * env = getenv("ZYPP_LOCK_TIMEOUT");
822  if ( env ) {
823  return str::strtonum<long>( env );
824  }
825  return _pimpl->cfg_lockTimeout;
826  }
827 
829  { return _pimpl->notifyTargetChanged(); }
830 
832  { return _pimpl->_autodetectSystemRoot(); }
833 
835  {
836  return ( _pimpl->cfg_repo_mgr_root_path.empty()
837  ? systemRoot() : _pimpl->cfg_repo_mgr_root_path );
838  }
839 
841  { _pimpl->cfg_repo_mgr_root_path = root; }
842 
843  void ZConfig::announceSystemRoot( const Pathname & root_r )
844  { _pimpl->_announced_root_path = root_r; }
845 
847  //
848  // system architecture
849  //
851 
853  {
855  }
856 
858  { return _pimpl->cfg_arch; }
859 
860  void ZConfig::setSystemArchitecture( const Arch & arch_r )
861  {
862  if ( arch_r != _pimpl->cfg_arch )
863  {
864  WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
865  _pimpl->cfg_arch = arch_r;
866  }
867  }
868 
870  //
871  // text locale
872  //
874 
876  {
877  static Locale _val( _autodetectTextLocale() );
878  return _val;
879  }
880 
882  { return _pimpl->cfg_textLocale; }
883 
884  void ZConfig::setTextLocale( const Locale & locale_r )
885  {
886  if ( locale_r != _pimpl->cfg_textLocale )
887  {
888  WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
889  _pimpl->cfg_textLocale = locale_r;
890  // Propagate changes
891  sat::Pool::instance().setTextLocale( locale_r );
892  }
893  }
894 
896  // user data
898 
899  bool ZConfig::hasUserData() const
900  { return !_pimpl->userData.empty(); }
901 
902  std::string ZConfig::userData() const
903  { return _pimpl->userData; }
904 
905  bool ZConfig::setUserData( const std::string & str_r )
906  {
907  for_( ch, str_r.begin(), str_r.end() )
908  {
909  if ( *ch < ' ' && *ch != '\t' )
910  {
911  ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl;
912  return false;
913  }
914  }
915  MIL << "Set user data string to '" << str_r << "'" << endl;
916  _pimpl->userData = str_r;
917  return true;
918  }
919 
921 
923  {
924  return ( _pimpl->cfg_cache_path.get().empty()
925  ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.get() );
926  }
927 
929  {
930  return repoCachePath()/"pubkeys";
931  }
932 
934  {
935  _pimpl->cfg_cache_path = path_r;
936  }
937 
939  {
940  return ( _pimpl->cfg_metadata_path.get().empty()
941  ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path.get() );
942  }
943 
945  {
946  _pimpl->cfg_metadata_path = path_r;
947  }
948 
950  {
951  return ( _pimpl->cfg_solvfiles_path.get().empty()
952  ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.get() );
953  }
954 
956  {
957  _pimpl->cfg_solvfiles_path = path_r;
958  }
959 
961  {
962  return ( _pimpl->cfg_packages_path.get().empty()
963  ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path.get() );
964  }
965 
967  {
968  _pimpl->cfg_packages_path = path_r;
969  }
970 
972  { return _pimpl->cfg_cache_path.getDefault().empty() ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.getDefault(); }
973 
975  { return _pimpl->cfg_metadata_path.getDefault().empty() ? (builtinRepoCachePath()/"raw") : _pimpl->cfg_metadata_path.getDefault(); }
976 
978  { return _pimpl->cfg_solvfiles_path.getDefault().empty() ? (builtinRepoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.getDefault(); }
979 
981  { return _pimpl->cfg_packages_path.getDefault().empty() ? (builtinRepoCachePath()/"packages") : _pimpl->cfg_packages_path.getDefault(); }
982 
984 
986  {
987  return ( _pimpl->cfg_config_path.empty()
988  ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
989  }
990 
992  {
993  return ( _pimpl->cfg_known_repos_path.empty()
994  ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
995  }
996 
998  {
999  return ( _pimpl->cfg_known_services_path.empty()
1000  ? (configPath()/"services.d") : _pimpl->cfg_known_services_path );
1001  }
1002 
1004  { return configPath()/"needreboot"; }
1005 
1007  { return configPath()/"needreboot.d"; }
1008 
1009  void ZConfig::setGeoipEnabled( bool enable )
1010  { _pimpl->geoipEnabled = enable; }
1011 
1013  { return _pimpl->geoipEnabled; }
1014 
1016  { return builtinRepoCachePath()/"geoip.d"; }
1017 
1018  const std::vector<std::string> ZConfig::geoipHostnames () const
1019  { return _pimpl->geoipHosts; }
1020 
1022  {
1023  return ( _pimpl->cfg_vars_path.empty()
1024  ? (configPath()/"vars.d") : _pimpl->cfg_vars_path );
1025  }
1026 
1028  {
1029  return ( _pimpl->cfg_vendor_path.empty()
1030  ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
1031  }
1032 
1034  {
1035  return ( _pimpl->locks_file.empty()
1036  ? (configPath()/"locks") : _pimpl->locks_file );
1037  }
1038 
1040 
1042  { return _pimpl->repo_add_probe; }
1043 
1045  { return _pimpl->repo_refresh_delay; }
1046 
1048  { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
1049 
1051  { return _pimpl->repoLabelIsAlias; }
1052 
1053  void ZConfig::repoLabelIsAlias( bool yesno_r )
1054  { _pimpl->repoLabelIsAlias = yesno_r; }
1055 
1057  { return _pimpl->download_use_deltarpm; }
1058 
1060  { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
1061 
1063  { return _pimpl->download_media_prefer_download; }
1064 
1066  { _pimpl->download_media_prefer_download.set( yesno_r ); }
1067 
1069  { _pimpl->download_media_prefer_download.restoreToDefault(); }
1070 
1072  { return _pimpl->_mediaConf.download_max_concurrent_connections(); }
1073 
1075  { return _pimpl->_mediaConf.download_min_download_speed(); }
1076 
1078  { return _pimpl->_mediaConf.download_min_download_speed_time(); }
1079 
1081  { return _pimpl->_mediaConf.download_max_download_speed(); }
1082 
1084  { return _pimpl->_mediaConf.download_max_silent_tries(); }
1085 
1087  { return _pimpl->_mediaConf.download_transfer_timeout(); }
1088 
1089  Pathname ZConfig::download_mediaMountdir() const { return _pimpl->download_mediaMountdir; }
1090  void ZConfig::set_download_mediaMountdir( Pathname newval_r ) { _pimpl->download_mediaMountdir.set( std::move(newval_r) ); }
1091  void ZConfig::set_default_download_mediaMountdir() { _pimpl->download_mediaMountdir.restoreToDefault(); }
1092 
1094  { return _pimpl->commit_downloadMode; }
1095 
1096 
1097  bool ZConfig::gpgCheck() const { return _pimpl->gpgCheck; }
1098  TriBool ZConfig::repoGpgCheck() const { return _pimpl->repoGpgCheck; }
1099  TriBool ZConfig::pkgGpgCheck() const { return _pimpl->pkgGpgCheck; }
1100 
1101  void ZConfig::setGpgCheck( bool val_r ) { _pimpl->gpgCheck.set( val_r ); }
1102  void ZConfig::setRepoGpgCheck( TriBool val_r ) { _pimpl->repoGpgCheck.set( val_r ); }
1103  void ZConfig::setPkgGpgCheck( TriBool val_r ) { _pimpl->pkgGpgCheck.set( val_r ); }
1104 
1105  void ZConfig::resetGpgCheck() { _pimpl->gpgCheck.restoreToDefault(); }
1106  void ZConfig::resetRepoGpgCheck() { _pimpl->repoGpgCheck.restoreToDefault(); }
1107  void ZConfig::resetPkgGpgCheck() { _pimpl->pkgGpgCheck.restoreToDefault(); }
1108 
1109 
1110  ResolverFocus ZConfig::solver_focus() const { return _pimpl->targetDefaults().solver_focus; }
1111  bool ZConfig::solver_onlyRequires() const { return _pimpl->targetDefaults().solver_onlyRequires; }
1112  bool ZConfig::solver_allowVendorChange() const { return _pimpl->targetDefaults().solver_allowVendorChange; }
1113  bool ZConfig::solver_noUpdateProvide() const { return _pimpl->targetDefaults().solver_noUpdateProvide; }
1114  bool ZConfig::solver_dupAllowDowngrade() const { return _pimpl->targetDefaults().solver_dupAllowDowngrade; }
1115  bool ZConfig::solver_dupAllowNameChange() const { return _pimpl->targetDefaults().solver_dupAllowNameChange; }
1116  bool ZConfig::solver_dupAllowArchChange() const { return _pimpl->targetDefaults().solver_dupAllowArchChange; }
1117  bool ZConfig::solver_dupAllowVendorChange() const { return _pimpl->targetDefaults().solver_dupAllowVendorChange; }
1118  bool ZConfig::solver_cleandepsOnRemove() const { return _pimpl->targetDefaults().solver_cleandepsOnRemove; }
1119  unsigned ZConfig::solver_upgradeTestcasesToKeep() const { return _pimpl->targetDefaults().solver_upgradeTestcasesToKeep; }
1120 
1121  bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages; }
1122  void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.set( val_r ); }
1123  void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
1124 
1125 
1127  { return ( _pimpl->solver_checkSystemFile.empty()
1128  ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
1129 
1131  { return ( _pimpl->solver_checkSystemFileDir.empty()
1132  ? (configPath()/"systemCheck.d") : _pimpl->solver_checkSystemFileDir ); }
1133 
1134 
1135  namespace
1136  {
1137  inline void sigMultiversionSpecChanged()
1138  {
1141  }
1142  }
1143 
1144  const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); }
1145  void ZConfig::multiversionSpec( std::set<std::string> new_r ) { _pimpl->multiversion().swap( new_r ); sigMultiversionSpecChanged(); }
1146  void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); sigMultiversionSpecChanged(); }
1147  void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); sigMultiversionSpecChanged(); }
1148  void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); sigMultiversionSpecChanged(); }
1149 
1151  { return _pimpl->apply_locks_file; }
1152 
1154 #if LEGACY(1735)
1155  const
1156 #endif
1157  {
1158  return Pathname("/var/adm");
1159  }
1160 
1162 #if LEGACY(1735)
1163  const
1164 #endif
1165  {
1166  return Pathname(update_dataPath()/"update-messages");
1167  }
1168 
1170 #if LEGACY(1735)
1171  const
1172 #endif
1173  {
1174  return Pathname(update_dataPath()/"update-scripts");
1175  }
1176 
1177  std::string ZConfig::updateMessagesNotify() const
1178  { return _pimpl->updateMessagesNotify; }
1179 
1180  void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
1181  { _pimpl->updateMessagesNotify.set( val_r ); }
1182 
1184  { _pimpl->updateMessagesNotify.restoreToDefault(); }
1185 
1187 
1188  target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
1189  { return _pimpl->rpmInstallFlags; }
1190 
1191 
1193  {
1194  return ( _pimpl->history_log_path.empty() ?
1195  Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
1196  }
1197 
1199  {
1200  return _pimpl->_mediaConf.credentialsGlobalDir();
1201  }
1202 
1204  {
1205  return _pimpl->_mediaConf.credentialsGlobalFile();
1206  }
1207 
1209 
1210  std::string ZConfig::distroverpkg() const
1211  { return "system-release"; }
1212 
1214 
1216  { return _pimpl->pluginsPath.get(); }
1217 
1218  std::string ZConfig::multiversionKernels() const
1219  {
1220  return _pimpl->cfg_kernel_keep_spec;
1221  }
1222 
1224 
1225  std::ostream & ZConfig::about( std::ostream & str ) const
1226  {
1227  str << "libzypp: " LIBZYPP_VERSION_STRING << " (" << LIBZYPP_CODESTREAM << ")" << endl;
1228 
1229  str << "libsolv: " << solv_version;
1230  if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
1231  str << " (built against " << LIBSOLV_VERSION_STRING << ")";
1232  str << endl;
1233 
1234  str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
1235  str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
1236  return str;
1237  }
1238 
1240 } // namespace zypp
std::set< std::string > MultiversionSpec
Definition: ZConfig.cc:237
~ZConfig()
Dtor.
Definition: ZConfig.cc:816
void setDefault(value_type newval_r)
Set a new default value.
Definition: ZConfig.cc:219
bool hasUserData() const
Whether a (non empty) user data sting is defined.
Definition: ZConfig.cc:899
Option< bool > solver_dupAllowDowngrade
Definition: ZConfig.cc:314
static Locale defaultTextLocale()
The autodetected preferred locale for translated texts.
Definition: ZConfig.cc:875
Mutable option.
Definition: ZConfig.cc:163
Pathname repoSolvfilesPath() const
Path where the repo solv files are created and kept (repoCachePath()/solv).
Definition: ZConfig.cc:949
Pathname credentialsGlobalDir() const
Defaults to /etc/zypp/credentials.d.
Definition: ZConfig.cc:1198
#define MIL
Definition: Logger.h:130
Pathname builtinRepoPackagesPath() const
The builtin config file value.
Definition: ZConfig.cc:980
Pathname cfg_known_repos_path
Definition: ZConfig.cc:639
void setGeoipEnabled(bool enable=true)
Enables or disables the use of the geoip feature of download.opensuse.org.
Definition: ZConfig.cc:1009
void setGpgCheck(bool val_r)
Change the value.
Definition: ZConfig.cc:1101
long download_min_download_speed_time() const
The time in seconds that the transfer speed must remain below download_min_download_speed before the ...
Definition: ZConfig.cc:1077
std::ostream & about(std::ostream &str) const
Print some detail about the current libzypp version.
Definition: ZConfig.cc:1225
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Definition: ZConfig.cc:1059
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).
Definition: ZConfig.cc:1180
void setRepoGpgCheck(TriBool val_r)
Change the value.
Definition: ZConfig.cc:1102
Pathname knownReposPath() const
Path where the known repositories .repo files are kept (configPath()/repos.d).
Definition: ZConfig.cc:991
long download_transfer_timeout() const
Maximum time in seconds that you allow a transfer operation to take.
Definition: ZConfig.cc:1086
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.
Definition: String.h:666
Pathname cfg_known_services_path
Definition: ZConfig.cc:640
static ZConfig & instance()
Singleton ctor.
Definition: ZConfig.cc:794
long download_max_download_speed() const
Maximum download speed (bytes per second)
Definition: ZConfig.cc:1080
static Pathname update_messagesPath()
Path where the update messages are stored ( /var/adm/update-messages )
Definition: ZConfig.cc:1161
MultiversionSpec & multiversion()
Definition: ZConfig.cc:670
static const Locale enCode
Last resort "en".
Definition: Locale.h:78
Locale textLocale() const
The locale for translated texts zypp uses.
Definition: ZConfig.cc:881
bool repoLabelIsAlias() const
Whether to use repository alias or name in user messages (progress, exceptions, ...).
Definition: ZConfig.cc:1050
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:233
Architecture.
Definition: Arch.h:36
bool download_use_deltarpm
Definition: ZConfig.cc:656
void setRepoPackagesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:966
Pathname varsPath() const
Path containing custom repo variable definitions (configPath()/vars.d).
Definition: ZConfig.cc:1021
ResolverFocus
The resolver&#39;s general attitude.
Definition: ResolverFocus.h:23
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Definition: ZConfig.cc:928
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:29
LocaleSet repoRefreshLocales
Definition: ZConfig.cc:653
Pathname builtinRepoMetadataPath() const
The builtin config file value.
Definition: ZConfig.cc:974
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
Definition: PathInfo.cc:32
DefaultOption< Pathname > cfg_metadata_path
Definition: ZConfig.cc:634
static Arch detectSystemArchitecture()
Determine system architecture evaluating uname and /proc/cpuinfo.
Definition: Arch.cc:701
bool repo_add_probe() const
Whether repository urls should be probed.
Definition: ZConfig.cc:1041
void restoreToDefault()
Reset value to the current default.
Definition: ZConfig.cc:207
String related utilities and Regular expression matching.
void removeMultiversionSpec(const std::string &name_r)
Definition: ZConfig.cc:1148
bool geoipEnabled() const
Returns true if zypp should use the geoip feature of download.opensuse.org.
Definition: ZConfig.cc:1012
Definition: ansi.h:854
void setSystemArchitecture(const Arch &arch_r)
Override the zypp system architecture.
Definition: ZConfig.cc:860
unsigned solver_upgradeTestcasesToKeep() const
When committing a dist upgrade (e.g.
Definition: ZConfig.cc:1119
Option< bool > solver_allowVendorChange
Definition: ZConfig.cc:313
Pathname cfg_config_path
Definition: ZConfig.cc:638
std::vector< std::string > geoipHosts
Definition: ZConfig.cc:685
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d)
Definition: ZConfig.cc:1027
target::rpm::RpmInstFlags rpmInstallFlags
Definition: ZConfig.cc:675
Helper to create and pass std::istream.
Definition: inputstream.h:56
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
bool setUserData(const std::string &str_r)
Set a new userData string.
Definition: ZConfig.cc:905
std::string cfg_kernel_keep_spec
Definition: ZConfig.cc:646
Request the standard behavior (as defined in zypp.conf or &#39;Job&#39;)
void set_download_mediaMountdir(Pathname newval_r)
Set alternate value.
Definition: ZConfig.cc:1090
bool solver_dupAllowArchChange() const
DUP tune: Whether to allow package arch changes upon DUP.
Definition: ZConfig.cc:1116
MultiversionSpec & getDefaultSpec()
Definition: ZConfig.cc:735
void resetSolverUpgradeRemoveDroppedPackages()
Reset solverUpgradeRemoveDroppedPackages to the zypp.conf default.
Definition: ZConfig.cc:1123
std::string userData() const
User defined string value to be passed to log, history, plugins...
Definition: ZConfig.cc:902
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Pointer to implementation.
Definition: ZConfig.h:660
#define ERR
Definition: Logger.h:132
const std::set< std::string > & multiversionSpec() const
Definition: ZConfig.cc:1144
void set_default_download_mediaMountdir()
Reset to zypp.cong default.
Definition: ZConfig.cc:1091
void addMultiversionSpec(const std::string &name_r)
Definition: ZConfig.cc:1147
void resetGpgCheck()
Reset to the zconfig default.
Definition: ZConfig.cc:1105
void set_download_media_prefer_download(bool yesno_r)
Set download_media_prefer_download to a specific value.
Definition: ZConfig.cc:1065
DefaultOption< Pathname > download_mediaMountdir
Definition: ZConfig.cc:659
bool solverUpgradeRemoveDroppedPackages() const
Whether dist upgrade should remove a products dropped packages (true).
Definition: ZConfig.cc:1121
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:31
DownloadMode commit_downloadMode() const
Commit download policy to use as default.
Definition: ZConfig.cc:1093
DefaultOption< bool > download_media_prefer_download
Definition: ZConfig.cc:658
LocaleSet repoRefreshLocales() const
List of locales for which translated package descriptions should be downloaded.
Definition: ZConfig.cc:1047
TriBool strToTriBool(const C_Str &str)
Parse str into a bool if it&#39;s a legal true or false string; else indeterminate.
Definition: String.cc:96
Pathname download_mediaMountdir() const
Path where media are preferably mounted or downloaded.
Definition: ZConfig.cc:1089
Pathname repoManagerRoot() const
The RepoManager root directory.
Definition: ZConfig.cc:834
MultiversionMap _multiversionMap
Definition: ZConfig.cc:785
bool consume(const std::string &section, const std::string &entry, const std::string &value)
Definition: ZConfig.cc:256
DefaultOption< bool > gpgCheck
Definition: ZConfig.cc:663
bool empty() const
Test for an empty path.
Definition: Pathname.h:117
void setTextLocale(const Locale &locale_r)
Set the preferred locale for translated texts.
Definition: ZConfig.cc:884
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.
Definition: String.h:602
static Pool instance()
Singleton ctor.
Definition: Pool.h:55
Pathname _announced_root_path
Definition: ZConfig.cc:626
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1099
Pathname solver_checkSystemFileDir() const
Directory, which may or may not contain files in which dependencies described which has to be fulfill...
Definition: ZConfig.cc:1130
std::optional< TargetDefaults > _currentTargetDefaults
TargetDefaults while –root.
Definition: ZConfig.cc:696
void set_default_download_media_prefer_download()
Set download_media_prefer_download to the configfiles default.
Definition: ZConfig.cc:1068
Pathname solver_checkSystemFile() const
File in which dependencies described which has to be fulfilled for a running system.
Definition: ZConfig.cc:1126
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition: Target.cc:94
Pathname locksFile() const
Path where zypp can find or create lock file (configPath()/locks)
Definition: ZConfig.cc:1033
Option & operator=(value_type newval_r)
Definition: ZConfig.cc:172
ZConfig implementation.
Definition: ZConfig.cc:235
unsigned repo_refresh_delay() const
Amount of time in minutes that must pass before another refresh.
Definition: ZConfig.cc:1044
libzypp will decide what to do.
Definition: DownloadMode.h:26
bool gpgCheck() const
Turn signature checking on/off (on)
Definition: ZConfig.cc:1097
Pathname repoCachePath() const
Path where the caches are kept (/var/cache/zypp)
Definition: ZConfig.cc:922
Option< bool > solver_cleandepsOnRemove
Definition: ZConfig.cc:318
bool solver_dupAllowVendorChange() const
DUP tune: Whether to allow package vendor changes upon DUP.
Definition: ZConfig.cc:1117
Option(value_type initial_r)
No default ctor, explicit initialisation!
Definition: ZConfig.cc:168
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Unless path_r does not already denote a path below root_r, combine them.
Definition: Pathname.cc:272
Interim helper class to collect global options and settings.
Definition: ZConfig.h:81
#define WAR
Definition: Logger.h:131
Pathname _autodetectSystemRoot() const
bsc#1237044: Provide announceSystemRoot to allow commands using –root without launching a Target...
Definition: ZConfig.cc:598
Pathname credentialsGlobalFile() const
Defaults to /etc/zypp/credentials.cat.
Definition: ZConfig.cc:1203
bool solver_dupAllowDowngrade() const
DUP tune: Whether to allow version downgrades upon DUP.
Definition: ZConfig.cc:1114
DefaultOption< bool > solverUpgradeRemoveDroppedPackages
Definition: ZConfig.cc:321
static Pathname update_dataPath()
Path where the update items are kept (/var/adm)
Definition: ZConfig.cc:1153
Types and functions for filesystem operations.
Definition: Glob.cc:23
#define pWAR
Definition: LogTools.h:316
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1098
bool apply_locks_file() const
Whether locks file should be read and applied after start (true)
Definition: ZConfig.cc:1150
void restoreToDefault(value_type newval_r)
Reset value to a new default.
Definition: ZConfig.cc:211
bool solver_dupAllowNameChange() const
DUP tune: Whether to follow package renames upon DUP.
Definition: ZConfig.cc:1115
TInt strtonum(const C_Str &str)
Parsing numbers from string.
Definition: String.h:459
Pathname cfg_vars_path
Definition: ZConfig.cc:641
std::string sconcat(Args &&... args)
Concat words as string.
Definition: LogTools.h:276
Pathname needrebootPath() const
Path where the custom needreboot config files are kept (configPath()/needreboot.d).
Definition: ZConfig.cc:1006
void clearMultiversionSpec()
Definition: ZConfig.cc:1146
Pathname locks_file
Definition: ZConfig.cc:647
Pathname repoPackagesPath() const
Path where the repo packages are downloaded and kept (repoCachePath()/packages).
Definition: ZConfig.cc:960
static PoolImpl & myPool()
Definition: PoolMember.cc:41
Pathname geoipCachePath() const
Path where the geoip caches are kept (/var/cache/zypp/geoip)
Definition: ZConfig.cc:1015
long download_max_silent_tries() const
Maximum silent tries.
Definition: ZConfig.cc:1083
Locale cfg_textLocale
Definition: ZConfig.cc:631
Mutable option with initial value also remembering a config value.
Definition: ZConfig.cc:193
target::rpm::RpmInstFlags rpmInstallFlags() const
The default target::rpm::RpmInstFlags for ZYppCommitPolicy.
Definition: ZConfig.cc:1188
bool solver_noUpdateProvide() const
Do not prefer update candidates also providing the old package.
Definition: ZConfig.cc:1113
bool download_use_deltarpm_always
Definition: ZConfig.cc:657
std::optional< Pathname > ZYPP_CONF()
Definition: ZConfig.cc:46
int compareCI(const C_Str &lhs, const C_Str &rhs)
Definition: String.h:1055
long lockTimeout() const
The number of seconds to wait for the zypp lock to become available.
Definition: ZConfig.cc:819
static Pathname update_scriptsPath()
Path where the update scripts are stored ( /var/adm/update-scripts )
Definition: ZConfig.cc:1169
bool solver_onlyRequires() const
Solver regards required packages,patterns,...
Definition: ZConfig.cc:1111
TargetDefaults _initialTargetDefaults
Initial TargetDefaults from /.
Definition: ZConfig.cc:695
Pathname configPath() const
Path where the configfiles are kept (/etc/zypp).
Definition: ZConfig.cc:985
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:50
Option< Pathname > pluginsPath
Definition: ZConfig.cc:681
DefaultOption< Pathname > cfg_cache_path
Definition: ZConfig.cc:633
ZYpp::Ptr getZYpp()
relates: ZYppFactory Convenience to get the Pointer to the ZYpp instance.
Definition: ZYppFactory.h:77
Parses a INI file and offers its structure as a dictionary.
Definition: inidict.h:41
DefaultOption< Pathname > cfg_packages_path
Definition: ZConfig.cc:636
#define pMIL
Definition: LogTools.h:315
Option< bool > solver_dupAllowArchChange
Definition: ZConfig.cc:316
Pathname builtinRepoSolvfilesPath() const
The builtin config file value.
Definition: ZConfig.cc:977
static Arch defaultSystemArchitecture()
The autodetected system architecture.
Definition: ZConfig.cc:852
void resetRepoGpgCheck()
Reset to the zconfig default.
Definition: ZConfig.cc:1106
ResolverFocus solver_focus() const
The resolver&#39;s general attitude when resolving jobs.
Definition: ZConfig.cc:1110
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Definition: ZConfig.cc:1118
DefaultOption< std::string > updateMessagesNotify
Definition: ZConfig.cc:649
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
std::map< Pathname, MultiversionSpec > SpecMap
Definition: ZConfig.cc:706
void announceSystemRoot(const Pathname &root_r)
Announce a target root directory without launching the Target.
Definition: ZConfig.cc:843
Pathname cfg_repo_mgr_root_path
Definition: ZConfig.cc:642
bool download_media_prefer_download() const
Hint which media to prefer when installing packages (download vs.
Definition: ZConfig.cc:1062
Pathname solver_checkSystemFile
Definition: ZConfig.cc:667
bool fromString(const std::string &val_r, ResolverFocus &ret_r)
relates: ResolverFocus Conversion from string (enumerator name, case insensitive, empty string is Def...
ZConfig()
Default ctor.
Definition: ZConfig.cc:805
Pathname needrebootFile() const
Path of the default needreboot config file (configPath()/needreboot).
Definition: ZConfig.cc:1003
Pathname historyLogFile() const
Path where ZYpp install history is logged.
Definition: ZConfig.cc:1192
Pathname history_log_path
Definition: ZConfig.cc:677
std::string userData
Definition: ZConfig.cc:679
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
Definition: String.h:500
std::string distroverpkg() const
Package telling the "product version" on systems not using /etc/product.d/baseproduct.
Definition: ZConfig.cc:1210
MultiversionSpec & getMultiversion() const
Definition: ZConfig.cc:782
const TargetDefaults & targetDefaults() const
Definition: ZConfig.cc:692
std::string multiversionKernels() const
Definition: ZConfig.cc:1218
TargetDefaults & targetDefaults()
Definition: ZConfig.cc:693
void setRepoMetadataPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:944
DownloadMode deserializeDownloadMode(const std::string &str_r)
relates: DownloadMode Parse from string.
Definition: DownloadMode.h:50
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:225
Pathname knownServicesPath() const
Path where the known services .service files are kept (configPath()/services.d).
Definition: ZConfig.cc:997
void resetUpdateMessagesNotify()
Reset to the zypp.conf default.
Definition: ZConfig.cc:1183
Arch systemArchitecture() const
The system architecture zypp uses.
Definition: ZConfig.cc:857
void setSolverUpgradeRemoveDroppedPackages(bool val_r)
Set solverUpgradeRemoveDroppedPackages to val_r.
Definition: ZConfig.cc:1122
DefaultOption(value_type initial_r)
Definition: ZConfig.cc:198
bool scanConfAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition: ZConfig.cc:739
std::string updateMessagesNotify() const
Command definition for sending update messages.
Definition: ZConfig.cc:1177
Pathname systemRoot() const
The target root directory.
Definition: ZConfig.cc:831
Pathname builtinRepoCachePath() const
The builtin config file value.
Definition: ZConfig.cc:971
value_type _val
Definition: ZConfig.cc:188
Pathname solver_checkSystemFileDir
Definition: ZConfig.cc:668
#define pDBG
Definition: LogTools.h:314
Pathname cfg_vendor_path
Definition: ZConfig.cc:644
Pathname cfg_multiversion_path
Definition: ZConfig.cc:645
Option< bool > solver_dupAllowVendorChange
Definition: ZConfig.cc:317
void setPkgGpgCheck(TriBool val_r)
Change the value.
Definition: ZConfig.cc:1103
const value_type & getDefault() const
Get the current default value.
Definition: ZConfig.cc:215
DefaultOption< Pathname > cfg_solvfiles_path
Definition: ZConfig.cc:635
void notifyTargetChanged()
Definition: ZConfig.cc:604
bool solver_allowVendorChange() const
Whether vendor check is by default enabled.
Definition: ZConfig.cc:1112
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
void setRepoSolvfilesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:955
DefaultOption & operator=(value_type newval_r)
Definition: ZConfig.cc:203
detail::Dump< Tp > dump(const Tp &obj_r)
Definition: LogTools.h:772
const std::vector< std::string > geoipHostnames() const
All hostnames we want to rewrite using the geoip feature.
Definition: ZConfig.cc:1018
void notifyTargetChanged()
internal
Definition: ZConfig.cc:828
bool download_use_deltarpm() const
Whether to consider using a deltarpm when downloading a package.
Definition: ZConfig.cc:1056
void setRepoCachePath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:933
option_type _default
Definition: ZConfig.cc:223
const MultiversionSpec & multiversion() const
Definition: ZConfig.cc:671
void setRepoManagerRoot(const Pathname &root)
Sets the RepoManager root directory.
Definition: ZConfig.cc:840
MultiversionSpec & getSpec(Pathname root_r, const Impl &zConfImpl_r)
Definition: ZConfig.cc:708
Pathname pluginsPath() const
Defaults to /usr/lib/zypp/plugins.
Definition: ZConfig.cc:1215
DefaultOption< TriBool > repoGpgCheck
Definition: ZConfig.cc:664
void scanDirAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition: ZConfig.cc:754
Option< DownloadMode > commit_downloadMode
Definition: ZConfig.cc:661
DefaultOption< TriBool > pkgGpgCheck
Definition: ZConfig.cc:665
unsigned repo_refresh_delay
Definition: ZConfig.cc:652
void resetPkgGpgCheck()
Reset to the zconfig default.
Definition: ZConfig.cc:1107
static MediaConfig & instance()
Definition: mediaconfig.cc:48
Option< bool > solver_noUpdateProvide
Definition: ZConfig.cc:319
Pathname repoMetadataPath() const
Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
Definition: ZConfig.cc:938
#define DBG
Definition: Logger.h:129
auto transform(Container< Msg, CArgs... > &&val, Transformation &&transformation)
Definition: transform.h:64
Settings that follow a changed Target.
Definition: ZConfig.cc:240
long download_min_download_speed() const
Minimum download speed (bytes per second) until the connection is dropped.
Definition: ZConfig.cc:1074
long download_max_concurrent_connections() const
Maximum number of concurrent connections for a single transfer.
Definition: ZConfig.cc:1071
DownloadMode
Supported commit download policies.
Definition: DownloadMode.h:24
Option< unsigned > solver_upgradeTestcasesToKeep
Definition: ZConfig.cc:320
Option< bool > solver_dupAllowNameChange
Definition: ZConfig.cc:315