From 4cbf323fabcc44946001a215c224ce5b080519ca Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 30 Jul 2010 17:40:01 +0200 Subject: * apt-pkg/pkgcache.cc: - re-evaluate the architectures cache when the cache is (re)opened --- apt-pkg/pkgcache.cc | 5 ++++- debian/changelog | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 9e1f8b633..ae11057ed 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -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(); } diff --git a/debian/changelog b/debian/changelog index 33bd66b1c..cd0f4d7f6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low + + [ Michael Vogt ] + * apt-pkg/pkgcache.cc: + - re-evaluate the architectures cache when the cache is (re)opened + + -- Michael Vogt Fri, 30 Jul 2010 17:37:14 +0200 + apt (0.7.26~exp12) experimental; urgency=low [ Michael Vogt ] -- cgit v1.2.3 From 73dfa041545d34b79a4dd25a0baa3e64f5564a62 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Aug 2010 21:02:01 +0200 Subject: * apt-pkg/cdrom.cc: - fix off-by-one error in DropBinaryArch --- apt-pkg/cdrom.cc | 2 +- debian/changelog | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index e3e0027fc..0e36f44a2 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -229,7 +229,7 @@ bool pkgCdrom::DropBinaryArch(vector &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 diff --git a/debian/changelog b/debian/changelog index cd0f4d7f6..1d76736a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,10 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low * apt-pkg/pkgcache.cc: - re-evaluate the architectures cache when the cache is (re)opened + [ Colin Watson ] + * apt-pkg/cdrom.cc: + - fix off-by-one error in DropBinaryArch + -- Michael Vogt Fri, 30 Jul 2010 17:37:14 +0200 apt (0.7.26~exp12) experimental; urgency=low -- cgit v1.2.3 From 736f67512b4c2c8069011116217a6ffdcd374500 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 6 Aug 2010 23:33:55 +0200 Subject: * 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 #591881). --- apt-pkg/depcache.cc | 9 ++++++--- debian/changelog | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index bc663a8e9..043185dbc 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -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; } diff --git a/debian/changelog b/debian/changelog index 1d76736a3..4e453040f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,11 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low * apt-pkg/cdrom.cc: - fix off-by-one error in DropBinaryArch + [ Julian Andres Klode ] + * 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 #591881). + -- Michael Vogt Fri, 30 Jul 2010 17:37:14 +0200 apt (0.7.26~exp12) experimental; urgency=low -- cgit v1.2.3 From beeaac3e93818e1d3434ca46d2e98f9a3250eeaa Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 7 Aug 2010 00:34:49 +0200 Subject: Fix changelog. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4e453040f..af6eeb9ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,7 +11,7 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low [ Julian Andres Klode ] * 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 #591881). + handle it as Conflicts (by removing it) (helps for #591882). -- Michael Vogt Fri, 30 Jul 2010 17:37:14 +0200 -- cgit v1.2.3 From c6391a3bb2352abd011435e5122479344b0edf0e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 7 Aug 2010 16:16:12 +0200 Subject: * debian/control: - Add dependency on gnupg to apt, apt-key uses it. --- debian/changelog | 2 ++ debian/control | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index af6eeb9ea..1927ef898 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low * 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. -- Michael Vogt Fri, 30 Jul 2010 17:37:14 +0200 diff --git a/debian/control b/debian/control index dba0933b1..f03b96f67 100644 --- a/debian/control +++ b/debian/control @@ -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~) -- cgit v1.2.3 From 4a9db82795a64fce22128f8dc06596421ce2d865 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 10 Aug 2010 14:53:12 +0200 Subject: apt-pkg/contrib/fileutl.cc: Add WriteAtomic mode. --- apt-pkg/contrib/fileutl.cc | 2 ++ apt-pkg/contrib/fileutl.h | 3 ++- debian/changelog | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 2a3b8a87d..f86bf2942 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -669,6 +669,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) } break; + case WriteAtomic: case WriteEmpty: { Flags |= Replace; @@ -678,6 +679,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) free(name); break; } + case WriteExists: iFd = open(FileName.c_str(),O_RDWR); diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 62705478d..cb4655798 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -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) { diff --git a/debian/changelog b/debian/changelog index 1927ef898..9f3d1df85 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low - fix off-by-one error in DropBinaryArch [ Julian Andres Klode ] + * apt-pkg/contrib/fileutl.cc: + - Add WriteAtomic mode. * 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). -- cgit v1.2.3 From fc81e8f2deff3b86738cad78aa491b1b514b3c59 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 10 Aug 2010 14:55:36 +0200 Subject: apt-pkg/contrib/fileutl.cc: Revert WriteEmpty to old behavior (LP: #613211) --- apt-pkg/contrib/fileutl.cc | 9 ++++++++- debian/changelog | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index f86bf2942..91aecee65 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -670,7 +670,6 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) break; case WriteAtomic: - case WriteEmpty: { Flags |= Replace; char *name = strdup((FileName + ".XXXXXX").c_str()); @@ -680,6 +679,14 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) 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); diff --git a/debian/changelog b/debian/changelog index 9f3d1df85..0f3d0d499 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low [ Julian Andres Klode ] * apt-pkg/contrib/fileutl.cc: - Add WriteAtomic mode. + - Revert WriteEmpty to old behavior (LP: #613211) * 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). -- cgit v1.2.3 From 22041bd2864b8d0b401b45dde9eda4003a11fec4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 10 Aug 2010 14:59:56 +0200 Subject: apt-pkg, methods: Convert users of WriteEmpty to WriteAtomic. --- apt-pkg/depcache.cc | 2 +- apt-pkg/indexcopy.cc | 6 +++--- apt-pkg/pkgcachegen.cc | 4 ++-- debian/changelog | 2 ++ methods/bzip2.cc | 2 +- methods/copy.cc | 2 +- methods/gzip.cc | 2 +- methods/rred.cc | 4 ++-- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 043185dbc..00bf68af1 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -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(); } diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 621c18716..b4e587d7b 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -134,7 +134,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &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; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index c9a9a753c..ed35174bb 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -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; diff --git a/debian/changelog b/debian/changelog index 0f3d0d499..6945b48f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low * 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). diff --git a/methods/bzip2.cc b/methods/bzip2.cc index 5da214bfc..19e49828e 100644 --- a/methods/bzip2.cc +++ b/methods/bzip2.cc @@ -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; diff --git a/methods/copy.cc b/methods/copy.cc index 027b59f46..a6bb372a3 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -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) { diff --git a/methods/gzip.cc b/methods/gzip.cc index 72e3ac909..5b9b66b50 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -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; diff --git a/methods/rred.cc b/methods/rred.cc index f42c7a072..d51c45c85 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -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) { -- cgit v1.2.3