26 #undef ZYPP_BASE_LOGGER_LOGGROUP
27 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::posttrans"
57 std::string prog( pkg->tag_posttransprog() );
58 if ( prog.empty() || prog ==
"<lua>" )
65 std::ofstream out( script.
path().
c_str() );
66 out <<
"#! " << pkg->tag_posttransprog() << endl
67 << pkg->tag_posttrans() << endl;
86 for (
const auto & script :
_scripts )
88 MIL <<
"EXECUTE posttrans: " << script << endl;
95 collect <<
" " << line;
97 int ret = prog.
close();
98 const std::string & scriptmsg( collect );
100 if ( ret != 0 || ! scriptmsg.empty() )
102 const std::string & pkgident( script.substr( 0, script.size()-6 ) );
104 if ( ! scriptmsg.empty() )
107 msg <<
"Output of " << pkgident <<
" %posttrans script:\n" << scriptmsg;
108 historylog.
comment( msg,
true );
115 msg << pkgident <<
" %posttrans script failed (returned " << ret <<
")";
117 historylog.
comment( msg,
true );
134 msg <<
"%posttrans scripts skipped while aborting:\n";
135 for (
const auto & script :
_scripts )
137 const std::string & pkgident( script.substr( 0, script.size()-6 ) );
138 WAR <<
"UNEXECUTED posttrans: " << script << endl;
139 msg <<
" " << pkgident <<
"\n";
142 historylog.
comment( msg,
true );
165 {
return str <<
"RpmPostTransCollector::Impl"; }
169 {
return str << obj; }
178 : _pimpl( new
Impl( root_r ) )
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
int close()
Wait for the progamm to complete.
Writing the zypp history file.
void comment(const std::string &comment, bool timestamp=false)
Log a comment (even multiline).
static ZConfig & instance()
Singleton ctor.
std::string receiveLine()
Read one line from the input stream.
Wrapper class for ::stat/::lstat.
std::string basename() const
Return the last component of this path.
const char * c_str() const
String representation.
Provide a new empty temporary directory and recursively delete it when no longer needed.
Provide a new empty temporary file and delete it when no longer needed.
bool autoCleanup() const
Whether path is valid and deleted when the last reference drops.
RpmPostTransCollector implementation.
void discardScripts()
Discard all remembered scrips.
boost::scoped_ptr< filesystem::TmpDir > _ptrTmpdir
Pathname tmpDir()
Lazy create tmpdir on demand.
friend std::ostream & dumpOn(std::ostream &str, const Impl &obj)
bool collectScriptFromPackage(ManagedFile rpmPackage_r)
Extract and remember a packages posttrans script for later execution.
void executeScripts()
Execute te remembered scripts.
friend std::ostream & operator<<(std::ostream &str, const Impl &obj)
std::ostream & dumpOn(std::ostream &str, const RpmPostTransCollector::Impl &obj)
Verbose stream output.
std::list< std::string > _scripts
std::ostream & operator<<(std::ostream &str, const RpmPostTransCollector::Impl &obj)
Stream output.
Impl(const Pathname &root_r)
Extract and remember posttrans scripts for later execution.
RpmPostTransCollector(const Pathname &root_r)
Default ctor.
RW_pointer< Impl > _pimpl
Implementation class.
bool collectScriptFromPackage(ManagedFile rpmPackage_r)
Extract and remember a packages posttrans script for later execution.
void executeScripts()
Execute te remembered scripts.
~RpmPostTransCollector()
Dtor.
void discardScripts()
Discard all remembered scrips.
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
int addmod(const Pathname &path, mode_t mode)
Add the mode bits to the file given by path.
std::ostream & dumpOn(std::ostream &str, const RpmPostTransCollector &obj)
std::ostream & operator<<(std::ostream &str, const CommitPackageCache &obj)
Easy-to use interface to the ZYPP dependency resolver.
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
static bool warning(const std::string &msg_r, const UserData &userData_r=UserData())
send warning text
static bool info(const std::string &msg_r, const UserData &userData_r=UserData())
send message text
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...