diff options
author | bubulle@debian.org <> | 2007-04-21 22:21:43 +0200 |
---|---|---|
committer | bubulle@debian.org <> | 2007-04-21 22:21:43 +0200 |
commit | f6c03f1e14b0e37e8dd06c215b1ae6d5b0799c7b (patch) | |
tree | 559c186838d425e53a5b4c3fcbd2165bb4c6883f /apt-pkg | |
parent | 72c52e774bb0564302617b8aec2f6e24215fd31d (diff) | |
parent | bc50fc3013aa4454d10376888e4ccc24d35de334 (diff) |
Merge with Michael
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 9 | ||||
-rw-r--r-- | apt-pkg/acquire.cc | 19 | ||||
-rw-r--r-- | apt-pkg/acquire.h | 2 | ||||
-rw-r--r-- | apt-pkg/init.h | 2 | ||||
-rw-r--r-- | apt-pkg/makefile | 2 | ||||
-rw-r--r-- | apt-pkg/policy.cc | 9 |
6 files changed, 32 insertions, 11 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 8ec4ba2c0..f566b16b8 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -183,6 +183,7 @@ string pkgAcqIndex::Custom600Headers() void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) { + // no .bz2 found, retry with .gz if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") { Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz"; @@ -194,9 +195,15 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) Complete = false; Dequeue(); return; + } + + // on decompression failure, remove bad versions in partial/ + if(Decompression && Erase) { + string s = _config->FindDir("Dir::State::lists") + "partial/"; + s += URItoFileName(RealURI); + unlink(s.c_str()); } - Item::Failed(Message,Cnf); } diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index fff1b2b6a..e1dccf25a 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -193,9 +193,9 @@ void pkgAcquire::Enqueue(ItemDesc &Item) Item.Owner->Status = Item::StatIdle; // Queue it into the named queue - I->Enqueue(Item); - ToFetch++; - + if(I->Enqueue(Item)) + ToFetch++; + // Some trace stuff if (Debug == true) { @@ -549,11 +549,17 @@ pkgAcquire::Queue::~Queue() // Queue::Enqueue - Queue an item to the queue /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcquire::Queue::Enqueue(ItemDesc &Item) +bool pkgAcquire::Queue::Enqueue(ItemDesc &Item) { QItem **I = &Items; - for (; *I != 0; I = &(*I)->Next); - + // move to the end of the queue and check for duplicates here + for (; *I != 0; I = &(*I)->Next) + if (Item.URI == (*I)->URI) + { + Item.Owner->Status = Item::StatDone; + return false; + } + // Create a new item QItem *Itm = new QItem; *Itm = Item; @@ -563,6 +569,7 @@ void pkgAcquire::Queue::Enqueue(ItemDesc &Item) Item.Owner->QueueCounter++; if (Items->Next == 0) Cycle(); + return true; } /*}}}*/ // Queue::Dequeue - Remove an item from the queue /*{{{*/ diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 27bb3d363..1d5daf12e 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -173,7 +173,7 @@ class pkgAcquire::Queue public: // Put an item into this queue - void Enqueue(ItemDesc &Item); + bool Enqueue(ItemDesc &Item); bool Dequeue(Item *Owner); // Find a Queued item diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 8255b406a..b584b2cce 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 3 -#define APT_PKG_MINOR 11 +#define APT_PKG_MINOR 12 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 7e5feae53..c493d3dd9 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -13,7 +13,7 @@ include ../buildlib/defaults.mak # methods/makefile - FIXME LIBRARY=apt-pkg LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) -MAJOR=3.11 +MAJOR=3.12 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index d8b8825c2..35a50425b 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -36,6 +36,7 @@ #include <apti18n.h> #include <iostream> +#include <sstream> /*}}}*/ using namespace std; @@ -300,7 +301,13 @@ bool ReadPinFile(pkgPolicy &Plcy,string File) continue; } - Plcy.CreatePin(Type,Name,string(Word,End),priority); + istringstream s(Name); + string pkg; + while(!s.eof()) + { + s >> pkg; + Plcy.CreatePin(Type, pkg, string(Word,End),priority); + }; } Plcy.InitDefaults(); |