From 092ae175f070124ba0857429609e5613a4606934 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Jan 2006 17:52:59 +0000 Subject: * make apt-get source smarter about not downloading the same sources twice --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 88c25de43..1c5866a4a 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1037,7 +1037,7 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5, else PartialSize = Buf.st_size; } - + QueueURI(Desc); } /*}}}*/ -- cgit v1.2.3 From f381d68d3c1de8e96dfb2a2ebe36c8577729ec44 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 5 Jan 2006 21:11:29 +0000 Subject: * be more clever about I-M-S hits for the Release file and gpg-failures with it, requeue it without i-m-s then --- apt-pkg/acquire-item.cc | 27 +++++++++++++++++++++++++-- apt-pkg/acquire-item.h | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 1c5866a4a..b9fc74456 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -430,7 +430,7 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner, const vector* IndexTargets, indexRecords* MetaIndexParser) : Item(Owner), RealURI(URI), SigFile(SigFile), AuthPass(false), - MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets) + MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets), IMSHit(false) { DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(URI); @@ -523,6 +523,9 @@ void pkgAcqMetaIndex::RetrievalDone(string Message) return; } + // see if the download was a IMSHit + IMSHit = StringToBool(LookupTag(Message,"IMS-Hit"),false); + Complete = true; string FinalFile = _config->FindDir("Dir::State::lists"); @@ -688,10 +691,30 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) { if (AuthPass == true) { - // gpgv method failed + // if we fail the authentication but got the file via a IMS-Hit + // this means that the file wasn't downloaded and that it might be + // just stale (server problem, proxy etc). we delete what we have + // queue it again without i-m-s + // alternatively we could just unlink the file and let the user try again + if (IMSHit) + { + Complete = false; + Local = false; + AuthPass = false; + unlink(DestFile.c_str()); + + DestFile = _config->FindDir("Dir::State::lists") + "partial/"; + DestFile += URItoFileName(RealURI); + Desc.URI = RealURI; + QueueURI(Desc); + return; + } + + // gpgv method failed _error->Warning("GPG error: %s: %s", Desc.Description.c_str(), LookupTag(Message,"Message").c_str()); + } // No Release file was present, or verification failed, so fall diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index c34b5ef69..e6fc7fc47 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -151,6 +151,7 @@ class pkgAcqMetaIndex : public pkgAcquire::Item const vector* IndexTargets; indexRecords* MetaIndexParser; bool AuthPass; + bool IMSHit; // required to fail gracefully on failures bool VerifyVendor(); void RetrievalDone(string Message); -- cgit v1.2.3 From ce424cd4464ce46706046d581e05fbf292a54881 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 6 Jan 2006 00:02:14 +0000 Subject: * support multiple signatures --- apt-pkg/acquire-item.cc | 22 +++++++++++++++++++--- apt-pkg/acquire-item.h | 5 +++-- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index b9fc74456..11a449e91 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -554,7 +554,7 @@ void pkgAcqMetaIndex::AuthDone(string Message) return; } - if (!VerifyVendor()) + if (!VerifyVendor(Message)) { return; } @@ -612,7 +612,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) } } -bool pkgAcqMetaIndex::VerifyVendor() +bool pkgAcqMetaIndex::VerifyVendor(string Message) { // // Maybe this should be made available from above so we don't have // // to read and parse it every time? @@ -637,6 +637,22 @@ bool pkgAcqMetaIndex::VerifyVendor() // break; // } // } + string::size_type pos; + + // check for missing sigs (that where not fatal because otherwise we had + // bombed earlier) + string missingkeys; + string msg = _("There was no public key available for the " + "following key IDs:\n"); + pos = Message.find("NO_PUBKEY "); + if (pos != std::string::npos) + { + string::size_type start = pos+strlen("NO_PUBKEY "); + string Fingerprint = Message.substr(start, Message.find("\n")-start); + missingkeys += (Fingerprint); + } + if(!missingkeys.empty()) + _error->Warning("%s", string(msg+missingkeys).c_str()); string Transformed = MetaIndexParser->GetExpectedDist(); @@ -645,7 +661,7 @@ bool pkgAcqMetaIndex::VerifyVendor() Transformed = "experimental"; } - string::size_type pos = Transformed.rfind('/'); + pos = Transformed.rfind('/'); if (pos != string::npos) { Transformed = Transformed.substr(0, pos); diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index e6fc7fc47..da1bea801 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -151,9 +151,10 @@ class pkgAcqMetaIndex : public pkgAcquire::Item const vector* IndexTargets; indexRecords* MetaIndexParser; bool AuthPass; - bool IMSHit; // required to fail gracefully on failures + // required to deal gracefully with problems caused by incorrect ims hits + bool IMSHit; - bool VerifyVendor(); + bool VerifyVendor(string Message); void RetrievalDone(string Message); void AuthDone(string Message); void QueueIndexes(bool verify); -- cgit v1.2.3 From b63380b007b6394935a1412791243fdf939b3c92 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 19 Jan 2006 10:37:57 +0000 Subject: * don't explod if a Provides has DepCompareOp --- apt-pkg/deb/deblistparser.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b11d2531c..d0dc7a260 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -504,11 +504,12 @@ bool debListParser::ParseProvides(pkgCache::VerIterator Ver) Start = ParseDepends(Start,Stop,Package,Version,Op); if (Start == 0) return _error->Error("Problem parsing Provides line"); - if (Op != pkgCache::Dep::NoOp) - return _error->Error("Malformed provides line"); - - if (NewProvides(Ver,Package,Version) == false) - return false; + if (Op != pkgCache::Dep::NoOp) { + _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str()); + } else { + if (NewProvides(Ver,Package,Version) == false) + return false; + } if (Start == Stop) break; -- cgit v1.2.3 From 75dd8af14b76bb84a69a927ecae93f60600b9667 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 20 Feb 2006 20:38:11 +0000 Subject: * only remove the sigfile if pkgAcqMetaSig::Failed() didn't fail for a network error --- apt-pkg/acquire-item.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 86f61dd00..0daca55c9 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -340,12 +340,6 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner, // File was already in place. It needs to be re-verified // because Release might have changed, so Move it into partial Rename(Final,DestFile); - // unlink the file and do not try to use I-M-S and Last-Modified - // if the users proxy is broken - if(_config->FindB("Acquire::BrokenProxy", false) == true) { - std::cerr << "forcing re-get of the signature file as requested" << std::endl; - unlink(DestFile.c_str()); - } } QueueURI(Desc); @@ -395,18 +389,19 @@ void pkgAcqMetaSig::Done(string Message,unsigned long Size,string MD5, /*}}}*/ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf) { - // Delete any existing sigfile, so that this source isn't - // mistakenly trusted - string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI); - unlink(Final.c_str()); - // if we get a timeout if fail + // if we get a network error we fail gracefully if(LookupTag(Message,"FailReason") == "Timeout" || - LookupTag(Message,"FailReason") == "TmpResolveFailure") { + LookupTag(Message,"FailReason") == "TmpResolveFailure") || + LookupTag(Message,"FailReason") == "ConnectionRefused") { Item::Failed(Message,Cnf); return; } + // Delete any existing sigfile when the acquire failed + string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI); + unlink(Final.c_str()); + // queue a pkgAcqMetaIndex with no sigfile new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc, "", IndexTargets, MetaIndexParser); -- cgit v1.2.3 From 0c1b7be9c1a30fddd72d5b80bb2e566fe379b166 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 20 Feb 2006 21:32:41 +0000 Subject: tyop --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 0daca55c9..1fa929aad 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -392,7 +392,7 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf) // if we get a network error we fail gracefully if(LookupTag(Message,"FailReason") == "Timeout" || - LookupTag(Message,"FailReason") == "TmpResolveFailure") || + LookupTag(Message,"FailReason") == "TmpResolveFailure" || LookupTag(Message,"FailReason") == "ConnectionRefused") { Item::Failed(Message,Cnf); return; -- cgit v1.2.3 From 1e8b4c0f25c2d719a036e276f963c5182dee01d5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Mar 2006 19:05:42 +0200 Subject: * only show ETA if that makes sense --- apt-pkg/acquire.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 57cf60bfe..a9a770905 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -818,7 +818,13 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes) / CurrentCPS); - snprintf(msg,sizeof(msg), _("Downloading file %li of %li (%s remaining)"), i, TotalItems, TimeToStr(ETA).c_str()); + // only show the ETA if it makes sense + if (ETA > 0 && ETA < 172800 /* two days */ ) + snprintf(msg,sizeof(msg), _("Downloading file %li of %li (%s remaining)"), i, TotalItems, TimeToStr(ETA).c_str()); + else + snprintf(msg,sizeof(msg), _("Downloading file %li of %li"), i, TotalItems); + + // build the status str status << "dlstatus:" << i -- cgit v1.2.3 From 0c508b03a25a99edb1b969525e9c9916b0edd4db Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Mar 2006 19:10:20 +0200 Subject: * "downloading" -> "retrieving" (thanks to kamion) --- apt-pkg/acquire.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index a9a770905..fff1b2b6a 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -820,9 +820,9 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) // only show the ETA if it makes sense if (ETA > 0 && ETA < 172800 /* two days */ ) - snprintf(msg,sizeof(msg), _("Downloading file %li of %li (%s remaining)"), i, TotalItems, TimeToStr(ETA).c_str()); + snprintf(msg,sizeof(msg), _("Retrieving file %li of %li (%s remaining)"), i, TotalItems, TimeToStr(ETA).c_str()); else - snprintf(msg,sizeof(msg), _("Downloading file %li of %li"), i, TotalItems); + snprintf(msg,sizeof(msg), _("Retrieving file %li of %li"), i, TotalItems); -- cgit v1.2.3 From 0e36721c09a1c7a77e9cf45bbbc8476d9ef5c60a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 18 Apr 2006 13:17:44 +0200 Subject: * wording (thanks to mdz) --- apt-pkg/deb/dpkgpm.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index fe8fbca74..3b7b2238a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -375,8 +375,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) }, // Purge operation { - {"config-files", _("Preparing for remove with config %s")}, - {"not-installed", _("Removed with config %s")}, + {"config-files", _("Preparing to completely remove %s")}, + {"not-installed", _("Completely removed %s")}, {NULL, NULL} }, }; -- cgit v1.2.3 From eda1bb3c93661da4640026153d371c474f720d28 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 25 Apr 2006 09:48:52 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: wording fixes (thanks to mdz) * debian/changelog: updated * debian/rules: invoke tar with --no-recursion to avoid cruft in the tarbal * po/apt-all.pot: updated --- apt-pkg/deb/dpkgpm.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 3b7b2238a..667db8ff2 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -623,8 +623,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) 'status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited */ - char* list[4]; - TokSplitString(':', line, list, 5); + char* list[5]; + TokSplitString(':', line, list, sizeof(list)/sizeof(list[0])); char *pkg = list[1]; char *action = _strstrip(list[2]); -- cgit v1.2.3 From 9373b9752db017bc8458720f330dc9594ac8de17 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 8 May 2006 22:27:07 +0200 Subject: * apt-pkg/deb/debversion.cc: - applied patch from Lionel Elie Mamane to fix epoch handling (debian: #363358) --- apt-pkg/deb/debversion.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index aeee61929..064d8fa5b 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -59,7 +59,7 @@ int debVersioningSystem::CmpFragment(const char *A,const char *AEnd, } /* Iterate over the whole string - What this does is to spilt the whole string into groups of + What this does is to split the whole string into groups of numeric and non numeric portions. For instance: a67bhgs89 Has 4 portions 'a', '67', 'bhgs', '89'. A more normal: @@ -140,6 +140,27 @@ int debVersioningSystem::DoCmpVersion(const char *A,const char *AEnd, if (rhs == BEnd) rhs = B; + // Special case: a zero epoch is the same as no epoch, + // so remove it. + if (lhs != A) + { + for (; *A == '0'; ++A); + if (A == lhs) + { + ++A; + ++lhs; + } + } + if (rhs != B) + { + for (; *B == '0'; ++B); + if (B == rhs) + { + ++B; + ++rhs; + } + } + // Compare the epoch int Res = CmpFragment(A,lhs,B,rhs); if (Res != 0) -- cgit v1.2.3 From d4c5f11f8ef619ec56ae1e532416bb3817442b1c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 27 May 2006 14:13:31 +0200 Subject: * added Debug::pkgDepCache::AutoInstall debug option --- apt-pkg/depcache.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index dd1c794c9..58d1d25e5 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -16,7 +16,8 @@ #include #include #include - +#include + #include /*}}}*/ @@ -712,6 +713,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if (InstPkg.end() == false) { + if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true) + std::clog << "Installing " << InstPkg.Name() + << " as dep of " << Pkg.Name() + << std::endl; MarkInstall(InstPkg,true,Depth + 1); // Set the autoflag, after MarkInstall because MarkInstall unsets it -- cgit v1.2.3 From c08447c8eef91499920ca51276313526888939ec Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 9 Jun 2006 15:47:50 +0200 Subject: * merge the patch from Steinar --- apt-pkg/tagfile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index dc1ba3f9e..9763d96a3 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -98,7 +98,7 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset) iOffset = Offset; Start = Buffer + iOffset; - if (Tag.Scan(Start,End - Start) == false) + if (Start != End && Tag.Scan(Start,End - Start) == false) return _error->Error(_("Unable to parse package file %s (2)"),Fd.Name().c_str()); return true; -- cgit v1.2.3