26 #undef ZYPP_BASE_LOGGER_LOGGROUP 27 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::posttrans" 43 friend std::ostream &
dumpOn( std::ostream &
str,
const Impl & obj );
58 WAR <<
"Unexpectedly this is no package: " << rpmPackage_r << endl;
62 std::string prog( pkg->tag_posttransprog() );
63 if ( prog.empty() || prog ==
"<lua>" )
68 script.autoCleanup(
false );
70 std::ofstream out( script.path().c_str() );
71 out <<
"#! " << pkg->tag_posttransprog() << endl
72 << pkg->tag_posttrans() << endl;
74 _scripts.push_back( script.path().basename() );
75 MIL <<
"COLLECT posttrans: " <<
PathInfo( script.path() ) << endl;
91 for (
const auto & script :
_scripts )
93 MIL <<
"EXECUTE posttrans: " << script << endl;
100 collect <<
" " << line;
102 int ret = prog.
close();
103 const std::string & scriptmsg( collect );
105 if ( ret != 0 || ! scriptmsg.empty() )
107 const std::string & pkgident( script.substr( 0, script.size()-6 ) );
109 if ( ! scriptmsg.empty() )
112 msg <<
"Output of " << pkgident <<
" %posttrans script:\n" << scriptmsg;
113 historylog.
comment( msg,
true );
120 msg << pkgident <<
" %posttrans script failed (returned " << ret <<
")";
122 historylog.
comment( msg,
true );
139 msg <<
"%posttrans scripts skipped while aborting:\n";
140 for (
const auto & script :
_scripts )
142 const std::string & pkgident( script.substr( 0, script.size()-6 ) );
143 WAR <<
"UNEXECUTED posttrans: " << script << endl;
144 msg <<
" " << pkgident <<
"\n";
147 historylog.
comment( msg,
true );
170 {
return str <<
"RpmPostTransCollector::Impl"; }
174 {
return str << obj; }
183 : _pimpl( new
Impl( root_r ) )
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
static ZConfig & instance()
Singleton ctor.
void discardScripts()
Discard all remembered scrips.
friend std::ostream & dumpOn(std::ostream &str, const Impl &obj)
String related utilities and Regular expression matching.
static bool warning(const std::string &msg_r, const UserData &userData_r=UserData())
send warning text
Impl(const Pathname &root_r)
std::ostream & dumpOn(std::ostream &str, const RpmPostTransCollector::Impl &obj)
Provide a new empty temporary file and delete it when no longer needed.
void executeScripts()
Execute te remembered scripts.
std::list< std::string > _scripts
RW_pointer< Impl > _pimpl
Implementation class.
RpmPostTransCollector(const Pathname &root_r)
Default ctor.
Extract and remember posttrans scripts for later execution.
Pathname tmpDir()
Lazy create tmpdir on demand.
int addmod(const Pathname &path, mode_t mode)
Add the mode bits to the file given by path.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Provide a new empty temporary directory and recursively delete it when no longer needed.
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
bool collectScriptFromPackage(ManagedFile rpmPackage_r)
Extract and remember a packages posttrans script for later execution.
RpmPostTransCollector implementation.
std::ostream & operator<<(std::ostream &str, const CommitPackageCache &obj)
boost::scoped_ptr< filesystem::TmpDir > _ptrTmpdir
Writing the zypp history fileReference counted signleton for writhing the zypp history file...
std::string receiveLine()
Read one line from the input stream.
std::ostream & dumpOn(std::ostream &str, const RpmPostTransCollector &obj)
int close()
Wait for the progamm to complete.
bool collectScriptFromPackage(ManagedFile rpmPackage_r)
Extract and remember a packages posttrans script for later execution.
void discardScripts()
Discard all remembered scrips.
~RpmPostTransCollector()
Dtor.
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
void comment(const std::string &comment, bool timestamp=false)
Log a comment (even multiline).
Wrapper class for ::stat/::lstat.
void executeScripts()
Execute te remembered scripts.
static bool info(const std::string &msg_r, const UserData &userData_r=UserData())
send message text
Easy-to use interface to the ZYPP dependency resolver.
friend std::ostream & operator<<(std::ostream &str, const Impl &obj)
std::ostream & operator<<(std::ostream &str, const RpmPostTransCollector::Impl &obj)