]> git.saurik.com Git - apt.git/commitdiff
merge with debian-experimental-ma
authorDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 10 Aug 2010 14:04:17 +0000 (16:04 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 10 Aug 2010 14:04:17 +0000 (16:04 +0200)
* Swedish translation update. Closes: #592366
* apt-pkg/pkgcache.cc:
  - re-evaluate the architectures cache when the cache is (re)opened
* apt-pkg/cdrom.cc:
  - fix off-by-one error in DropBinaryArch
* apt-pkg/contrib/fileutl.cc:
  - Add WriteAtomic mode.
  - Revert WriteEmpty to old behavior (LP: #613211)
* apt-pkg, methods:
  - Convert users of WriteEmpty to WriteAtomic.
* apt-pkg/depcache.cc:
  - Only try upgrade for Breaks if there is a newer version, otherwise
    handle it as Conflicts (by removing it) (helps for #591882).
* debian/control:
  - Add dependency on gnupg to apt, apt-key uses it.

13 files changed:
apt-pkg/cdrom.cc
apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/fileutl.h
apt-pkg/depcache.cc
apt-pkg/indexcopy.cc
apt-pkg/pkgcache.cc
apt-pkg/pkgcachegen.cc
debian/changelog
debian/control
methods/bzip2.cc
methods/copy.cc
methods/gzip.cc
methods/rred.cc

index e3e0027fcadfad9004388322b613643d93ccde13..0e36f44a27a0f7c9912808f213e8550c4484f7b0 100644 (file)
@@ -229,7 +229,7 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List)
       // Between Start and End is the architecture
       Start += 8;
       if ((End = strstr(Start,"/")) != 0 && Start != End &&
-          APT::Configuration::checkArchitecture(string(Start, --End)) == true)
+          APT::Configuration::checkArchitecture(string(Start, End)) == true)
         continue; // okay, architecture is accepted
 
       // not accepted -> Erase it
index 2a3b8a87daa0b062ea484f1b5d432a121e86658a..91aecee652f863f12dc97a5e2c3b28ffac45b489 100644 (file)
@@ -669,7 +669,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
       }
       break;
       
-      case WriteEmpty:
+      case WriteAtomic:
       {
         Flags |= Replace;
         char *name = strdup((FileName + ".XXXXXX").c_str());
@@ -678,6 +678,15 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
         free(name);
         break;
       }
+
+      case WriteEmpty:
+      {
+        struct stat Buf;
+        if (lstat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode))
+           unlink(FileName.c_str());
+        iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_TRUNC,Perms);
+        break;
+      }
       
       case WriteExists:
       iFd = open(FileName.c_str(),O_RDWR);
index 62705478def3b8789fe1e291092c90e8a0510cd1..cb465579803683bda742cb89cfc2d6a013da529a 100644 (file)
@@ -46,7 +46,8 @@ class FileFd
    gzFile gz;
 
    public:
-   enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip};
+   enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
+                  WriteAtomic};
    
    inline bool Read(void *To,unsigned long Size,bool AllowEof)
    {
index bc663a8e954cfe811fea2efb92e1325b65719789..00bf68af11aa784197e7f87bfed23608bfa8b19e 100644 (file)
@@ -227,7 +227,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)      /*{{{*/
    // if it does not exist, create a empty one
    if(!FileExists(state)) 
    {
-      StateFile.Open(state, FileFd::WriteEmpty);
+      StateFile.Open(state, FileFd::WriteAtomic);
       StateFile.Close();
    }
 
@@ -1425,10 +1425,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
            VerIterator Ver(*this,*I);
            PkgIterator Pkg = Ver.ParentPkg();
 
-           if (Start->Type != Dep::DpkgBreaks)
-              MarkDelete(Pkg,false,Depth + 1, false);
-           else if (PkgState[Pkg->ID].CandidateVer != *I)
+           
+              
+           if (PkgState[Pkg->ID].CandidateVer != *I &&
+               Start->Type == Dep::DpkgBreaks)
               MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
