Imported Upstream version 17.25.4
[platform/upstream/libzypp.git] / zypp / misc / TestcaseSetup.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/misc/TestcaseSetup.h
10  *
11 */
12
13 #ifndef ZYPP_MISC_TESTCASESETUP_H
14 #define ZYPP_MISC_TESTCASESETUP_H
15
16 #include <zypp/Arch.h>
17 #include <zypp/Locale.h>
18 #include <zypp/Pathname.h>
19 #include <zypp/ResolverFocus.h>
20 #include <zypp/Url.h>
21 #include <zypp/base/PtrTypes.h>
22 #include <zypp/base/SetTracker.h>
23 #include <zypp/sat/Queue.h>
24 #include <zypp/target/modalias/Modalias.h>
25
26 #include <optional>
27 #include <vector>
28
29 namespace zypp {
30   class RepoManager;
31 }
32
33 namespace zypp::misc::testcase
34 {
35
36   enum class TestcaseRepoType {
37     Helix,
38     Testtags,
39     Url
40   };
41
42   struct RepoDataImpl;
43   struct ForceInstallImpl;
44   struct TestcaseSetupImpl;
45
46   class RepoData {
47   public:
48     RepoData ();
49     ~RepoData ();
50     RepoData ( RepoDataImpl &&data );
51     TestcaseRepoType type() const;
52     const std::string &alias() const;
53     uint priority() const;
54     const std::string &path() const;
55
56     const RepoDataImpl &data() const;
57     RepoDataImpl &data();
58   private:
59     RWCOW_pointer<RepoDataImpl> _pimpl;
60   };
61
62   class ForceInstall {
63   public:
64     ForceInstall ();
65     ~ForceInstall ();
66     ForceInstall ( ForceInstallImpl &&data );
67     const std::string &channel () const;
68     const std::string &package () const;
69     const std::string &kind () const;
70
71     const ForceInstallImpl &data() const;
72     ForceInstallImpl &data();
73   private:
74     RWCOW_pointer<ForceInstallImpl> _pimpl;
75   };
76
77   class TestcaseSetup
78   {
79   public:
80
81     TestcaseSetup();
82     ~TestcaseSetup();
83
84     Arch architecture () const;
85
86     const std::optional<RepoData> &systemRepo() const;
87     const std::vector<RepoData> &repos() const;
88
89     // solver flags: default to false - set true if mentioned in <setup>
90     ResolverFocus resolverFocus() const;
91
92     const Pathname &globalPath() const;
93     const Pathname &hardwareInfoFile() const;
94     const Pathname &systemCheck() const;
95
96     const target::Modalias::ModaliasList &modaliasList() const;
97     const base::SetTracker<LocaleSet> &localesTracker() const;
98     const std::vector<std::vector<std::string>> &vendorLists() const;
99     const sat::StringQueue &autoinstalled() const;
100     const std::set<std::string> &multiversionSpec() const;
101     const std::vector<ForceInstall> &forceInstallTasks() const;
102
103     bool set_licence() const;
104     bool show_mediaid() const;
105
106     bool ignorealreadyrecommended() const;
107     bool onlyRequires() const;
108     bool forceResolve() const;
109     bool cleandepsOnRemove() const;
110
111     bool allowDowngrade() const;
112     bool allowNameChange() const;
113     bool allowArchChange() const;
114     bool allowVendorChange() const;
115
116     bool dupAllowDowngrade() const;
117     bool dupAllowNameChange() const;
118     bool dupAllowArchChange() const;
119     bool dupAllowVendorChange() const;
120
121     bool applySetup ( zypp::RepoManager &manager ) const;
122
123     static bool loadRepo (zypp::RepoManager &manager, const TestcaseSetup &setup, const RepoData &data );
124
125     TestcaseSetupImpl &data();
126     const TestcaseSetupImpl &data() const;
127
128   private:
129     RWCOW_pointer<TestcaseSetupImpl> _pimpl;
130   };
131
132 }
133
134
135 #endif // ZYPP_MISC_TESTCASESETUPIMPL_H