#include <algorithm>
#include "zypp/base/InputStream.h"
-#include "zypp/base/Logger.h"
+#include "zypp/base/LogTools.h"
#include "zypp/base/Gettext.h"
#include "zypp/base/Function.h"
#include "zypp/base/Regex.h"
// Take care we unlink the solvfile on exception
ManagedFile guard( solvfile, filesystem::unlink );
- std::ostringstream cmd;
- std::string toFile( str::gsub(solvfile.asString(),"\"","\\\"") );
- if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
- {
+ ExternalProgram::Arguments cmd;
+ cmd.push_back( "repo2solv.sh" );
+
+ // repo2solv expects -o as 1st arg!
+ cmd.push_back( "-o" );
+ cmd.push_back( solvfile.asString() );
+
+ if ( repokind == RepoType::RPMPLAINDIR )
// FIXME this does only work form dir: URLs
- cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"",
- str::gsub( info.baseUrlsBegin()->getPathName(),"\"","\\\"" ).c_str(),
- toFile.c_str() );
- }
+ cmd.push_back( info.baseUrlsBegin()->getPathName() );
else
- {
- cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"",
- str::gsub( rawpath.asString(),"\"","\\\"" ).c_str(),
- toFile.c_str() );
- }
- MIL << "Executing: " << cmd.str() << endl;
- ExternalProgram prog( cmd.str(), ExternalProgram::Stderr_To_Stdout );
+ cmd.push_back( rawpath.asString() );
+
+ dumpRangeLine( MIL << "Executing: ", cmd.begin(), cmd.end() ) << endl;
+ ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
- cmd << endl;
for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) {
WAR << " " << output;
- cmd << " " << output;
+ //cmd << " " << output;
}
int ret = prog.close();
if ( ret != 0 )
{
RepoException ex(str::form("Failed to cache repo (%d).", ret));
- ex.remember( cmd.str() );
+ //ex.remember( cmd.str() );
ZYPP_THROW(ex);
}
if ( locale.country().hasCode() )
{
Locale l(locale.language());
- std::set<Locale>::const_iterator it = available.find(l);
+ std::set<Locale>::const_iterator it = available.find(l);
if ( it != available.end() )
{
Pathname ret = ldir / ("license."+l.code()+".txt");
std::set<Locale> getAvailableLicenseLocales( const Pathname & ldir )
{
+ return std::set<Locale>();
#warning getAvailableLicenseLocales not yet implemented
}
// Pathname getInfoFile( const RepoInfo & repo ) media.1/info.txt
////////////////////////////////////////////////////////////////////////////
-
+
std::ostream & operator<<( std::ostream & str, const RepoManager & obj )
{
return str << *obj._pimpl;