summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-04-04 17:09:43 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-04-04 17:09:43 +0200
commit53ba4e2c2dd29758be0a911489ca5c23e5107513 (patch)
tree1c01eba553ca6e2deda76be16a26a02ca6ffa4b0 /ftparchive
parent215b0faf7b00f836e54f9903c4fe7398c0927e0f (diff)
ensure clean works
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/apt-ftparchive.cc20
-rw-r--r--ftparchive/cachedb.cc19
2 files changed, 29 insertions, 10 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index c1614398b..74fc7681f 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -957,23 +957,33 @@ static bool Clean(CommandLine &CmdL)
// Sort by cache DB to improve IO locality.
stable_sort(PkgList.begin(),PkgList.end(),PackageMap::DBCompare());
+ stable_sort(PkgList.begin(),PkgList.end(),PackageMap::SrcDBCompare());
string CacheDir = Setup.FindDir("Dir::CacheDir");
for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); )
{
- c0out << I->BinCacheDB << endl;
+ if(I->BinCacheDB != "")
+ c0out << I->BinCacheDB << endl;
+ if(I->SrcCacheDB != "")
+ c0out << I->SrcCacheDB << endl;
CacheDB DB(flCombine(CacheDir,I->BinCacheDB));
+ CacheDB DB_SRC(flCombine(CacheDir,I->SrcCacheDB));
if (DB.Clean() == false)
_error->DumpErrors();
+ if (DB_SRC.Clean() == false)
+ _error->DumpErrors();
string CacheDB = I->BinCacheDB;
- for (; I != PkgList.end() && I->BinCacheDB == CacheDB; ++I)
- ;
+ string SrcCacheDB = I->SrcCacheDB;
+ while(I != PkgList.end() &&
+ I->BinCacheDB == CacheDB &&
+ I->SrcCacheDB == SrcCacheDB)
+ ++I;
+
}
- // FIXME: clean for the SourcesDB
-
+
return true;
}
/*}}}*/
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc
index 539ed671b..f63aa88ab 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -264,10 +264,11 @@ bool CacheDB::LoadSource()
// Lookup the control information
InitQuery("cs");
if (Get() == true && Dsc.TakeDsc(Data.data, Data.size) == true)
+ {
return true;
+ }
CurStat.Flags &= ~FlSource;
}
-
if (OpenFile() == false)
return false;
@@ -551,16 +552,24 @@ bool CacheDB::Clean()
{
if (stringcmp(Colon + 1, (char *)Key.data+Key.size,"st") == 0 ||
stringcmp(Colon + 1, (char *)Key.data+Key.size,"cl") == 0 ||
+ stringcmp(Colon + 1, (char *)Key.data+Key.size,"cs") == 0 ||
stringcmp(Colon + 1, (char *)Key.data+Key.size,"cn") == 0)
{
- if (FileExists(std::string((const char *)Key.data,Colon)) == true)
- continue;
+ std::string FileName = std::string((const char *)Key.data,Colon);
+ if (FileExists(FileName) == true) {
+ continue;
+ }
}
}
-
Cursor->c_del(Cursor,0);
}
- Dbp->compact(Dbp, NULL, NULL, NULL, NULL, DB_FREE_SPACE, NULL);
+ int res = Dbp->compact(Dbp, NULL, NULL, NULL, NULL, DB_FREE_SPACE, NULL);
+ if (res < 0)
+ _error->Warning("compact failed with result %i", res);
+
+ if(_config->FindB("Debug::APT::FTPArchive::Clean", false) == true)
+ Dbp->stat_print(Dbp, 0);
+
return true;
}