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 * Separator string for storing/reading sets of strings to/from
135 const std::string & cacheDBSplitJoinSeparator() const;
138 * Whether repository urls should be probed.
142 bool repo_add_probe() const;
145 * Amount of time in minutes that must pass before another refresh.
147 unsigned repo_refresh_delay() const;
149 /** Whether to consider using a patchrpm when downloading a package.
150 * Config option <tt>download.use_patchrpm (true)</tt>
152 bool download_use_patchrpm() const;
154 /** Whether to consider using a deltarpm when downloading a package.
155 * Config option <tt>download.use_deltarpm (true)</tt>
157 bool download_use_deltarpm() const;
160 * Directory for equivalent vendor definitions (configPath()/vendors.d)
161 * \ingroup g_ZC_CONFIGFILES
163 Pathname vendorPath() const;
166 * Directory for additional product information (configPath()/products.d)
167 * \ingroup g_ZC_CONFIGFILES
169 Pathname productsPath() const;
172 * Solver regards required packages,patterns,... only
174 bool solver_onlyRequires() const;
177 * Path where zypp can find or create lock file (configPath()/locks)
178 * \ingroup g_ZC_CONFIGFILES
180 Pathname locksFile() const;
183 * Whether locks file should be read and applied after start
185 bool apply_locks_file() const;
188 * Path where the update items are kept (/var/adm)
190 Pathname update_dataPath() const;
193 * Path where the repo metadata is downloaded and kept (update_dataPath()/).
194 * \ingroup g_ZC_REPOCACHE
196 Pathname update_scriptsPath() const;
199 * Path where the repo solv files are created and kept (update_dataPath()/solv).
200 * \ingroup g_ZC_REPOCACHE
202 Pathname update_messagesPath() const;
212 /** Pointer to implementation */
213 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
215 ///////////////////////////////////////////////////////////////////
217 /////////////////////////////////////////////////////////////////
219 ///////////////////////////////////////////////////////////////////
220 #endif // ZYPP_ZCONFIG_H