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;
73 PathInfo prog( applydeltarpm_prog );
74 bool have = prog.isX();
81 MIL <<
"Found executable " << prog << endl;
83 WAR <<
"No executable " << prog << endl;
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 ) );
113 bool check(
const Pathname & delta_r,
bool quick_r )
118 const char *
const argv[] = {
119 "/usr/bin/applydeltarpm",
120 ( quick_r ?
"-C" :
"-c" ),
121 delta_r.asString().c_str(),
125 return( applydeltarpm( argv ) );
133 bool provide(
const Pathname & delta_r,
const Pathname & new_r,
142 const char *
const argv[] = {
143 "/usr/bin/applydeltarpm",
145 delta_r.asString().c_str(),
146 new_r.asString().c_str(),
150 if ( ! applydeltarpm( argv, report_r ) )
162 bool provide(
const Pathname & old_r,
const Pathname & delta_r,
163 const Pathname & new_r,
172 const char *
const argv[] = {
173 "/usr/bin/applydeltarpm",
175 "-r", old_r.asString().c_str(),
176 delta_r.asString().c_str(),
177 new_r.asString().c_str(),
181 if ( ! applydeltarpm( argv, report_r ) )
void resetDispose()
Set no dispose function.
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'.
Reference counted access to a _Tp object calling a custom Dispose function when the last AutoDispose ...
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
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.