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