-------------------------------------------------------------------
+Tue Nov 22 17:26:37 CET 2016 - ma@suse.de
+
+- Properly escape patch script output in xml mode (bsc#1010712)
+- version 1.11.58
+
+-------------------------------------------------------------------
Tue Jun 28 11:50:25 CEST 2016 - ma@suse.de
- Update sle-zypper-po.tar.bz2 (bsc#986694)
struct PatchScriptReportReceiver : public zypp::callback::ReceiveReport<zypp::target::PatchScriptReport>
{
std::string _label;
+ scoped_ptr<Out::XmlNode> _guard; // guard script output if Out::TYPE_XML
+
+ void closeNode()
+ { if ( _guard ) _guard.reset(); }
+
+ std::ostream & printOut( const std::string & output_r )
+ {
+ if ( _guard )
+ std::cout << xml::escape( output_r );
+ else
+ std::cout << output_r;
+ return std::cout;
+ }
+
virtual void start( const zypp::Package::constPtr & package,
const zypp::Pathname & path_r ) // script path
{
+ Zypper & zypper = *Zypper::instance();
+ if ( zypper.out().type() == Out::TYPE_XML )
+ _guard.reset( new Out::XmlNode( zypper.out(), "message", { "type", "info" } ) );
+
_label = boost::str(
// TranslatorExplanation speaking of a script - "Running: script file name (package name, script dir)"
boost::format(_("Running: %s (%s, %s)")) % path_r.basename() % package->name() % path_r.dirname());
- std::cout << _label << std::endl;
+ printOut( _label ) << std::endl;
}
/**
{
if (was_ping_before)
std::cout << std::endl;
- std::cout << output;
+ printOut( output );
+
was_ping_before = false;
}
/** Report error. */
virtual Action problem( const std::string & description )
{
+ closeNode();
Zypper & zypper = *Zypper::instance();
zypper.out().error(description);
/** Report success. */
virtual void finish()
{
+ closeNode();
Zypper::instance()->out().progressEnd("run-script", _label);
}
+
+ /** Catch unexpected end. */
+ virtual void reportend()
+ { closeNode(); }
};
///////////////////////////////////////////////////////////////////