1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZConfig.h
12 #ifndef ZYPP_ZCONFIG_H
13 #define ZYPP_ZCONFIG_H
19 #include "zypp/base/Deprecated.h"
20 #include "zypp/base/NonCopyable.h"
21 #include "zypp/base/PtrTypes.h"
23 #include "zypp/Arch.h"
24 #include "zypp/Locale.h"
25 #include "zypp/Pathname.h"
26 #include "zypp/IdString.h"
28 #include "zypp/target/rpm/RpmFlags.h"
30 ///////////////////////////////////////////////////////////////////
32 { /////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////
36 // CLASS NAME : ZConfig
38 /** Interim helper class to collect global options and settings.
39 * Use it to avoid hardcoded values and calls to getZYpp() just
40 * to retrieve some value like architecture, languages or tmppath.
42 * It reads /etc/zypp/zypp.conf, the filename can be overridden by
43 * setting the ZYPP_CONF environment variable to a different file.
45 * Note, if you add settings to this file, please follow the following
48 * namespace.settingname
52 * namespace_settingName()
56 class ZConfig : private base::NonCopyable
61 static ZConfig & instance();
63 /** Print some detail about the current libzypp version.*/
64 std::ostream & about( std::ostream & str ) const;
68 /** The autodetected system architecture. */
69 static Arch defaultSystemArchitecture();
71 /** The system architecture zypp uses. */
72 Arch systemArchitecture() const;
74 /** Override the zypp system architecture.
75 * This is useful for test scenarious. <b>But be warned</b>, zypp does
76 * not expect the system architecture to change at runtime. So
77 * set it at the verry beginning before you acess any other
80 void setSystemArchitecture( const Arch & arch_r );
82 /** Reset the zypp system architecture to the default. */
83 void resetSystemArchitecture()
84 { setSystemArchitecture( defaultSystemArchitecture() ); }
87 /** The autodetected prefered locale for translated texts.
89 static Locale defaultTextLocale();
91 /** The locale for translated texts zypp uses.
93 Locale textLocale() const;
95 /** Set the prefered locale for translated texts. */
96 void setTextLocale( const Locale & locale_r );
98 /** Reset the locale for translated texts to the default. */
99 void resetTextLocale()
100 { setTextLocale( defaultTextLocale() ); }
104 * Path where the caches are kept (/var/cache/zypp)
105 * \ingroup g_ZC_REPOCACHE
107 Pathname repoCachePath() const;
110 * Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
111 * \ingroup g_ZC_REPOCACHE
113 Pathname repoMetadataPath() const;
116 * Path where the repo solv files are created and kept (repoCachePath()/solv).
117 * \ingroup g_ZC_REPOCACHE
119 Pathname repoSolvfilesPath() const;
122 * Path where the repo packages are downloaded and kept (repoCachePath()/packages).
123 * \ingroup g_ZC_REPOCACHE
125 Pathname repoPackagesPath() const;
128 * Path where the configfiles are kept (/etc/zypp).
129 * \ingroup g_ZC_CONFIGFILES
131 Pathname configPath() const;
134 * Path where the known repositories .repo files are kept (configPath()/repos.d).
135 * \ingroup g_ZC_CONFIGFILES
137 Pathname knownReposPath() const;
140 * Path where the known services .service files are kept (configPath()/services.d).
141 * \ingroup g_ZC_CONFIGFILES
143 Pathname knownServicesPath() const;
146 * Whether repository urls should be probed.
150 bool repo_add_probe() const;
153 * Amount of time in minutes that must pass before another refresh.
155 unsigned repo_refresh_delay() const;
158 * Maximum number of concurrent connections for a single transfer
160 long download_max_concurrent_connections() const;
163 * Minimum download speed (bytes per second)
164 * until the connection is dropped
166 long download_min_download_speed() const;
169 * Maximum download speed (bytes per second)
171 long download_max_download_speed() const;
174 * Maximum silent tries
176 long download_max_silent_tries() const;
179 /** Whether to consider using a deltarpm when downloading a package.
180 * Config option <tt>download.use_deltarpm (true)</tt>
182 bool download_use_deltarpm() const;
184 /** Whether to consider using a deltarpm even when rpm is local.
185 * This requires \ref download_use_deltarpm being \c true.
186 * Config option <tt>download.use_deltarpm.always (false)</tt>
188 bool download_use_deltarpm_always() const;
191 * Hint which media to prefer when installing packages (download vs. CD).
192 * \see class \ref media::MediaPriority
194 bool download_media_prefer_download() const;
196 bool download_media_prefer_volatile() const
197 { return ! download_media_prefer_download(); }
199 * Set \ref download_media_prefer_download to a specific value.
201 void set_download_media_prefer_download( bool yesno_r );
203 * Set \ref download_media_prefer_download to the configfiles default.
205 void set_default_download_media_prefer_download();
208 * Directory for equivalent vendor definitions (configPath()/vendors.d)
209 * \ingroup g_ZC_CONFIGFILES
211 Pathname vendorPath() const;
214 * Solver regards required packages,patterns,... only
216 bool solver_onlyRequires() const;
219 * File in which dependencies described which has to be
220 * fulfilled for a running system.
222 Pathname solver_checkSystemFile() const;
225 * Whether vendor check is by default enabled.
227 bool solver_allowVendorChange() const;
230 * Packages which can be installed parallel with different versions
231 * Returning a set of package names (IdString)
233 std::set<IdString> multiversion() const;
234 void addMultiversion(std::string &name);
235 bool removeMultiversion(std::string &name);
238 * Path where zypp can find or create lock file (configPath()/locks)
239 * \ingroup g_ZC_CONFIGFILES
241 Pathname locksFile() const;
244 * Whether locks file should be read and applied after start (true)
246 bool apply_locks_file() const;
249 * Path where the update items are kept (/var/adm)
251 Pathname update_dataPath() const;
254 * Path where the repo metadata is downloaded and kept (update_dataPath()/).
255 * \ingroup g_ZC_REPOCACHE
257 Pathname update_scriptsPath() const;
260 * Path where the repo solv files are created and kept (update_dataPath()/solv).
261 * \ingroup g_ZC_REPOCACHE
263 Pathname update_messagesPath() const;
265 /** \name Options for package installation */
267 /** The default \ref target::rpm::RpmInstFlags for \ref ZYppCommitPolicy.
268 * Or-combination of \ref target::rpm::RpmInstFlag.
270 * ZConfig.instance().rpmInstallFlags().testFlag( target::rpm::RPMINST_EXCLUDEDOCS );
273 target::rpm::RpmInstFlags rpmInstallFlags() const;
277 * Path where ZYpp install history is logged. Defaults to
278 * /var/log/zypp/history.
280 * \see http://en.opensuse.org/Libzypp/Package_History
282 Pathname historyLogFile() const;
285 * Defaults to /etc/zypp/credentials.d
287 Pathname credentialsGlobalDir() const;
290 * Defaults to /etc/zypp/credentials.cat
292 Pathname credentialsGlobalFile() const;
295 /** Package telling the "product version" on systems not using /etc/product.d/baseproduct.
297 * On RHEL, Fedora and others the "product version" is determined by the first package
298 * providing 'redhat-release'. This value is not hardcoded in YUM and can be configured
299 * with the $distroverpkg variable.
301 * Defaults to 'redhat-release'.
303 std::string distroverpkg() const;
313 /** Pointer to implementation */
314 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
316 ///////////////////////////////////////////////////////////////////
318 /////////////////////////////////////////////////////////////////
320 ///////////////////////////////////////////////////////////////////
321 #endif // ZYPP_ZCONFIG_H