ref: refs/heads/SuSE-Code-11-Branch
commit 2d5a1fc061d0aa8bb441011ef9ce09093ef7506e
Author: Michael Andres
Date: Tue Nov 17 12:14:13 2009 +0100
Fix unneeded refresh of plaindir repositories in presence of productdir. (bnc #553712)
---
zypp/RepoManager.cc | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/zypp/RepoManager.cc b/zypp/RepoManager.cc
index 8cf2e1a..84bfcd5 100644
--- a/zypp/RepoManager.cc
+++ b/zypp/RepoManager.cc
@@ -650,7 +650,7 @@ namespace zypp
case RepoType::RPMPLAINDIR_e :
{
if ( PathInfo(Pathname(productdatapath + "/cookie")).isExist() )
- status = RepoStatus( /*productdatapath*/ + "/cookie");
+ status = RepoStatus( productdatapath + "/cookie");
}
break;
@@ -806,7 +806,7 @@ namespace zypp
else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
{
MediaMounter media( url );
- RepoStatus newstatus = parser::plaindir::dirStatus(media.getPathName());
+ RepoStatus newstatus = parser::plaindir::dirStatus( media.getPathName( info.path() ) );
bool refresh = false;
if ( oldstatus.checksum() == newstatus.checksum() )
{
@@ -934,15 +934,20 @@ namespace zypp
else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
{
MediaMounter media( url );
- RepoStatus newstatus = parser::plaindir::dirStatus(media.getPathName());
+ RepoStatus newstatus = parser::plaindir::dirStatus( media.getPathName( info.path() ) );
- std::ofstream file(( tmpdir.path() + "/cookie").c_str());
- if (!file)
+ Pathname productpath( tmpdir.path() / info.path() );
+ filesystem::assert_dir( productpath );
+ std::ofstream file( (productpath/"cookie").c_str() );
+ if ( !file )
{
// TranslatorExplanation '%s' is a filename
- ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), (tmpdir.path()/"cookie").c_str() )));
+ ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), (productpath/"cookie").c_str() )));
}
- file << url << endl;
+ file << url;
+ if ( ! info.path().empty() && info.path() != "/" )
+ file << " (" << info.path() << ")";
+ file << endl;
file << newstatus.checksum() << endl;
file.close();
@@ -1096,7 +1101,7 @@ namespace zypp
// recusive for plaindir as 2nd arg!
cmd.push_back( "-R" );
// FIXME this does only work form dir: URLs
- cmd.push_back( forPlainDirs->getPathName().c_str() );
+ cmd.push_back( forPlainDirs->getPathName( info.path() ).c_str() );
}
else
cmd.push_back( productdatapath.asString() );
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org