libzypp 17.38.3
reporthelper.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_NG_REPORTHELPER_INCLUDED
13#define ZYPP_NG_REPORTHELPER_INCLUDED
14
15#include <zypp-core/ng/async/task.h>
17#include <zypp/KeyContext.h>
18#include <zypp/KeyRing.h>
19#include <zypp/Digest.h>
23#include <zypp/ng/context.h>
24
25#include <zypp/ZYppCallbacks.h>
26
27namespace zyppng {
28
30
31 namespace detail {
32 template <typename Report, bool syncAsync >
34
35 template <typename Report>
36 class ReportHolder<Report, true>
37 {};
38
39 template <typename Report>
40 class ReportHolder<Report, false>
41 {
42 public:
43 ReportHolder() : _d( std::make_shared<zypp::callback::SendReport<Report>>() ){}
44
45 ReportHolder(const ReportHolder &) = default;
47 ReportHolder &operator=(const ReportHolder &) = default;
49
50 auto &operator->() {
51 return *_d;
52 }
53
54 std::shared_ptr<zypp::callback::SendReport<Report>> _d;
55 };
56 }
57
59 public:
64
65 const ContextRef &zyppContext() {
66 return _ctx;
67 }
68
69 static constexpr bool async () {
70 return ZYPP_IS_ASYNC;
71 }
72
73 protected:
74 BasicReportHelper( ContextRef &&ctx );
75 ContextRef _ctx;
76 };
77
79 public:
81
82 DigestReportHelper(ContextRef r)
83 : BasicReportHelper(std::move(r)) {}
84
89
90 bool askUserToAcceptNoDigest ( const zypp::Pathname &file );
91 bool askUserToAccepUnknownDigest ( const zypp::Pathname &file, const std::string &name );
92 bool askUserToAcceptWrongDigest ( const zypp::Pathname &file, const std::string &requested, const std::string &found );
93
94 private:
96 };
97
99 public:
101
103 : BasicReportHelper(std::move(r)) {}
104
109
110 // -- Key Ring reports -- //
111
112 bool askUserToAcceptUnsignedFile( const std::string &file, const zypp::KeyContext &keycontext = {} );
113
115
116 bool askUserToAcceptPackageKey( const zypp::PublicKey &key_r, const zypp::KeyContext &keycontext_r = {} );
117
118 void infoVerify( const std::string & file_r, const zypp::PublicKeyData & keyData_r, const zypp::KeyContext &keycontext = {} );
119
120 void reportAutoImportKey( const std::list<zypp::PublicKeyData> & keyDataList_r, const zypp::PublicKeyData & keySigning_r, const zypp::KeyContext &keyContext_r );
121
122 bool askUserToAcceptVerificationFailed( const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &keycontext = {} );
123
124 bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id, const zypp::KeyContext &keycontext = {} );
125
126 private:
128
129 };
130
132 public:
134
135 JobReportHelper(ContextRef r)
136 : BasicReportHelper(std::move(r)) {}
137
142
144 bool debug( std::string msg_r, UserData userData_r = UserData() );
145
147 bool info( std::string msg_r, UserData userData_r = UserData() );
148
150 bool warning( std::string msg_r, UserData userData_r = UserData() );
151
153 bool error( std::string msg_r, UserData userData_r = UserData() );
154
156 bool important( std::string msg_r, UserData userData_r = UserData() );
157
159 bool data( std::string msg_r, UserData userData_r = UserData() );
160
161 };
162}
163
164
165#endif //ZYPP_NG_REPORTHELPER_INCLUDED
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition PublicKey.h:358
BasicReportHelper & operator=(const BasicReportHelper &)=default
const ContextRef & zyppContext()
BasicReportHelper(const BasicReportHelper &)=default
static constexpr bool async()
BasicReportHelper(BasicReportHelper &&)=default
BasicReportHelper & operator=(BasicReportHelper &&)=default
bool askUserToAcceptNoDigest(const zypp::Pathname &file)
DigestReportHelper & operator=(const DigestReportHelper &)=default
DigestReportHelper(DigestReportHelper &&)=default
DigestReportHelper(const DigestReportHelper &)=default
detail::ReportHolder< zypp::DigestReport, Context::isAsync > _report
DigestReportHelper(ContextRef r)
bool askUserToAccepUnknownDigest(const zypp::Pathname &file, const std::string &name)
DigestReportHelper & operator=(DigestReportHelper &&)=default
bool askUserToAcceptWrongDigest(const zypp::Pathname &file, const std::string &requested, const std::string &found)
bool debug(std::string msg_r, UserData userData_r=UserData())
send debug message text
JobReportHelper & operator=(const JobReportHelper &)=default
bool important(std::string msg_r, UserData userData_r=UserData())
send important message text
bool data(std::string msg_r, UserData userData_r=UserData())
send data message
JobReportHelper(ContextRef r)
bool info(std::string msg_r, UserData userData_r=UserData())
send message text
JobReportHelper(JobReportHelper &&)=default
JobReportHelper(const JobReportHelper &)=default
bool error(std::string msg_r, UserData userData_r=UserData())
send error text
JobReportHelper & operator=(JobReportHelper &&)=default
bool warning(std::string msg_r, UserData userData_r=UserData())
send warning text
KeyRingReportHelper & operator=(KeyRingReportHelper &&)=default
bool askUserToAcceptUnsignedFile(const std::string &file, const zypp::KeyContext &keycontext={})
detail::ReportHolder< zypp::KeyRingReport, Context::isAsync > _report
KeyRingReportHelper(ContextRef r)
KeyRingReportHelper(const KeyRingReportHelper &)=default
KeyRingReportHelper(KeyRingReportHelper &&)=default
bool askUserToAcceptPackageKey(const zypp::PublicKey &key_r, const zypp::KeyContext &keycontext_r={})
bool askUserToAcceptUnknownKey(const std::string &file, const std::string &id, const zypp::KeyContext &keycontext={})
bool askUserToAcceptVerificationFailed(const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &keycontext={})
void reportAutoImportKey(const std::list< zypp::PublicKeyData > &keyDataList_r, const zypp::PublicKeyData &keySigning_r, const zypp::KeyContext &keyContext_r)
void infoVerify(const std::string &file_r, const zypp::PublicKeyData &keyData_r, const zypp::KeyContext &keycontext={})
KeyRingReportHelper & operator=(const KeyRingReportHelper &)=default
zypp::KeyRingReport::KeyTrust askUserToAcceptKey(const zypp::PublicKey &key, const zypp::KeyContext &keycontext={})
ReportHolder(const ReportHolder &)=default
ReportHolder & operator=(ReportHolder &&)=default
ReportHolder & operator=(const ReportHolder &)=default
std::shared_ptr< zypp::callback::SendReport< Report > > _d
Definition ansi.h:855
Callbacks light.
Definition Callback.h:146
Easy-to use interface to the ZYPP dependency resolver.
zypp::callback::UserData UserData
Definition userrequest.h:18
KeyTrust
User reply options for the askUserToTrustKey callback.
Definition KeyRing.h:54
#define ZYPP_FWD_DECL_REFS(T)
Definition zyppglobal.h:119