1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZConfig.h
12 #ifndef ZYPP_ZCONFIG_H
13 #define ZYPP_ZCONFIG_H
17 #include "zypp/base/Deprecated.h"
19 #include "zypp/base/NonCopyable.h"
20 #include "zypp/base/PtrTypes.h"
22 #include "zypp/Arch.h"
23 #include "zypp/Locale.h"
24 #include "zypp/Pathname.h"
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
30 ///////////////////////////////////////////////////////////////////
32 // CLASS NAME : ZConfig
34 /** Interim helper class to collect global options and settings.
35 * Use it to avoid hardcoded values and calls to getZYpp() just
36 * to retrieve some value like architecture, languages or tmppath.
38 * It reads /etc/zypp/zypp.conf, the filename can be overridden by
39 * setting the ZYPP_CONF environment variable to a different file.
43 class ZConfig : private base::NonCopyable
47 static ZConfig & instance();
51 /** The autodetected system architecture. */
52 static Arch defaultSystemArchitecture();
54 /** The system architecture zypp uses. */
55 Arch systemArchitecture() const;
57 /** Override the zypp system architecture.
58 * This is useful for test scenarious. <b>But be warned</b>, zypp does
59 * not expect the system architecture to change at runtime. So
60 * set it at the verry beginning before you acess any other
63 void setSystemArchitecture( const Arch & arch_r );
65 /** Reset the zypp system architecture to the default. */
66 void resetSystemArchitecture()
67 { setSystemArchitecture( defaultSystemArchitecture() ); }
70 /** The autodetected prefered locale for translated texts.
72 static Locale defaultTextLocale();
74 /** The locale for translated texts zypp uses.
76 Locale textLocale() const;
78 /** Set the prefered locale for translated texts. */
79 void setTextLocale( const Locale & locale_r );
81 /** Reset the locale for translated texts to the default. */
82 void resetTextLocale()
83 { setTextLocale( defaultTextLocale() ); }
87 * Path where the repo metadata is downloaded and kept.
89 Pathname repoMetadataPath() const;
92 * Path where the repo packages are downloaded and kept.
94 Pathname repoPackagesPath() const;
97 * Path where the processed cache is kept
98 * (this is where zypp.db is located.
100 Pathname repoCachePath() const;
103 * Path where the known repositories
104 * .repo files are kept
106 Pathname knownReposPath() const;
109 * Separator string for storing/reading sets of strings to/from
112 const std::string & cacheDBSplitJoinSeparator() const;
115 * Whether repository urls should be probed.
119 bool repo_add_probe() const;
122 * Amount of time in minutes that must pass before another refresh.
124 unsigned repo_refresh_delay() const;
126 /** Whether to consider using a patchrpm when downloading a package.
127 * Config option <tt>download.use_patchrpm (true)</tt>
129 bool download_use_patchrpm() const;
131 /** Whether to consider using a deltarpm when downloading a package.
132 * Config option <tt>download.use_deltarpm (true)</tt>
134 bool download_use_deltarpm() const;
137 * Directory for equivalent vendor definitions
139 Pathname vendorPath() const;
142 * Solver regards required packages,patterns,... only
144 bool solver_onlyRequires() const;
147 * Path where zypp can find or create lock file
149 Pathname locksFile() const;
152 * Whetever locks file should be readed and applied after start
154 bool apply_locks_file() const;
157 * Path where update scripts are stored
159 Pathname updateScriptsPath() const;
169 /** Pointer to implementation */
170 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
172 ///////////////////////////////////////////////////////////////////
174 /////////////////////////////////////////////////////////////////
176 ///////////////////////////////////////////////////////////////////
177 #endif // ZYPP_ZCONFIG_H