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 * Directory for additional product information (configPath()/products.d)
215 * \ingroup g_ZC_CONFIGFILES
216 * \deprecated This locations is no longer used or supported.
218 Pathname productsPath() const ZYPP_DEPRECATED;
221 * Solver regards required packages,patterns,... only
223 bool solver_onlyRequires() const;
226 * File in which dependencies described which has to be
227 * fulfilled for a running system.
229 Pathname solver_checkSystemFile() const;
232 * Packages which can be installed parallel with different versions
233 * Returning a set of package names (IdString)
235 std::set<IdString> multiversion() const;
236 void addMultiversion(std::string &name);
237 bool removeMultiversion(std::string &name);
240 * Path where zypp can find or create lock file (configPath()/locks)
241 * \ingroup g_ZC_CONFIGFILES
243 Pathname locksFile() const;
246 * Whether locks file should be read and applied after start (true)
248 bool apply_locks_file() const;
251 * Path where the update items are kept (/var/adm)
253 Pathname update_dataPath() const;
256 * Path where the repo metadata is downloaded and kept (update_dataPath()/).
257 * \ingroup g_ZC_REPOCACHE
259 Pathname update_scriptsPath() const;
262 * Path where the repo solv files are created and kept (update_dataPath()/solv).
263 * \ingroup g_ZC_REPOCACHE
265 Pathname update_messagesPath() const;
267 /** \name Options for package installation */
269 /** The default \ref target::rpm::RpmInstFlags for \ref ZYppCommitPolicy.
270 * Or-combination of \ref target::rpm::RpmInstFlag.
272 * ZConfig.instance().rpmInstallFlags().testFlag( target::rpm::RPMINST_EXCLUDEDOCS );
275 target::rpm::RpmInstFlags rpmInstallFlags() const;
279 * Path where ZYpp install history is logged. Defaults to
280 * /var/log/zypp/history.
282 * \see http://en.opensuse.org/Libzypp/Package_History
284 Pathname historyLogFile() const;
287 * Defaults to /etc/zypp/credentials.d
289 Pathname credentialsGlobalDir() const;
292 * Defaults to /etc/zypp/credentials.cat
294 Pathname credentialsGlobalFile() const;
304 /** Pointer to implementation */
305 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
307 ///////////////////////////////////////////////////////////////////
309 /////////////////////////////////////////////////////////////////
311 ///////////////////////////////////////////////////////////////////
312 #endif // ZYPP_ZCONFIG_H