remove patchrpm handling
[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
17 #include "zypp/base/Deprecated.h"
18
19 #include "zypp/base/NonCopyable.h"
20 #include "zypp/base/PtrTypes.h"
21
22 #include "zypp/Arch.h"
23 #include "zypp/Locale.h"
24 #include "zypp/Pathname.h"
25
26 ///////////////////////////////////////////////////////////////////
27 namespace zypp
28 { /////////////////////////////////////////////////////////////////
29
30   ///////////////////////////////////////////////////////////////////
31   //
32   //    CLASS NAME : ZConfig
33   //
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.
37    *
38    * It reads /etc/zypp/zypp.conf, the filename can be overridden by
39    * setting the ZYPP_CONF environment variable to a different file.
40    *
41    * Note, if you add settings to this file, please follow the following
42    * convention:
43    *
44    * namespace.settingname
45    *
46    * should become
47    *
48    * namespace_settingName()
49    *
50    * \ingroup Singleton
51   */
52   class ZConfig : private base::NonCopyable
53   {
54     public:
55       /** Singleton ctor */
56       static ZConfig & instance();
57
58     public:
59
60       /** The autodetected system architecture. */
61       static Arch defaultSystemArchitecture();
62
63       /** The system architecture zypp uses. */
64       Arch systemArchitecture() const;
65
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
70        * zypp component.
71       */
72       void setSystemArchitecture( const Arch & arch_r );
73
74       /** Reset the zypp system architecture to the default. */
75       void resetSystemArchitecture()
76       { setSystemArchitecture( defaultSystemArchitecture() ); }
77
78     public:
79       /** The autodetected prefered locale for translated texts.
80        */
81       static Locale defaultTextLocale();
82
83       /** The locale for translated texts zypp uses.
84        */
85       Locale textLocale() const;
86
87       /** Set the prefered locale for translated texts. */
88       void setTextLocale( const Locale & locale_r );
89
90       /** Reset the locale for translated texts to the default. */
91       void resetTextLocale()
92       { setTextLocale( defaultTextLocale() ); }
93
94     public:
95       /**
96        * Path where the caches are kept (/var/cache/zypp)
97        * \ingroup g_ZC_REPOCACHE
98        */
99       Pathname repoCachePath() const;
100
101      /**
102        * Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
103         * \ingroup g_ZC_REPOCACHE
104       */
105       Pathname repoMetadataPath() const;
106
107      /**
108        * Path where the repo solv files are created and kept (repoCachePath()/solv).
109         * \ingroup g_ZC_REPOCACHE
110       */
111       Pathname repoSolvfilesPath() const;
112
113       /**
114        * Path where the repo packages are downloaded and kept (repoCachePath()/packages).
115         * \ingroup g_ZC_REPOCACHE
116       */
117       Pathname repoPackagesPath() const;
118
119       /**
120        * Path where the configfiles are kept (/etc/zypp).
121        * \ingroup g_ZC_CONFIGFILES
122        */
123       Pathname configPath() const;
124
125       /**
126        * Path where the known repositories .repo files are kept (configPath()/repos.d).
127        * \ingroup g_ZC_CONFIGFILES
128        */
129       Pathname knownReposPath() const;
130
131       /**
132        * Path where the known services .service files are kept (configPath()/services.d).
133        * \ingroup g_ZC_CONFIGFILES
134        */
135       Pathname knownServicesPath() const;
136
137       /**
138        * Separator string for storing/reading sets of strings to/from
139        * metadata cache DB.
140        */
141       const std::string & cacheDBSplitJoinSeparator() const;
142
143       /**
144        * Whether repository urls should be probed.
145        / config option
146        * repo.add.probe
147        */
148       bool repo_add_probe() const;
149
150       /**
151        * Amount of time in minutes that must pass before another refresh.
152        */
153       unsigned repo_refresh_delay() const;
154
155       /** Whether to consider using a deltarpm when downloading a package.
156        * Config option <tt>download.use_deltarpm (true)</tt>
157        */
158       bool download_use_deltarpm() const;
159
160       /**
161        * Directory for equivalent vendor definitions  (configPath()/vendors.d)
162        * \ingroup g_ZC_CONFIGFILES
163        */
164       Pathname vendorPath() const;
165
166       /**
167        * Directory for additional product information  (configPath()/products.d)
168        * \ingroup g_ZC_CONFIGFILES
169        */
170       Pathname productsPath() const;
171
172       /**
173        * Solver regards required packages,patterns,... only
174        */
175       bool solver_onlyRequires() const;
176
177       /**
178        * Path where zypp can find or create lock file (configPath()/locks)
179        * \ingroup g_ZC_CONFIGFILES
180        */
181       Pathname locksFile() const;
182
183       /**
184        * Whether locks file should be read and applied after start
185        */
186       bool apply_locks_file() const;
187
188       /**
189        * Path where the update items are kept (/var/adm)
190        */
191       Pathname update_dataPath() const;
192
193      /**
194        * Path where the repo metadata is downloaded and kept (update_dataPath()/).
195         * \ingroup g_ZC_REPOCACHE
196       */
197       Pathname update_scriptsPath() const;
198
199      /**
200        * Path where the repo solv files are created and kept (update_dataPath()/solv).
201         * \ingroup g_ZC_REPOCACHE
202       */
203       Pathname update_messagesPath() const;
204
205     public:
206       class Impl;
207       /** Dtor */
208       ~ZConfig();
209     private:
210       friend class Impl;
211       /** Default ctor. */
212       ZConfig();
213       /** Pointer to implementation */
214       RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
215   };
216   ///////////////////////////////////////////////////////////////////
217
218   /////////////////////////////////////////////////////////////////
219 } // namespace zypp
220 ///////////////////////////////////////////////////////////////////
221 #endif // ZYPP_ZCONFIG_H