libzypp 17.37.10

RepoManagerOptions.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include "RepoManagerOptions.h"
14#include <zypp/ZConfig.h>
15
16 namespace zypp
17{
19 //
20 // class RepoManagerOptions
21 //
23
24 RepoManagerOptions::RepoManagerOptions( const Pathname & root_r )
25 {
26 repoCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoCachePath() );
27 repoRawCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoMetadataPath() );
28 repoSolvCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoSolvfilesPath() );
29 repoPackagesCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoPackagesPath() );
30 knownReposPath = Pathname::assertprefix( root_r, ZConfig::instance().knownReposPath() );
31 knownServicesPath = Pathname::assertprefix( root_r, ZConfig::instance().knownServicesPath() );
32 pluginsPath = Pathname::assertprefix( root_r, ZConfig::instance().pluginsPath() );
33 probe = ZConfig::instance().repo_add_probe();
34
35 rootDir = root_r;
36 }
37
38 RepoManagerOptions RepoManagerOptions::makeTestSetup( const Pathname & root_r )
39 {
40 RepoManagerOptions ret;
41 ret.repoCachePath = root_r;
42 ret.repoRawCachePath = root_r/"raw";
43 ret.repoSolvCachePath = root_r/"solv";
44 ret.repoPackagesCachePath = root_r/"packages";
45 ret.knownReposPath = root_r/"repos.d";
46 ret.knownServicesPath = root_r/"services.d";
47 ret.pluginsPath = root_r/"plugins";
48 ret.rootDir = root_r;
49 return ret;
50 }
51
52 std::ostream & operator<<( std::ostream & str, const RepoManagerOptions & obj )
53 {
54#define OUTS(X) str << " " #X "\t" << obj.X << std::endl
55 str << "RepoManagerOptions (" << obj.rootDir << ") {" << std::endl;
56 OUTS( repoRawCachePath );
57 OUTS( repoSolvCachePath );
58 OUTS( repoPackagesCachePath );
59 OUTS( knownReposPath );
60 OUTS( knownServicesPath );
61 OUTS( pluginsPath );
62 str << "}" << std::endl;
63#undef OUTS
64 return str;
65 }
66}
RepoManagerOptions.h
OUTS
#define OUTS(V)
ZConfig.h
zypp::Pathname::assertprefix
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Definition Pathname.cc:272
zypp::ZConfig::repo_add_probe
bool repo_add_probe() const
Whether repository urls should be probed.
Definition ZConfig.cc:1188
zypp::ZConfig::instance
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:940
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::RepoManagerOptions
Repo manager settings.
Definition RepoManagerOptions.h:26
zypp::RepoManagerOptions::makeTestSetup
static RepoManagerOptions makeTestSetup(const Pathname &root_r)
Test setup adjusting all paths to be located below one root_r directory.
Definition RepoManagerOptions.cc:38
zypp::RepoManagerOptions::repoSolvCachePath
Pathname repoSolvCachePath
Definition RepoManagerOptions.h:53
zypp::RepoManagerOptions::knownReposPath
Pathname knownReposPath
Definition RepoManagerOptions.h:55
zypp::RepoManagerOptions::repoCachePath
Pathname repoCachePath
Definition RepoManagerOptions.h:51
zypp::RepoManagerOptions::pluginsPath
Pathname pluginsPath
Definition RepoManagerOptions.h:57
zypp::RepoManagerOptions::probe
bool probe
Definition RepoManagerOptions.h:58
zypp::RepoManagerOptions::rootDir
Pathname rootDir
remembers root_r value for later use
Definition RepoManagerOptions.h:68
zypp::RepoManagerOptions::knownServicesPath
Pathname knownServicesPath
Definition RepoManagerOptions.h:56
zypp::RepoManagerOptions::repoRawCachePath
Pathname repoRawCachePath
Definition RepoManagerOptions.h:52
zypp::RepoManagerOptions::repoPackagesCachePath
Pathname repoPackagesCachePath
Definition RepoManagerOptions.h:54
zypp::RepoManagerOptions::RepoManagerOptions
RepoManagerOptions(const Pathname &root_r=Pathname())
Default ctor following ZConfig global settings.
Definition RepoManagerOptions.cc:24