From c03462c6fed27e26b2bab4b3b34589fa8bf464f8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Apr 2007 15:33:19 +0200 Subject: * [ABI] apt-pkg/acquire.{cc,h}: - deal better with duplicated sources.list entries (avoid double queuing of URLs) - this fixes hangs in bzip/gzip --- apt-pkg/acquire.cc | 19 +++++++++++++------ apt-pkg/acquire.h | 2 +- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- debian/changelog | 3 +++ methods/makefile | 2 +- 6 files changed, 20 insertions(+), 10 deletions(-) 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/debian/changelog b/debian/changelog index 1786bdfb7..8b566e5c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,9 @@ apt (0.6.47) UNRELEASED; urgency=low - fix error translation that causes trouble to lsb_release * apt-pkg/acquire-item.cc: - if decompression of a index fails, delete the index + * [ABI] apt-pkg/acquire.{cc,h}: + - deal better with duplicated sources.list entries (avoid + double queuing of URLs) - this fixes hangs in bzip/gzip -- Michael Vogt Mon, 18 Dec 2006 19:39:05 +0100 diff --git a/methods/makefile b/methods/makefile index 1e3b1ef85..3f561a2c3 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 3.11 +LIB_APT_PKG_MAJOR = 3.12 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3