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
60 static ZConfig & instance();
64 /** The autodetected system architecture. */
65 static Arch defaultSystemArchitecture();
67 /** The system architecture zypp uses. */
68 Arch systemArchitecture() const;
70 /** Override the zypp system architecture.
71 * This is useful for test scenarious. <b>But be warned</b>, zypp does
72 * not expect the system architecture to change at runtime. So
73 * set it at the verry beginning before you acess any other
76 void setSystemArchitecture( const Arch & arch_r );
78 /** Reset the zypp system architecture to the default. */
79 void resetSystemArchitecture()
80 { setSystemArchitecture( defaultSystemArchitecture() ); }
83 /** The autodetected prefered locale for translated texts.
85 static Locale defaultTextLocale();
87 /** The locale for translated texts zypp uses.
89 Locale textLocale() const;
91 /** Set the prefered locale for translated texts. */
92 void setTextLocale( const Locale & locale_r );
94 /** Reset the locale for translated texts to the default. */
95 void resetTextLocale()
96 { setTextLocale( defaultTextLocale() ); }
100 * Path where the caches are kept (/var/cache/zypp)
101 * \ingroup g_ZC_REPOCACHE
103 Pathname repoCachePath() const;
106 * Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
107 * \ingroup g_ZC_REPOCACHE
109 Pathname repoMetadataPath() const;
112 * Path where the repo solv files are created and kept (repoCachePath()/solv).
113 * \ingroup g_ZC_REPOCACHE
115 Pathname repoSolvfilesPath() const;
118 * Path where the repo packages are downloaded and kept (repoCachePath()/packages).
119 * \ingroup g_ZC_REPOCACHE
121 Pathname repoPackagesPath() const;
124 * Path where the configfiles are kept (/etc/zypp).
125 * \ingroup g_ZC_CONFIGFILES
127 Pathname configPath() const;
130 * Path where the known repositories .repo files are kept (configPath()/repos.d).
131 * \ingroup g_ZC_CONFIGFILES
133 Pathname knownReposPath() const;
136 * Path where the known services .service files are kept (configPath()/services.d).
137 * \ingroup g_ZC_CONFIGFILES
139 Pathname knownServicesPath() const;
142 * Whether repository urls should be probed.
146 bool repo_add_probe() const;
149 * Amount of time in minutes that must pass before another refresh.
151 unsigned repo_refresh_delay() const;
153 /** Whether to consider using a deltarpm when downloading a package.
154 * Config option <tt>download.use_deltarpm (true)</tt>
156 bool download_use_deltarpm() const;
159 * Directory for equivalent vendor definitions (configPath()/vendors.d)
160 * \ingroup g_ZC_CONFIGFILES
162 Pathname vendorPath() const;
165 * Directory for additional product information (configPath()/products.d)
166 * \ingroup g_ZC_CONFIGFILES
168 Pathname productsPath() const;
171 * Solver regards required packages,patterns,... only
173 bool solver_onlyRequires() const;
176 * File in which dependencies described which has to be
177 * fulfilled for a running system.
179 Pathname solver_checkSystemFile() const;
182 * Packages which can be installed parallel with different versions
183 * Returning a set of package names (IdString)
185 std::set<IdString> multiversion() const;
186 void addMultiversion(std::string &name);
187 bool removeMultiversion(std::string &name);
190 * Path where zypp can find or create lock file (configPath()/locks)
191 * \ingroup g_ZC_CONFIGFILES
193 Pathname locksFile() const;
196 * Whether locks file should be read and applied after start (true)
198 bool apply_locks_file() const;
201 * Path where the update items are kept (/var/adm)
203 Pathname update_dataPath() const;
206 * Path where the repo metadata is downloaded and kept (update_dataPath()/).
207 * \ingroup g_ZC_REPOCACHE
209 Pathname update_scriptsPath() const;
212 * Path where the repo solv files are created and kept (update_dataPath()/solv).
213 * \ingroup g_ZC_REPOCACHE
215 Pathname update_messagesPath() const;
217 /** \name Options for package installation */
219 /** The default \ref target::rpm::RpmInstFlags for \ref ZYppCommitPolicy.
220 * Or-combination of \ref target::rpm::RpmInstFlag.
222 * ZConfig.instance().rpmInstallFlags().testFlag( target::rpm::RPMINST_EXCLUDEDOCS );
225 target::rpm::RpmInstFlags rpmInstallFlags() const;
228 Pathname historyLogFile() const;
238 /** Pointer to implementation */
239 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
241 ///////////////////////////////////////////////////////////////////
243 /////////////////////////////////////////////////////////////////
245 ///////////////////////////////////////////////////////////////////
246 #endif // ZYPP_ZCONFIG_H