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