+           else
+              MarkDelete(Pkg,false,Depth + 1, false);
         }
         continue;
       }      
index 621c18716c398d837a7829b85dc5934f46f428ee..b4e587d7b930295b29152176ea811cb98cc57377 100644 (file)
@@ -134,7 +134,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
       TargetF += URItoFileName(S);
       if (_config->FindB("APT::CDROM::NoAct",false) == true)
         TargetF = "/dev/null";
-      FileFd Target(TargetF,FileFd::WriteEmpty);
+      FileFd Target(TargetF,FileFd::WriteAtomic);
       FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
       if (_error->PendingError() == true)
         return false;
@@ -565,7 +565,7 @@ bool SigVerify::CopyMetaIndex(string CDROM, string CDName,          /*{{{*/
 
       FileFd Target;
       FileFd Rel;
-      Target.Open(TargetF,FileFd::WriteEmpty);
+      Target.Open(TargetF,FileFd::WriteAtomic);
       Rel.Open(prefix + file,FileFd::ReadOnly);
       if (_error->PendingError() == true)
         return false;
@@ -840,7 +840,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,   /*{{{*/
       TargetF += URItoFileName(S);
       if (_config->FindB("APT::CDROM::NoAct",false) == true)
         TargetF = "/dev/null";
-      FileFd Target(TargetF,FileFd::WriteEmpty);
+      FileFd Target(TargetF,FileFd::WriteAtomic);
       FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
       if (_error->PendingError() == true)
         return false;
index 2b051cbb08529ebe7fa271a88a1fedde8b787683..bb28a33ca5dab5f84a07b0690feb79237529c437 100644 (file)
@@ -111,7 +111,10 @@ bool pkgCache::Header::CheckSizes(Header &Against) const
 /* */
 pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map)
 {
-   MultiArchEnabled = APT::Configuration::getArchitectures().size() > 1;
+   // call getArchitectures() with cached=false to ensure that the 
+   // architectures cache is re-evaulated. this is needed in cases
+   // when the APT::Architecture field changes between two cache creations
+   MultiArchEnabled = APT::Configuration::getArchitectures(false).size() > 1;
    if (DoMap == true)
       ReMap();
 }
