libzypp  17.5.0
ZConfig.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_ZCONFIG_H
13 #define ZYPP_ZCONFIG_H
14 
15 #include <iosfwd>
16 #include <set>
17 #include <string>
18 
19 #include "zypp/APIConfig.h"
20 #include "zypp/base/NonCopyable.h"
21 #include "zypp/base/PtrTypes.h"
22 
23 #include "zypp/Arch.h"
24 #include "zypp/Locale.h"
25 #include "zypp/Pathname.h"
26 #include "zypp/IdString.h"
27 #include "zypp/TriBool.h"
28 
29 #include "zypp/DownloadMode.h"
31 
33 namespace zypp
34 {
35 
37  //
38  // CLASS NAME : ZConfig
39  //
59  class ZConfig : private base::NonCopyable
60  {
61  public:
62 
64  static ZConfig & instance();
65 
67  std::ostream & about( std::ostream & str ) const;
68 
69  public:
70 
74  Pathname systemRoot() const;
75 
79  Pathname repoManagerRoot() const;
80 
84  void setRepoManagerRoot ( const Pathname &root );
85 
86  public:
87 
90 
92  Arch systemArchitecture() const;
93 
100  void setSystemArchitecture( const Arch & arch_r );
101 
105 
106  public:
109  static Locale defaultTextLocale();
110 
113  Locale textLocale() const;
114 
116  void setTextLocale( const Locale & locale_r );
117 
121 
122  public:
128  bool hasUserData() const;
129 
131  std::string userData() const;
132 
137  bool setUserData( const std::string & str_r );
139 
140  public:
145  Pathname repoCachePath() const;
146 
150  void setRepoCachePath ( const Pathname &path_r );
151 
156  Pathname repoMetadataPath() const;
157 
158 
162  void setRepoMetadataPath ( const Pathname &path_r );
163 
168  Pathname repoSolvfilesPath() const;
169 
173  void setRepoSolvfilesPath ( const Pathname &path_r );
174 
179  Pathname repoPackagesPath() const;
180 
184  void setRepoPackagesPath ( const Pathname &path_r );
185 
190  Pathname configPath() const;
191 
196  Pathname knownReposPath() const;
197 
202  Pathname knownServicesPath() const;
203 
209  Pathname varsPath() const;
210 
216  bool repo_add_probe() const;
217 
221  unsigned repo_refresh_delay() const;
222 
227 
233  bool repoLabelIsAlias() const;
234 
242  void repoLabelIsAlias( bool yesno_r );
243 
248 
253  long download_min_download_speed() const;
254 
258  long download_max_download_speed() const;
259 
263  long download_max_silent_tries() const;
264 
268  long download_transfer_timeout() const;
269 
270 
274  bool download_use_deltarpm() const;
275 
280  bool download_use_deltarpm_always() const;
281 
286  bool download_media_prefer_download() const;
289  { return ! download_media_prefer_download(); }
293  void set_download_media_prefer_download( bool yesno_r );
298 
305  void set_download_mediaMountdir( Pathname newval_r );
308 
313 
327  bool gpgCheck() const;
328  TriBool repoGpgCheck() const;
329  TriBool pkgGpgCheck() const;
330 
331  void setGpgCheck( bool val_r );
332  void setRepoGpgCheck( TriBool val_r );
333  void setPkgGpgCheck( TriBool val_r );
334 
335  void resetGpgCheck();
336  void resetRepoGpgCheck();
337  void resetPkgGpgCheck();
338 
339  //
344  Pathname vendorPath() const;
345 
349  bool solver_onlyRequires() const;
350 
356 
363 
367  bool solver_allowVendorChange() const;
368 
370  bool solver_dupAllowDowngrade() const;
371 
373  bool solver_dupAllowNameChange() const;
374 
376  bool solver_dupAllowArchChange() const;
377 
379  bool solver_dupAllowVendorChange() const;
380 
384  bool solver_cleandepsOnRemove() const;
385 
393  unsigned solver_upgradeTestcasesToKeep() const;
394 
410  void setSolverUpgradeRemoveDroppedPackages( bool val_r );
413 
424  const std::set<std::string> & multiversionSpec() const;
425  void multiversionSpec( std::set<std::string> new_r );
426  void clearMultiversionSpec();
427  void addMultiversionSpec( const std::string & name_r );
428  void removeMultiversionSpec( const std::string & name_r );
430 
435  Pathname locksFile() const;
436 
440  bool apply_locks_file() const;
441 
445  Pathname update_dataPath() const;
446 
452 
458 
462  std::string updateMessagesNotify() const;
464  void setUpdateMessagesNotify( const std::string & val_r );
468 
477  target::rpm::RpmInstFlags rpmInstallFlags() const;
479 
486  Pathname historyLogFile() const;
487 
492 
497 
506  std::string distroverpkg() const;
507 
513  Pathname pluginsPath() const;
514 
516  public:
517  class Impl;
519  ~ZConfig();
520  private:
521  friend class Impl;
523  ZConfig();
526  };
528 
530 } // namespace zypp
532 #endif // ZYPP_ZCONFIG_H
~ZConfig()
Dtor.
Definition: ZConfig.cc:816
bool hasUserData() const
Whether a (non empty) user data sting is defined.
Definition: ZConfig.cc:886
static Locale defaultTextLocale()
The autodetected prefered locale for translated texts.
Definition: ZConfig.cc:862
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
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
void setUpdateMessagesNotify(const std::string &val_r)
Set a new command definition (see update.messages.notify in zypp.conf).
Definition: ZConfig.cc:1126
void resetSystemArchitecture()
Reset the zypp system architecture to the default.
Definition: ZConfig.h:103
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
static ZConfig & instance()
Singleton ctor.
Definition: Resolver.cc:125
long download_max_download_speed() const
Maximum download speed (bytes per second)
Definition: ZConfig.cc:1029
Locale textLocale() const
The locale for translated texts zypp uses.
Definition: ZConfig.cc:868
bool repoLabelIsAlias() const
Whether to use repository alias or name in user messages (progress, exceptions, ...).
Definition: ZConfig.cc:1002
Architecture.
Definition: Arch.h:36
Helper filtering the files offered by a RepomdFileReader.
Pathname update_scriptsPath() const
Path where the repo metadata is downloaded and kept (update_dataPath()/).
Definition: ZConfig.cc:1117
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
bool repo_add_probe() const
Whether repository urls should be probed.
Definition: ZConfig.cc:993
String related utilities and Regular expression matching.
void removeMultiversionSpec(const std::string &name_r)
Definition: ZConfig.cc:1100
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 vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d)
Definition: ZConfig.cc:979
bool setUserData(const std::string &str_r)
Set a new userData string.
Definition: ZConfig.cc:892
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
void resetSolverUpgradeRemoveDroppedPackages()
Reset solverUpgradeRemoveDroppedPackages to the zypp.conf default.
Definition: ZConfig.cc:1086
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
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
void addMultiversionSpec(const std::string &name_r)
Definition: ZConfig.cc:1099
void resetGpgCheck()
Reset to the zconfig default.
Definition: ZConfig.cc:1054
void set_download_media_prefer_download(bool yesno_r)
Set download_media_prefer_download to a specific value.
Definition: ZConfig.cc:1017
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
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
void setTextLocale(const Locale &locale_r)
Set the prefered locale for translated texts.
Definition: ZConfig.cc:871
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
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
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
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
Provides API related macros.
Interim helper class to collect global options and settings.
Definition: ZConfig.h:59
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
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
bool solver_dupAllowNameChange() const
DUP tune: Whether to follow package renames upon DUP.
Definition: ZConfig.cc:1066
Pathname update_dataPath() const
Path where the update items are kept (/var/adm)
Definition: ZConfig.cc:1105
void clearMultiversionSpec()
Definition: ZConfig.cc:1098
Pathname repoPackagesPath() const
Path where the repo packages are downloaded and kept (repoCachePath()/packages).
Definition: ZConfig.cc:942
long download_max_silent_tries() const
Maximum silent tries.
Definition: ZConfig.cc:1032
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 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
static Arch defaultSystemArchitecture()
The autodetected system architecture.
Definition: ZConfig.cc:838
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
bool download_media_prefer_download() const
Hint which media to prefer when installing packages (download vs.
Definition: ZConfig.cc:1014
ZConfig()
Default ctor.
Definition: ZConfig.cc:805
bool download_media_prefer_volatile() const
Definition: ZConfig.h:288
Pathname historyLogFile() const
Path where ZYpp install history is logged.
Definition: ZConfig.cc:1138
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
std::string distroverpkg() const
Package telling the "product version" on systems not using /etc/product.d/baseproduct.
Definition: ZConfig.cc:1158
void resetTextLocale()
Reset the locale for translated texts to the default.
Definition: ZConfig.h:119
void setRepoMetadataPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:926
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
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
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
void setPkgGpgCheck(TriBool val_r)
Change the value.
Definition: ZConfig.cc:1052
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 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
void setRepoCachePath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition: ZConfig.cc:915
void setRepoManagerRoot(const Pathname &root)
Sets the RepoManager root directory.
Definition: ZConfig.cc:829
Pathname pluginsPath() const
Defaults to /usr/lib/zypp/plugins.
Definition: ZConfig.cc:1163
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
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