// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcachegen.cc,v 1.43 1999/12/10 23:40:29 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.45 2000/01/14 06:26:36 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
-
+#include <stdio.h>
#include <system.h>
/*}}}*/
struct stat Buf;
if (stat(File.c_str(),&Buf) != 0)
{
+ // Old format file name.. rename it
+ if (File[0] == '_' && stat(File.c_str()+1,&Buf) == 0)
+ {
+ if (rename(File.c_str()+1,File.c_str()) != 0)
+ return _error->Errno("rename","Failed to rename %s to %s",
+ File.c_str()+1,File.c_str());
+ continue;
+ }
+
_error->WarningE("stat","Couldn't stat source package list '%s' (%s)",
I->PackagesInfo().c_str(),File.c_str());
Missing++;
{
string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
FileFd SCacheF(SCacheFile,FileFd::WriteEmpty);
+
+ /* Open the pkgcache, we want a new inode here so we do no corrupt
+ existing mmaps */
+ unlink(CacheFile.c_str());
FileFd CacheF(CacheFile,FileFd::WriteEmpty);
DynamicMMap Map(CacheF,MMap::Public,MapSize);
if (_error->PendingError() == true)
// We use the source cache to generate the package cache
string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
-
FileFd SCacheF(SCacheFile,FileFd::ReadOnly);
+
+ /* Open the pkgcache, we want a new inode here so we do no corrupt
+ existing mmaps */
+ unlink(CacheFile.c_str());
FileFd CacheF(CacheFile,FileFd::WriteEmpty);
DynamicMMap Map(CacheF,MMap::Public,MapSize);
if (_error->PendingError() == true)