renamed parallelInstalled by multiversion
[platform/upstream/libzypp.git] / zypp / ZConfig.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ZConfig.h
10  *
11 */
12 #ifndef ZYPP_ZCONFIG_H
13 #define ZYPP_ZCONFIG_H
14
15 #include <iosfwd>
16 #include <set>
17 #include <string>
18
19 #include "zypp/base/Deprecated.h"
20
21 #include "zypp/base/NonCopyable.h"
22 #include "zypp/base/PtrTypes.h"
23
24 #include "zypp/Arch.h"
25 #include "zypp/Locale.h"
26 #include "zypp/Pathname.h"
27 #include "zypp/IdString.h"
28
29 ///////////////////////////////////////////////////////////////////
30 namespace zypp
31 { /////////////////////////////////////////////////////////////////
32
33   ///////////////////////////////////////////////////////////////////
34   //
35   //    CLASS NAME : ZConfig
36   //
37   /** Interim helper class to collect global options and settings.
38    * Use it to avoid hardcoded values and calls to getZYpp() just
39    * to retrieve some value like architecture, languages or tmppath.
40    *
41    * It reads /etc/zypp/zypp.conf, the filename can be overridden by
42    * setting the ZYPP_CONF environment variable to a different file.
43    *
44    * Note, if you add settings to this file, please follow the following
45    * convention:
46    *
47    * namespace.settingname
48    *
49    * should become
50    *
51    * namespace_settingName()
52    *
53    * \ingroup Singleton
54   */
55   class ZConfig : private base::NonCopyable
56   {
57     public:
58       /** Singleton ctor */
59       static ZConfig & instance();
60
61     public:
62
63       /** The autodetected system architecture. */
64       static Arch defaultSystemArchitecture();
65
66       /** The system architecture zypp uses. */
67       Arch systemArchitecture() const;
68
69       /** Override the zypp system architecture.
70        * This is useful for test scenarious. <b>But be warned</b>, zypp does
71        * not expect the system architecture to change at runtime. So
72        * set it at the verry beginning before you acess any other
73        * zypp component.
74       */
75       void setSystemArchitecture( const Arch & arch_r );
76
77       /** Reset the zypp system architecture to the default. */
78       void resetSystemArchitecture()
79       { setSystemArchitecture( defaultSystemArchitecture() ); }
80
81     public:
82       /** The autodetected prefered locale for translated texts.
83        */
84       static Locale defaultTextLocale();
85
86       /** The locale for translated texts zypp uses.
87        */
88       Locale textLocale() const;
89
90       /** Set the prefered locale for translated texts. */
91       void setTextLocale( const Locale & locale_r );
92
93       /** Reset the locale for translated texts to the default. */
94       void resetTextLocale()
95       { setTextLocale( defaultTextLocale() ); }
96
97     public:
98       /**
99        * Path where the caches are kept (/var/cache/zypp)
100        * \ingroup g_ZC_REPOCACHE
101        */
102       Pathname repoCachePath() const;
103
104      /**
105        * Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
106         * \ingroup g_ZC_REPOCACHE
107       */
108       Pathname repoMetadataPath() const;
109
110      /**
111        * Path where the repo solv files are created and kept (repoCachePath()/solv).
112         * \ingroup g_ZC_REPOCACHE
113       */
114       Pathname repoSolvfilesPath() const;
115
116       /**
117        * Path where the repo packages are downloaded and kept (repoCachePath()/packages).
118         * \ingroup g_ZC_REPOCACHE
119       */
120       Pathname repoPackagesPath() const;
121
122       /**
123        * Path where the configfiles are kept (/etc/zypp).
124        * \ingroup g_ZC_CONFIGFILES
125        */
126       Pathname configPath() const;
127
128       /**
129        * Path where the known repositories .repo files are kept (configPath()/repos.d).
130        * \ingroup g_ZC_CONFIGFILES
131        */
132       Pathname knownReposPath() const;
133
134       /**
135        * Path where the known services .service files are kept (configPath()/services.d).
136        * \ingroup g_ZC_CONFIGFILES
137        */
138       Pathname knownServicesPath() const;
139
140       /**
141        * Separator string for storing/reading sets of strings to/from
142        * metadata cache DB.
143        */
144       const std::string & cacheDBSplitJoinSeparator() const;
145
146       /**
147        * Whether repository urls should be probed.
148        / config option
149        * repo.add.probe
150        */
151       bool repo_add_probe() const;
152
153       /**
154        * Amount of time in minutes that must pass before another refresh.
155        */
156       unsigned repo_refresh_delay() const;
157
158       /** Whether to consider using a deltarpm when downloading a package.
159        * Config option <tt>download.use_deltarpm (true)</tt>
160        */
161       bool download_use_deltarpm() const;
162
163       /**
164        * Directory for equivalent vendor definitions  (configPath()/vendors.d)
165        * \ingroup g_ZC_CONFIGFILES
166        */
167       Pathname vendorPath() const;
168
169       /**
170        * Directory for additional product information  (configPath()/products.d)
171        * \ingroup g_ZC_CONFIGFILES
172        */
173       Pathname productsPath() const;
174
175       /**
176        * Solver regards required packages,patterns,... only
177        */
178       bool solver_onlyRequires() const;
179
180       /**
181        * File in which dependencies described which has to be
182        * fulfilled for a running system.
183        */
184       Pathname solver_checkSystemFile() const;
185
186       /**
187        * Packages which can be installed parallel with different versions
188        * Returning a set of package names (IdString)
189        */      
190       std::set<IdString> multiversion() const;
191       void addMultiversion(std::string &name);
192       bool removeMultiversion(std::string &name);      
193
194       /**
195        * Path where zypp can find or create lock file (configPath()/locks)
196        * \ingroup g_ZC_CONFIGFILES
197        */
198       Pathname locksFile() const;
199
200       /**
201        * Whether locks file should be read and applied after start
202        */
203       bool apply_locks_file() const;
204
205       /**
206        * Path where the update items are kept (/var/adm)
207        */
208       Pathname update_dataPath() const;
209
210      /**
211        * Path where the repo metadata is downloaded and kept (update_dataPath()/).
212         * \ingroup g_ZC_REPOCACHE
213       */
214       Pathname update_scriptsPath() const;
215
216      /**
217        * Path where the repo solv files are created and kept (update_dataPath()/solv).
218         * \ingroup g_ZC_REPOCACHE
219       */
220       Pathname update_messagesPath() const;
221
222     public:
223       class Impl;
224       /** Dtor */
225       ~ZConfig();
226     private:
227       friend class Impl;
228       /** Default ctor. */
229       ZConfig();
230       /** Pointer to implementation */
231       RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
232   };
233   ///////////////////////////////////////////////////////////////////
234
235   /////////////////////////////////////////////////////////////////
236 } // namespace zypp
237 ///////////////////////////////////////////////////////////////////
238 #endif // ZYPP_ZCONFIG_H