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.
41 * Note, if you add settings to this file, please follow the following
44 * namespace.settingname
48 * namespace_settingName()
52 class ZConfig : private base::NonCopyable
56 static ZConfig & instance();
60 /** The autodetected system architecture. */
61 static Arch defaultSystemArchitecture();
63 /** The system architecture zypp uses. */
64 Arch systemArchitecture() const;
66 /** Override the zypp system architecture.
67 * This is useful for test scenarious. <b>But be warned</b>, zypp does
68 * not expect the system architecture to change at runtime. So
69 * set it at the verry beginning before you acess any other
72 void setSystemArchitecture( const Arch & arch_r );
74 /** Reset the zypp system architecture to the default. */
75 void resetSystemArchitecture()
76 { setSystemArchitecture( defaultSystemArchitecture() ); }
79 /** The autodetected prefered locale for translated texts.
81 static Locale defaultTextLocale();
83 /** The locale for translated texts zypp uses.
85 Locale textLocale() const;
87 /** Set the prefered locale for translated texts. */
88 void setTextLocale( const Locale & locale_r );
90 /** Reset the locale for translated texts to the default. */
91 void resetTextLocale()
92 { setTextLocale( defaultTextLocale() ); }
96 * Path where the caches are kept (/var/cache/zypp)
97 * \ingroup g_ZC_REPOCACHE
99 Pathname repoCachePath() const;
102 * Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
103 * \ingroup g_ZC_REPOCACHE
105 Pathname repoMetadataPath() const;
108 * Path where the repo solv files are created and kept (repoCachePath()/solv).
109 * \ingroup g_ZC_REPOCACHE
111 Pathname repoSolvfilesPath() const;
114 * Path where the repo packages are downloaded and kept (repoCachePath()/packages).
115 * \ingroup g_ZC_REPOCACHE
117 Pathname repoPackagesPath() const;
120 * Path where the configfiles are kept (/etc/zypp).
121 * \ingroup g_ZC_CONFIGFILES
123 Pathname configPath() const;
126 * Path where the known repositories .repo files are kept (configPath()/repos.d).
127 * \ingroup g_ZC_CONFIGFILES
129 Pathname knownReposPath() const;
132 * Path where the known services .service files are kept (configPath()/services.d).
133 * \ingroup g_ZC_CONFIGFILES
135 Pathname knownServicesPath() const;
138 * Separator string for storing/reading sets of strings to/from
141 const std::string & cacheDBSplitJoinSeparator() const;
144 * Whether repository urls should be probed.
148 bool repo_add_probe() const;
151 * Amount of time in minutes that must pass before another refresh.
153 unsigned repo_refresh_delay() const;
155 /** Whether to consider using a deltarpm when downloading a package.
156 * Config option <tt>download.use_deltarpm (true)</tt>
158 bool download_use_deltarpm() const;
161 * Directory for equivalent vendor definitions (configPath()/vendors.d)
162 * \ingroup g_ZC_CONFIGFILES
164 Pathname vendorPath() const;
167 * Directory for additional product information (configPath()/products.d)
168 * \ingroup g_ZC_CONFIGFILES
170 Pathname productsPath() const;
173 * Solver regards required packages,patterns,... only
175 bool solver_onlyRequires() const;
178 * Path where zypp can find or create lock file (configPath()/locks)
179 * \ingroup g_ZC_CONFIGFILES
181 Pathname locksFile() const;
184 * Whether locks file should be read and applied after start
186 bool apply_locks_file() const;
189 * Path where the update items are kept (/var/adm)
191 Pathname update_dataPath() const;
194 * Path where the repo metadata is downloaded and kept (update_dataPath()/).
195 * \ingroup g_ZC_REPOCACHE
197 Pathname update_scriptsPath() const;
200 * Path where the repo solv files are created and kept (update_dataPath()/solv).
201 * \ingroup g_ZC_REPOCACHE
203 Pathname update_messagesPath() const;
213 /** Pointer to implementation */
214 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
216 ///////////////////////////////////////////////////////////////////
218 /////////////////////////////////////////////////////////////////
220 ///////////////////////////////////////////////////////////////////
221 #endif // ZYPP_ZCONFIG_H