16#include <zypp/Globals.h>
17#include <zypp/PathInfo.h>
19#include <zypp/ExternalProgram.h>
20#include <zypp/base/LogTools.h>
45 prog_r.setBlocking(
false );
53 case io::ReceiveUpToResult::Success:
58 case io::ReceiveUpToResult::Timeout:
62 case io::ReceiveUpToResult::Error:
63 case io::ReceiveUpToResult::EndOfFile:
72 WAR <<
"ABORT by callback: pid " <<
prog_r.getpid() << endl;
90 return cb_r ?
cb_r( std::nullopt ) :
true;
155 if (
pi.isFile() &&
pi.userMayRX() ) {
171 if (
pi.isFile() &&
pi.userMayRX() )
184 INT <<
"chroot PluginRepoverification does not yet work." << endl;
191 args.push_back(
"--file" );
192 args.push_back(
file_r.asString() );
193 args.push_back(
"--fsig" );
194 args.push_back(
data_r._sigpathLocal.asString() );
195 args.push_back(
"--fkey" );
196 args.push_back(
data_r._keypathLocal.asString() );
197 args.push_back(
"--ralias" );
198 args.push_back(
data_r._repoinfo.alias() );
209 std::optional<std::ostringstream>
buffer;
212 buffer = std::ostringstream();
227 const std::string & msg {
str::Format(
"Metadata rejected by '%1%' plugin (returned %2%)" ) %
plugin_r %
ret };
248 {
return str <<
"PluginRepoverification::Impl"; }
274 {
return _pimpl->isNeeded(); }
277 {
return _pimpl->checkIfNeeded(); }
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
shared_ptr< Impl > _pimpl
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
std::vector< std::string > Arguments
What is known about a repository.
Remember a files attributes to detect content changes.
const Pathname & path() const
Wrapper class for stat/lstat.
static Pathname stripprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r with any root_r dir prefix striped.
bool emptyOrRoot() const
Test for "" or "/".
const std::string & asString() const
String representation.
Exceptiontype thrown if a plugins verification fails.
PluginRepoverification::Checker data storage.
Impl(RW_pointer< PluginRepoverification::Impl > parent_r, Pathname sigpathLocal_r, Pathname keypathLocal_r, const RepoInfo &repo_r)
RW_pointer< PluginRepoverification::Impl > _parent
FileChecker checking all repoverification plugins.
void operator()(const Pathname &file_r) const
Check the downloaded master index file.
PluginRepoverification implementation.
void pluginVerify(std::string plugin_r, const Pathname &file_r, const PluginRepoverification::Checker::Impl &data_r) const
Impl(Pathname plugindir_r, Pathname chroot_r)
const Pathname & plugindir() const
friend std::ostream & operator<<(std::ostream &str, const Impl &obj)
std::ostream & operator<<(std::ostream &str, const PluginRepoverification::Impl &obj)
Stream output.
void verifyWorkflow(const Pathname &file_r, RW_pointer< PluginRepoverification::Checker::Impl > datap_r) const
WatchFile _watchPlugindir
friend std::ostream & dumpOn(std::ostream &str, const Impl &obj)
std::ostream & dumpOn(std::ostream &str, const PluginRepoverification::Impl &obj)
Verbose stream output.
Repository metadata verification beyond GPG.
PluginRepoverification()
Default ctor, do nothing.
bool isNeeded() const
Whether the last checkIfNeeded found plugins to execute at all.
Checker getChecker(const Pathname &sigpathLocal_r, const Pathname &keypathLocal_r, const RepoInfo &repo_r) const
FileChecker factory remembering the location of the master index files GPG signature and key.
bool checkIfNeeded()
Checks whether there are plugins to execute at all.
RW_pointer< Impl > _pimpl
Implementation class.
~PluginRepoverification()
Dtor.
String related utilities and Regular expression matching.
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
std::pair< ReceiveUpToResult, std::string > receiveUpto(FILE *file, char c, timeout_type timeout, bool failOnUnblockError)
static constexpr timeout_type no_timeout
std::ostream & operator<<(std::ostream &str, const DeltaCandidates &obj)
bool operator==(const RepoType &obj1, const RepoType &obj2)
std::string numstring(char n, int w=0)
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
JobReport convenience sending this instance of UserData with each message.
bool reportFinalLineUnlessEmpty(std::string &line_r, Callback &cb_r)
Monitor(io::timeout_type timeout_r=io::no_timeout)
bool reportTimeout(Callback &cb_r)
int operator()(ExternalProgram &prog_r, Callback cb_r=Callback())
bool reportLine(std::string &line_r, Callback &cb_r)
io::timeout_type _timeout
std::function< bool(std::optional< std::string >)> Callback
Report a line of output (without trailing NL) otherwise a life ping on timeout.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.