Просмотр исходного кода

* [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 лет назад: 19
Родитель
Сommit
c03462c6fe
6 измененных файлов с 20 добавлено и 10 удалено
  1. 13 6
      apt-pkg/acquire.cc
  2. 1 1
      apt-pkg/acquire.h
  3. 1 1
      apt-pkg/init.h
  4. 1 1
      apt-pkg/makefile
  5. 3 0
      debian/changelog
  6. 1 1
      methods/makefile

+ 13 - 6
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			/*{{{*/

+ 1 - 1
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

+ 1 - 1
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;

+ 1 - 1
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)

+ 3 - 0
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 <michael.vogt@ubuntu.com>  Mon, 18 Dec 2006 19:39:05 +0100
 

+ 1 - 1
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