libzypp 17.38.15

TestcaseSetup.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#ifndef ZYPP_MISC_TESTCASESETUP_H
14#define ZYPP_MISC_TESTCASESETUP_H
15
16#include <zypp/Arch.h>
17#include <zypp-core/Globals.h>
18#include <zypp-core/base/Flags.h>
19#include <zypp/Locale.h>
20#include <zypp-core/Pathname.h>
21#include <zypp/ResolverFocus.h>
22#include <zypp-core/Url.h>
23#include <zypp-core/base/PtrTypes.h>
24#include <zypp/base/SetTracker.h>
25#include <zypp/sat/Queue.h>
26#include <zypp/target/modalias/Modalias.h>
27
28#include <map>
29#include <optional>
30#include <string>
31#include <vector>
32
33 namespace zypp {
34 class RepoManager;
35 class ResPool;
36}
37
38 namespace zypp::misc::testcase
39{
40
41 enum class TestcaseRepoType {
42 Helix,
43 Testtags,
44 Url
45 };
46
47 struct RepoDataImpl;
48 struct ForceInstallImpl;
49 struct TestcaseSetupImpl;
50
51 class RepoData {
52 public:
53 RepoData ();
54 ~RepoData ();
55 RepoData ( RepoDataImpl &&data );
56 TestcaseRepoType type() const;
57 const std::string &alias() const;
58 uint priority() const;
59 const std::string &path() const;
60
61 const RepoDataImpl &data() const;
62 RepoDataImpl &data();
63 private:
64 RWCOW_pointer<RepoDataImpl> _pimpl;
65 };
66
67 class ZYPP_API_DEPTESTOMATIC ForceInstall {
68 public:
69 ForceInstall ();
70 ~ForceInstall ();
71 ForceInstall ( ForceInstallImpl &&data );
72 const std::string &channel () const;
73 const std::string &package () const;
74 const std::string &kind () const;
75
76 const ForceInstallImpl &data() const;
77 ForceInstallImpl &data();
78 private:
79 RWCOW_pointer<ForceInstallImpl> _pimpl;
80 };
81
92 enum ApplySetupFlag {
93 AS_REPOS_ONLY = 0,
94 AS_SOLVER_FLAGS = (1 << 0),
95 AS_LOCALES = (1 << 1),
96 AS_AUTOINSTALLED = (1 << 2),
97 AS_VENDOR_LISTS = (1 << 3),
98 AS_MODALIAS = (1 << 4),
99 AS_MULTIVERSION = (1 << 5),
100 AS_LOCKS = (1 << 6),
105 AS_UNIVERSE = AS_LOCALES | AS_AUTOINSTALLED | AS_VENDOR_LISTS | AS_MODALIAS | AS_MULTIVERSION | AS_LOCKS,
106 AS_ALL = ~0
107 };
108 ZYPP_DECLARE_FLAGS_AND_OPERATORS( ApplySetupFlags, ApplySetupFlag );
109
110 class ZYPP_API_DEPTESTOMATIC TestcaseSetup
111 {
112 public:
114 using LockEntry = std::pair<std::string, std::map<std::string,std::string>>;
115
116 TestcaseSetup();
117 ~TestcaseSetup();
118
119 Arch architecture () const;
120
121 const std::optional<RepoData> &systemRepo() const;
122 const std::vector<RepoData> &repos() const;
123
124 // solver flags: default to false - set true if mentioned in <setup>
125 ResolverFocus resolverFocus() const;
126
127 const Pathname &globalPath() const;
128 const Pathname &hardwareInfoFile() const;
129 const Pathname &systemCheck() const;
130
131 const target::Modalias::ModaliasList &modaliasList() const;
132 const base::SetTracker<LocaleSet> &localesTracker() const;
133 const std::vector<std::vector<std::string>> &vendorLists() const;
134 const sat::StringQueue &autoinstalled() const;
135 const std::set<std::string> &multiversionSpec() const;
136 const std::vector<ForceInstall> &forceInstallTasks() const;
137 const std::vector<LockEntry> &locks() const;
138
139 bool set_licence() const;
140 bool show_mediaid() const;
141
142 bool ignorealreadyrecommended() const;
143 bool onlyRequires() const;
144 bool forceResolve() const;
145 bool cleandepsOnRemove() const;
146 bool noUpdateProvide() const;
147
148 bool allowDowngrade() const;
149 bool allowNameChange() const;
150 bool allowArchChange() const;
151 bool allowVendorChange() const;
152
153 bool dupAllowDowngrade() const;
154 bool dupAllowNameChange() const;
155 bool dupAllowArchChange() const;
156 bool dupAllowVendorChange() const;
157
158 bool applySetup ( zypp::RepoManager &manager ) const;
159
165 bool applySetup ( zypp::RepoManager &manager, ApplySetupFlags flags_r ) const;
166
167 static bool loadRepo (zypp::RepoManager &manager, const TestcaseSetup &setup, const RepoData &data );
168
169 TestcaseSetupImpl &data();
170 const TestcaseSetupImpl &data() const;
171
172 private:
173 RWCOW_pointer<TestcaseSetupImpl> _pimpl;
174 };
175}
176
177
178#endif // ZYPP_MISC_TESTCASESETUPIMPL_H
Arch.h
Flags.h
Globals.h
Provides API related macros.
ZYPP_API_DEPTESTOMATIC
#define ZYPP_API_DEPTESTOMATIC
Definition Globals.h:82
Locale.h
Modalias.h
Pathname.h
PtrTypes.h
Queue.h
ResolverFocus.h
SetTracker.h
Url.h
zypp::Arch
Architecture.
Definition Arch.h:37
zypp::RepoManager
creates and provides information about known sources.
Definition RepoManager.h:60
zypp::ResPool
Global ResObject pool.
Definition ResPool.h:62
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::misc::testcase::ForceInstall::_pimpl
RWCOW_pointer< ForceInstallImpl > _pimpl
Definition TestcaseSetup.h:79
zypp::misc::testcase::ForceInstall::package
const std::string & package() const
Definition TestcaseSetup.cc:234
zypp::misc::testcase::ForceInstall::kind
const std::string & kind() const
Definition TestcaseSetup.cc:237
zypp::misc::testcase::ForceInstall::ForceInstall
ForceInstall()
Definition TestcaseSetup.cc:216
zypp::misc::testcase::ForceInstall::channel
const std::string & channel() const
Definition TestcaseSetup.cc:231
zypp::misc::testcase::ForceInstall::data
const ForceInstallImpl & data() const
Definition TestcaseSetup.cc:225
zypp::misc::testcase::RepoData
Definition TestcaseSetup.h:51
zypp::misc::testcase::RepoData::data
const RepoDataImpl & data() const
Definition TestcaseSetup.cc:210
zypp::misc::testcase::RepoData::type
TestcaseRepoType type() const
Definition TestcaseSetup.cc:198
zypp::misc::testcase::RepoData::priority
uint priority() const
Definition TestcaseSetup.cc:204
zypp::misc::testcase::RepoData::RepoData
RepoData()
Definition TestcaseSetup.cc:189
zypp::misc::testcase::RepoData::_pimpl
RWCOW_pointer< RepoDataImpl > _pimpl
Definition TestcaseSetup.h:64
zypp::misc::testcase::RepoData::path
const std::string & path() const
Definition TestcaseSetup.cc:207
zypp::misc::testcase::RepoData::alias
const std::string & alias() const
Definition TestcaseSetup.cc:201
zypp::misc::testcase::TestcaseSetup::architecture
Arch architecture() const
Definition TestcaseSetup.cc:246
zypp::misc::testcase::TestcaseSetup::repos
const std::vector< RepoData > & repos() const
Definition TestcaseSetup.cc:252
zypp::misc::testcase::TestcaseSetup::applySetup
bool applySetup(zypp::RepoManager &manager) const
Definition TestcaseSetup.cc:333
zypp::misc::testcase::TestcaseSetup::resolverFocus
ResolverFocus resolverFocus() const
Definition TestcaseSetup.cc:255
zypp::misc::testcase::TestcaseSetup::onlyRequires
bool onlyRequires() const
Definition TestcaseSetup.cc:297
zypp::misc::testcase::TestcaseSetup::modaliasList
const target::Modalias::ModaliasList & modaliasList() const
Definition TestcaseSetup.cc:267
zypp::misc::testcase::TestcaseSetup::noUpdateProvide
bool noUpdateProvide() const
Definition TestcaseSetup.cc:306
zypp::misc::testcase::TestcaseSetup::forceInstallTasks
const std::vector< ForceInstall > & forceInstallTasks() const
Definition TestcaseSetup.cc:282
zypp::misc::testcase::TestcaseSetup::systemRepo
const std::optional< RepoData > & systemRepo() const
Definition TestcaseSetup.cc:249
zypp::misc::testcase::TestcaseSetup::vendorLists
const std::vector< std::vector< std::string > > & vendorLists() const
Definition TestcaseSetup.cc:273
zypp::misc::testcase::TestcaseSetup::multiversionSpec
const std::set< std::string > & multiversionSpec() const
Definition TestcaseSetup.cc:279
zypp::misc::testcase::TestcaseSetup::dupAllowVendorChange
bool dupAllowVendorChange() const
Definition TestcaseSetup.cc:330
zypp::misc::testcase::TestcaseSetup::_pimpl
RWCOW_pointer< TestcaseSetupImpl > _pimpl
Definition TestcaseSetup.h:173
zypp::misc::testcase::TestcaseSetup::allowNameChange
bool allowNameChange() const
Definition TestcaseSetup.cc:312
zypp::misc::testcase::TestcaseSetup::autoinstalled
const sat::StringQueue & autoinstalled() const
Definition TestcaseSetup.cc:276
zypp::misc::testcase::TestcaseSetup::allowDowngrade
bool allowDowngrade() const
Definition TestcaseSetup.cc:309
zypp::misc::testcase::TestcaseSetup::loadRepo
static bool loadRepo(zypp::RepoManager &manager, const TestcaseSetup &setup, const RepoData &data)
Definition TestcaseSetup.cc:372
zypp::misc::testcase::TestcaseSetup::systemCheck
const Pathname & systemCheck() const
Definition TestcaseSetup.cc:264
zypp::misc::testcase::TestcaseSetup::LockEntry
std::pair< std::string, std::map< std::string, std::string > > LockEntry
lock/keep node data extracted from trial nodes and applied as pool setup.
Definition TestcaseSetup.h:114
zypp::misc::testcase::TestcaseSetup::data
TestcaseSetupImpl & data()
Definition TestcaseSetup.cc:456
zypp::misc::testcase::TestcaseSetup::set_licence
bool set_licence() const
Definition TestcaseSetup.cc:288
zypp::misc::testcase::TestcaseSetup::dupAllowNameChange
bool dupAllowNameChange() const
Definition TestcaseSetup.cc:324
zypp::misc::testcase::TestcaseSetup::allowArchChange
bool allowArchChange() const
Definition TestcaseSetup.cc:315
zypp::misc::testcase::TestcaseSetup::cleandepsOnRemove
bool cleandepsOnRemove() const
Definition TestcaseSetup.cc:303
zypp::misc::testcase::TestcaseSetup::show_mediaid
bool show_mediaid() const
Definition TestcaseSetup.cc:291
zypp::misc::testcase::TestcaseSetup::forceResolve
bool forceResolve() const
Definition TestcaseSetup.cc:300
zypp::misc::testcase::TestcaseSetup::globalPath
const Pathname & globalPath() const
Definition TestcaseSetup.cc:258
zypp::misc::testcase::TestcaseSetup::hardwareInfoFile
const Pathname & hardwareInfoFile() const
Definition TestcaseSetup.cc:261
zypp::misc::testcase::TestcaseSetup::ignorealreadyrecommended
bool ignorealreadyrecommended() const
Definition TestcaseSetup.cc:294
zypp::misc::testcase::TestcaseSetup::allowVendorChange
bool allowVendorChange() const
Definition TestcaseSetup.cc:318
zypp::misc::testcase::TestcaseSetup::TestcaseSetup
TestcaseSetup()
Definition TestcaseSetup.cc:240
zypp::misc::testcase::TestcaseSetup::localesTracker
const base::SetTracker< LocaleSet > & localesTracker() const
Definition TestcaseSetup.cc:270
zypp::misc::testcase::TestcaseSetup::dupAllowArchChange
bool dupAllowArchChange() const
Definition TestcaseSetup.cc:327
zypp::misc::testcase::TestcaseSetup::locks
const std::vector< LockEntry > & locks() const
Definition TestcaseSetup.cc:285
zypp::misc::testcase::TestcaseSetup::dupAllowDowngrade
bool dupAllowDowngrade() const
Definition TestcaseSetup.cc:321
zypp::target::Modalias::ModaliasList
std::vector< std::string > ModaliasList
Definition Modalias.h:45
zypp::misc::testcase
Definition LoadTestcase.cc:19
zypp::misc::testcase::ApplySetupFlag
ApplySetupFlag
Bits controlling how much of the testcase setup is applied.
Definition TestcaseSetup.h:92
zypp::misc::testcase::AS_VENDOR_LISTS
@ AS_VENDOR_LISTS
VendorAttr vendor-equivalence lists.
Definition TestcaseSetup.h:97
zypp::misc::testcase::AS_AUTOINSTALLED
@ AS_AUTOINSTALLED
setAutoInstalled
Definition TestcaseSetup.h:96
zypp::misc::testcase::AS_SOLVER_FLAGS
@ AS_SOLVER_FLAGS
Resolver flags, focus, DUP flags.
Definition TestcaseSetup.h:94
zypp::misc::testcase::AS_MODALIAS
@ AS_MODALIAS
Modalias list.
Definition TestcaseSetup.h:98
zypp::misc::testcase::AS_UNIVERSE
@ AS_UNIVERSE
Package universe without solver opinions: repos, locales, autoinstalled, vendor lists,...
Definition TestcaseSetup.h:105
zypp::misc::testcase::AS_LOCKS
@ AS_LOCKS
lock/keep nodes extracted from trial nodes
Definition TestcaseSetup.h:100
zypp::misc::testcase::AS_MULTIVERSION
@ AS_MULTIVERSION
ZConfig multiversion spec.
Definition TestcaseSetup.h:99
zypp::misc::testcase::AS_LOCALES
@ AS_LOCALES
initRequestedLocales + setRequestedLocales
Definition TestcaseSetup.h:95
zypp::misc::testcase::AS_ALL
@ AS_ALL
Apply everything (full fidelity replay).
Definition TestcaseSetup.h:106
zypp::misc::testcase::AS_REPOS_ONLY
@ AS_REPOS_ONLY
Only arch, repos, hardware-info (historic default).
Definition TestcaseSetup.h:93
zypp::misc::testcase::ZYPP_DECLARE_FLAGS_AND_OPERATORS
ZYPP_DECLARE_FLAGS_AND_OPERATORS(ApplySetupFlags, ApplySetupFlag)
zypp::misc::testcase::TestcaseRepoType
TestcaseRepoType
Definition TestcaseSetup.h:41
zypp::misc::testcase::TestcaseRepoType::Helix
@ Helix
Definition TestcaseSetup.h:42
zypp::misc::testcase::TestcaseRepoType::Testtags
@ Testtags
Definition TestcaseSetup.h:43
zypp::sat::StringQueue
Queue StringQueue
Queue with String ids.
Definition Queue.h:28
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::ResolverFocus
ResolverFocus
The resolver's general attitude.
Definition ResolverFocus.h:24
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
zypp::base::SetTracker
Track added/removed set items based on an initial set.
Definition SetTracker.h:39
zypp::misc::testcase::ForceInstallImpl
Definition TestcaseSetupImpl.h:34
zypp::misc::testcase::RepoDataImpl
Definition TestcaseSetupImpl.h:25
zypp::misc::testcase::TestcaseSetupImpl
Definition TestcaseSetupImpl.h:43