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