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