[zypp-commit] r8511 - in /branches/tmp/ma/jump_sat/libzypp/zypp: RepoInfo.cc RepoInfo.h RepoManager.cc target/TargetImpl.cc
Author: matz Date: Thu Feb 7 05:04:06 2008 New Revision: 8511 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8511&view=rev Log: Call the sat-solver helper programs from $PATH, not from /usr/bin. Make it possible to have repo aliases with '/' in them (those are used as filenames, which can't contain slashes). Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.cc branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.h branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc branches/tmp/ma/jump_sat/libzypp/zypp/target/TargetImpl.cc Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.cc?rev=8511&r1=8510&r2=8511&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.cc Thu Feb 7 05:04:06 2008 @@ -50,6 +50,7 @@ std::set<Url> baseUrls; Pathname path; std::string alias; + std::string escaped_alias; std::string name; Pathname filepath; Pathname metadatapath; @@ -146,6 +147,17 @@ RepoInfo & RepoInfo::setAlias( const std::string &alias ) { _pimpl->alias = alias; + // replace slashes with underscores + std::string fnd="/"; + std::string rep="_"; + std::string escaped_alias = alias; + size_t pos = escaped_alias.find(fnd); + while(pos!=string::npos) + { + escaped_alias.replace(pos,fnd.length(),rep); + pos = escaped_alias.find(fnd,pos+rep.length()); + } + _pimpl->escaped_alias = escaped_alias; return *this; } @@ -185,6 +197,9 @@ std::string RepoInfo::alias() const { return _pimpl->alias; } + std::string RepoInfo::escaped_alias() const + { return _pimpl->escaped_alias; } + std::string RepoInfo::name() const { if ( _pimpl->name.empty() ) Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.h?rev=8511&r1=8510&r2=8511&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.h (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoInfo.h Thu Feb 7 05:04:06 2008 @@ -79,6 +79,11 @@ std::string alias() const; /** + * Same as alias(), just escaped in a way to be a valid file name. + */ + std::string escaped_alias() const; + + /** * A Url under which the metadata are located, or a set of mirrors. * * This can't be empty in order the repository to be valid Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc?rev=8511&r1=8510&r2=8511&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc Thu Feb 7 05:04:06 2008 @@ -669,7 +669,7 @@ assert_alias(info); Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info); - Pathname base = _pimpl->options.repoCachePath + info.alias(); + Pathname base = _pimpl->options.repoCachePath + info.escaped_alias(); Pathname solvfile = base.extend(".solv"); //cache::SolvStore store(_pimpl->options.repoCachePath); @@ -746,7 +746,7 @@ // Take care we unlink the solvfile on exception ManagedFile guard( solvfile, filesystem::unlink ); - string cmd( str::form( "/usr/bin/repo2solv.sh \"%s\" > '%s'", rawpath.c_str(), solvfile.c_str() ) ); + string cmd( str::form( "repo2solv.sh \"%s\" > \"%s\"", rawpath.c_str(), solvfile.c_str() ) ); ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout ); for ( string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) { MIL << " " << output; @@ -804,7 +804,7 @@ #endif // update timestamp and checksum //store.updateRepositoryStatus(id, raw_metadata_status); - setCacheStatus(info.alias(), raw_metadata_status); + setCacheStatus(info.escaped_alias(), raw_metadata_status); MIL << "Commit cache.." << endl; //store.commit(); //progress.toMax(); @@ -864,7 +864,7 @@ const ProgressData::ReceiverFnc & progressrcv ) { Pathname name = _pimpl->options.repoCachePath; - name += info.alias() + ".solv"; + name += info.escaped_alias() + ".solv"; unlink (name); } @@ -873,13 +873,13 @@ bool RepoManager::isCached( const RepoInfo &info ) const { Pathname name = _pimpl->options.repoCachePath; - return PathInfo(name + Pathname(info.alias()).extend(".solv")).isExist(); + return PathInfo(name + Pathname(info.escaped_alias()).extend(".solv")).isExist(); } RepoStatus RepoManager::cacheStatus( const RepoInfo &info ) const { - Pathname base = _pimpl->options.repoCachePath + info.alias(); + Pathname base = _pimpl->options.repoCachePath + info.escaped_alias(); Pathname cookiefile = base.extend(".cookie"); return RepoStatus::fromCookieFile(cookiefile); @@ -898,7 +898,7 @@ { assert_alias(info); sat::Pool satpool( sat::Pool::instance() ); - string alias = info.alias(); + string alias = info.escaped_alias(); Pathname solvfile = (_pimpl->options.repoCachePath + alias).extend(".solv"); Modified: branches/tmp/ma/jump_sat/libzypp/zypp/target/TargetImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/target/TargetImpl.cc?rev=8511&r1=8510&r2=8511&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/target/TargetImpl.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/target/TargetImpl.cc Thu Feb 7 05:04:06 2008 @@ -324,7 +324,7 @@ #warning FIXME add root to rpmdb2solv // FIXME add root to rpmdb2solv - string cmd( str::form( "/usr/bin/rpmdb2solv > '%s'", rpmsolv.c_str() ) ); + string cmd( str::form( "rpmdb2solv > \"%s\"", rpmsolv.c_str() ) ); ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout ); for ( string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) { MIL << " " << output; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
matz@svn.opensuse.org