28 #undef ZYPP_BASE_LOGGER_LOGGROUP
29 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::posttrans"
44 friend std::ostream &
operator<<( std::ostream & str,
const Impl & obj );
45 friend std::ostream &
dumpOn( std::ostream & str,
const Impl & obj );
47 Impl(
const Pathname & root_r )
60 WAR <<
"Unexpectedly this is no package: " << rpmPackage_r << endl;
64 std::string prog( pkg->tag_posttransprog() );
65 if ( prog.empty() || prog ==
"<lua>" )
70 script.autoCleanup(
false );
72 std::ofstream out( script.path().c_str() );
73 out <<
"#! " << pkg->tag_posttransprog() << endl
74 << pkg->tag_posttrans() << endl;
76 _scripts.push_back( script.path().basename() );
77 MIL <<
"COLLECT posttrans: " << PathInfo( script.path() ) << endl;
97 bool firstScript =
true;
100 const std::string & script =
_scripts.front();
101 const std::string & pkgident( script.substr( 0, script.size()-6 ) );
103 scriptProgress.
name(
str::Format(
_(
"Executing %%posttrans script '%1%'")) % pkgident );
105 bool canContinue =
true;
108 canContinue = scriptProgress.
toMin();
110 canContinue = scriptProgress.
incr();
115 msg <<
"Execution of %posttrans scripts cancelled";
117 historylog.
comment( msg,
true );
122 MIL <<
"EXECUTE posttrans: " << script << endl;
129 collect <<
" " << line;
135 int ret = prog.
close();
136 const std::string & scriptmsg( collect );
138 if ( ret != 0 || ! scriptmsg.empty() )
140 if ( ! scriptmsg.empty() )
143 msg <<
"Output of " << pkgident <<
" %posttrans script:\n" << scriptmsg;
144 historylog.
comment( msg,
true );
152 msg << pkgident <<
" %posttrans script failed (returned " << ret <<
")";
154 historylog.
comment( msg,
true );
161 scriptProgress.
name(
_(
"Executing %posttrans scripts") );
162 scriptProgress.
toMax();
176 msg <<
"%posttrans scripts skipped while aborting:\n";
177 for (
const auto & script :
_scripts )
179 const std::string & pkgident( script.substr( 0, script.size()-6 ) );
180 WAR <<
"UNEXECUTED posttrans: " << script << endl;
181 msg <<
" " << pkgident <<
"\n";
184 historylog.
comment( msg,
true );
208 {
return str <<
"RpmPostTransCollector::Impl"; }
212 {
return str << obj; }
221 : _pimpl( new
Impl( root_r ) )
237 {
return str << *obj.
_pimpl; }