14 #include <zypp/base/Logger.h> 15 #include <zypp/base/String.h> 16 #include <zypp/base/Regex.h> 18 #include <zypp/ExternalProgram.h> 19 #include <zypp/AutoDispose.h> 20 #include <zypp/PathInfo.h> 21 #include <zypp/TriBool.h> 28 namespace applydeltarpm
35 const Pathname applydeltarpm_prog(
"/usr/bin/applydeltarpm" );
36 const str::regex applydeltarpm_tick (
"([0-9]+) percent finished" );
43 bool applydeltarpm(
const char *
const argv_r[],
48 for ( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() )
52 report_r( str::strtonum<unsigned>( what[1] ) );
55 DBG <<
"Applydeltarpm : " << line;
57 return( prog.close() == 0 );
72 static TriBool _last = indeterminate;
74 bool have = prog.
isX();
81 MIL <<
"Found executable " << prog << endl;
83 WAR <<
"No executable " << prog << endl;
85 return (
bool ) _last;
93 bool check(
const std::string & sequenceinfo_r,
bool quick_r )
98 const char *
const argv[] = {
99 "/usr/bin/applydeltarpm",
100 ( quick_r ?
"-C" :
"-c" ),
101 "-s", sequenceinfo_r.c_str(),
105 return( applydeltarpm( argv ) );
118 const char *
const argv[] = {
119 "/usr/bin/applydeltarpm",
120 ( quick_r ?
"-C" :
"-c" ),
125 return( applydeltarpm( argv ) );
142 const char *
const argv[] = {
143 "/usr/bin/applydeltarpm",
151 if ( ! applydeltarpm( argv, report_r ) )
173 const char *
const argv[] = {
174 "/usr/bin/applydeltarpm",
183 if ( ! applydeltarpm( argv, report_r ) )
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
bool haveApplydeltarpm()
Test whether an execuatble applydeltarpm program is available.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
int unlink(const Pathname &path)
Like 'unlink'.
const std::string & asString() const
String representation.
Pathname dirname() const
Return all but the last component od this path.
void resetDispose()
Set no dispose function.
Wrapper class for ::stat/::lstat.
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
regex ZYPP_STR_REGEX regex ZYPP_STR_REGEX
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
function< void(unsigned)> Progress
progress reporting
Easy-to use interface to the ZYPP dependency resolver.
bool provide(const Pathname &delta_r, const Pathname &new_r, const Progress &report_r)
Apply a binary delta to on-disk data to re-create a new rpm.