index c9a9a753ca1aad96558d89daac58e2feaae2cc52..ed35174bbb9b2a24d4bcb968e4b79182858ec09b 100644 (file)
@@ -1192,7 +1192,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
    if (Writeable == true && CacheFile.empty() == false)
    {
       unlink(CacheFile.c_str());
-      CacheF = new FileFd(CacheFile,FileFd::WriteEmpty);
+      CacheF = new FileFd(CacheFile,FileFd::WriteAtomic);
       fchmod(CacheF->Fd(),0644);
       Map = CreateDynamicMMap(CacheF, MMap::Public);
       if (_error->PendingError() == true)
@@ -1254,7 +1254,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
       // Write it back
       if (Writeable == true && SrcCacheFile.empty() == false)
       {
-        FileFd SCacheF(SrcCacheFile,FileFd::WriteEmpty);
+        FileFd SCacheF(SrcCacheFile,FileFd::WriteAtomic);
         if (_error->PendingError() == true)
            return false;
         
index 69b1649c6f19e2a1a6e5df5c4af9ea0f1f679891..1207fb52fad270097d5cee9fc112a2e4e6fb8867 100644 (file)
@@ -1,11 +1,29 @@
 apt (0.8.0~pre1) UNRELASED; urgency=low
 
+  [ Programs translations ]
+  * Swedish translation update. Closes: #592366
+
   [ Michael Vogt ]
   * merge of the debian-expermental-ma branch
   * refresh po/pot files in doc/ and po/
+  * apt-pkg/pkgcache.cc:
+    - re-evaluate the architectures cache when the cache is (re)opened
 
-  [ Programs translations ]
-  * Swedish translation update. Closes: #592366
+  [ Colin Watson ]
+  * apt-pkg/cdrom.cc:
+    - fix off-by-one error in DropBinaryArch
+
+  [ Julian Andres Klode ]
+  * apt-pkg/contrib/fileutl.cc:
+    - Add WriteAtomic mode.
+    - Revert WriteEmpty to old behavior (LP: #613211)
+  * apt-pkg, methods:
+    - Convert users of WriteEmpty to WriteAtomic.
+  * apt-pkg/depcache.cc:
+    - Only try upgrade for Breaks if there is a newer version, otherwise
+      handle it as Conflicts (by removing it) (helps for #591882).
+  * debian/control:
+    - Add dependency on gnupg to apt, apt-key uses it.
 
   [ David Kalnischkies ]
   * apt-pkg/algorithms.cc:
index dba0933b1e7752d2dd18b863f1020923270be5ed..f03b96f6720ddd81e280a6320113d5ef8bd9f958 100644 (file)
@@ -12,7 +12,7 @@ Vcs-Bzr: http://bzr.debian.org/apt/debian-sid/
 
 Package: apt
 Architecture: any
-Depends: ${shlibs:Depends}, debian-archive-keyring, ${misc:Depends}
+Depends: ${shlibs:Depends}, debian-archive-keyring, ${misc:Depends}, gnupg
 Replaces: manpages-pl (<< 20060617-3~)
 Provides: ${libapt-pkg:provides}
 Conflicts: python-apt (<< 0.7.93.2~)
index 5da214bfce36decc624ea4e3b4b8c7bc740a827c..19e49828e177fd03ed9c931eaf09c86a216fd969 100644 (file)
@@ -91,7 +91,7 @@ bool Bzip2Method::Fetch(FetchItem *Itm)
    close(GzOut[1]);
    
    FileFd FromGz(GzOut[0]);  // For autoclose   
-   FileFd To(Itm->DestFile,FileFd::WriteEmpty);   
+   FileFd To(Itm->DestFile,FileFd::WriteAtomic);   
    To.EraseOnFailure();
    if (_error->PendingError() == true)
       return false;
index 027b59f4632ada50b809cbe78e2792c3756afb83..a6bb372a3754d9b8d72ee5f85f81b2ebf586904f 100644 (file)
@@ -52,7 +52,7 @@ bool CopyMethod::Fetch(FetchItem *Itm)
    
    // See if the file exists
    FileFd From(File,FileFd::ReadOnly);
-   FileFd To(Itm->DestFile,FileFd::WriteEmpty);
+   FileFd To(Itm->DestFile,FileFd::WriteAtomic);
    To.EraseOnFailure();
    if (_error->PendingError() == true)
    {
index 72e3ac90941fa904ca0de1e7d1ad1e73a9d351cf..5b9b66b50375769f1d528b11c00d116c03e0841d 100644 (file)
@@ -55,7 +55,7 @@ bool GzipMethod::Fetch(FetchItem *Itm)
       return true;
    }
 
-   FileFd To(Itm->DestFile,FileFd::WriteEmpty);   
+   FileFd To(Itm->DestFile,FileFd::WriteAtomic);   
    To.EraseOnFailure();
    if (_error->PendingError() == true)
       return false;
index f42c7a072cd280ff137dc0705c8143b4b85bc0d4..d51c45c85a990a2c213544350e4825ee963647bc 100644 (file)
@@ -446,7 +446,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
    // the cleanup/closing of the fds)
    FileFd From(Path,FileFd::ReadOnly);
    FileFd Patch(Path+".ed",FileFd::ReadOnly);
-   FileFd To(Itm->DestFile,FileFd::WriteEmpty);   
+   FileFd To(Itm->DestFile,FileFd::WriteAtomic);   
    To.EraseOnFailure();
    if (_error->PendingError() == true)
       return false;
@@ -458,7 +458,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
       // retry with patchFile
       lseek(Patch.Fd(), 0, SEEK_SET);
       lseek(From.Fd(), 0, SEEK_SET);
-      To.Open(Itm->DestFile,FileFd::WriteEmpty);
+      To.Open(Itm->DestFile,FileFd::WriteAtomic);
       if (_error->PendingError() == true)
          return false;
       if (patchFile(Patch, From, To, &Hash) != ED_OK) {