1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZConfig.h
12 #ifndef ZYPP_ZCONFIG_H
13 #define ZYPP_ZCONFIG_H
19 #include "zypp/base/Deprecated.h"
21 #include "zypp/base/NonCopyable.h"
22 #include "zypp/base/PtrTypes.h"
24 #include "zypp/Arch.h"
25 #include "zypp/Locale.h"
26 #include "zypp/Pathname.h"
27 #include "zypp/IdString.h"
29 ///////////////////////////////////////////////////////////////////
31 { /////////////////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////
35 // CLASS NAME : ZConfig
37 /** Interim helper class to collect global options and settings.
38 * Use it to avoid hardcoded values and calls to getZYpp() just
39 * to retrieve some value like architecture, languages or tmppath.
41 * It reads /etc/zypp/zypp.conf, the filename can be overridden by
42 * setting the ZYPP_CONF environment variable to a different file.
44 * Note, if you add settings to this file, please follow the following
47 * namespace.settingname
51 * namespace_settingName()
55 class ZConfig : private base::NonCopyable
59 static ZConfig & instance();
63 /** The autodetected system architecture. */
64 static Arch defaultSystemArchitecture();
66 /** The system architecture zypp uses. */
67 Arch systemArchitecture() const;
69 /** Override the zypp system architecture.
70 * This is useful for test scenarious. <b>But be warned</b>, zypp does
71 * not expect the system architecture to change at runtime. So
72 * set it at the verry beginning before you acess any other
75 void setSystemArchitecture( const Arch & arch_r );
77 /** Reset the zypp system architecture to the default. */
78 void resetSystemArchitecture()
79 { setSystemArchitecture( defaultSystemArchitecture() ); }
82 /** The autodetected prefered locale for translated texts.
84 static Locale defaultTextLocale();
86 /** The locale for translated texts zypp uses.
88 Locale textLocale() const;
90 /** Set the prefered locale for translated texts. */
91 void setTextLocale( const Locale & locale_r );
93 /** Reset the locale for translated texts to the default. */
94 void resetTextLocale()
95 { setTextLocale( defaultTextLocale() ); }
99 * Path where the caches are kept (/var/cache/zypp)
100 * \ingroup g_ZC_REPOCACHE
102 Pathname repoCachePath() const;
105 * Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
106 * \ingroup g_ZC_REPOCACHE
108 Pathname repoMetadataPath() const;
111 * Path where the repo solv files are created and kept (repoCachePath()/solv).
112 * \ingroup g_ZC_REPOCACHE
114 Pathname repoSolvfilesPath() const;
117 * Path where the repo packages are downloaded and kept (repoCachePath()/packages).
118 * \ingroup g_ZC_REPOCACHE
120 Pathname repoPackagesPath() const;
123 * Path where the configfiles are kept (/etc/zypp).
124 * \ingroup g_ZC_CONFIGFILES
126 Pathname configPath() const;
129 * Path where the known repositories .repo files are kept (configPath()/repos.d).
130 * \ingroup g_ZC_CONFIGFILES
132 Pathname knownReposPath() const;
135 * Path where the known services .service files are kept (configPath()/services.d).
136 * \ingroup g_ZC_CONFIGFILES
138 Pathname knownServicesPath() const;
141 * Separator string for storing/reading sets of strings to/from
144 const std::string & cacheDBSplitJoinSeparator() const;
147 * Whether repository urls should be probed.
151 bool repo_add_probe() const;
154 * Amount of time in minutes that must pass before another refresh.
156 unsigned repo_refresh_delay() const;
158 /** Whether to consider using a deltarpm when downloading a package.
159 * Config option <tt>download.use_deltarpm (true)</tt>
161 bool download_use_deltarpm() const;
164 * Directory for equivalent vendor definitions (configPath()/vendors.d)
165 * \ingroup g_ZC_CONFIGFILES
167 Pathname vendorPath() const;
170 * Directory for additional product information (configPath()/products.d)
171 * \ingroup g_ZC_CONFIGFILES
173 Pathname productsPath() const;
176 * Solver regards required packages,patterns,... only
178 bool solver_onlyRequires() const;
181 * File in which dependencies described which has to be
182 * fulfilled for a running system.
184 Pathname solver_checkSystemFile() const;
187 * Packages which can be installed parallel with different versions
188 * Returning a set of package names (IdString)
190 std::set<IdString> multiversion() const;
191 void addMultiversion(std::string &name);
192 bool removeMultiversion(std::string &name);
195 * Path where zypp can find or create lock file (configPath()/locks)
196 * \ingroup g_ZC_CONFIGFILES
198 Pathname locksFile() const;
201 * Whether locks file should be read and applied after start
203 bool apply_locks_file() const;
206 * Path where the update items are kept (/var/adm)
208 Pathname update_dataPath() const;
211 * Path where the repo metadata is downloaded and kept (update_dataPath()/).
212 * \ingroup g_ZC_REPOCACHE
214 Pathname update_scriptsPath() const;
217 * Path where the repo solv files are created and kept (update_dataPath()/solv).
218 * \ingroup g_ZC_REPOCACHE
220 Pathname update_messagesPath() const;
230 /** Pointer to implementation */
231 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
233 ///////////////////////////////////////////////////////////////////
235 /////////////////////////////////////////////////////////////////
237 ///////////////////////////////////////////////////////////////////
238 #endif // ZYPP_ZCONFIG_H