]> git.saurik.com Git - apt.git/commitdiff
* merged with apt--mvo
authorMichael Vogt <mvo@debian.org>
Wed, 30 Nov 2005 15:34:28 +0000 (15:34 +0000)
committerMichael Vogt <mvo@debian.org>
Wed, 30 Nov 2005 15:34:28 +0000 (15:34 +0000)
Patches applied:

 * apt@packages.debian.org/apt--sources-list-d--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-30

 * apt@packages.debian.org/apt--sources-list-d--0--patch-1
   Patch from apt-rpm via Michael Vogt to implement /etc/apt/sources.list.d

 * bubulle@debian.org--2005/apt--main--0--patch-130
   Galician translation completed

 * bubulle@debian.org--2005/apt--main--0--patch-131
   Simplified Chinese translation update

 * bubulle@debian.org--2005/apt--main--0--patch-132
   Completed Simplified Chinese translation

 * bubulle@debian.org--2005/apt--main--0--patch-133
   Merge with Michael AND update PO files

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-90
   * merged the sources.list.d patch

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-91
   * merged with bubulle

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-92
   * changelog update

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-93
   * sources.list.d documented

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-94
   * pkgDirStream has (slightly) better extract support now

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-95
   * merge fix for #339533

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-96
   * merged with bubulle

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-97
   * some more debug output

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-98
   * ABI change: merged more flexible pkgAcquireFile code

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-99
   * merged http download limit for apt (#146877)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-100
   * applied parts of the string speedup patch from debian #319377 (ABI change)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-101
   * fix for #340448

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-102
   * finalized this release

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-103
   * changelog updates

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-104
   * build-depend on libdb4.3 now, fix for kFreeBSD (#317718)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-105
   * fix mailaddress

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-106
   * fix a string (thanks to bubulle)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-107
   * merged with bubulle

15 files changed:
1  2 
apt-pkg/acquire-item.cc
apt-pkg/acquire-item.h
apt-pkg/cacheiterators.h
apt-pkg/contrib/strutl.cc
apt-pkg/contrib/strutl.h
apt-pkg/deb/deblistparser.cc
apt-pkg/init.cc
apt-pkg/pkgcache.cc
apt-pkg/pkgcache.h
apt-pkg/pkgcachegen.cc
apt-pkg/pkgcachegen.h
configure.in
debian/changelog
methods/http.cc
po/apt-all.pot

diff --combined apt-pkg/acquire-item.cc
index 7c1626bff938307103567f822cab2889dc38f5b6,88c25de437e52f0cbe9a0171eca4809c895e54b5..2392f0f8d08ce2c4a77de6f3009fe7727c64826a
@@@ -24,8 -24,6 +24,8 @@@
  #include <apt-pkg/strutl.h>
  #include <apt-pkg/fileutl.h>
  #include <apt-pkg/md5.h>
 +#include <apt-pkg/sha1.h>
 +#include <apt-pkg/tagfile.h>
  
  #include <apti18n.h>
      
@@@ -33,7 -31,6 +33,7 @@@
  #include <unistd.h>
  #include <errno.h>
  #include <string>
 +#include <sstream>
  #include <stdio.h>
                                                                        /*}}}*/
  
@@@ -134,410 -131,14 +134,410 @@@ void pkgAcquire::Item::Rename(string Fr
  }
                                                                        /*}}}*/
  
 +
 +// AcqDiffIndex::AcqDiffIndex - Constructor                   
 +// ---------------------------------------------------------------------
 +/* Get the DiffIndex file first and see if there are patches availabe 
 + * If so, create a pkgAcqIndexDiffs fetcher that will get and apply the
 + * patches. If anything goes wrong in that process, it will fall back to
 + * the original packages file
 + */
 +pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner,
 +                               string URI,string URIDesc,string ShortDesc,
 +                               string ExpectedMD5)
 +   : Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5), Description(URIDesc)
 +{
 +   
 +   Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
 +
 +   Desc.Description = URIDesc + "/DiffIndex";
 +   Desc.Owner = this;
 +   Desc.ShortDesc = ShortDesc;
 +   Desc.URI = URI + ".diff/Index";
 +
 +   DestFile = _config->FindDir("Dir::State::lists") + "partial/";
 +   DestFile += URItoFileName(URI) + string(".DiffIndex");
 +
 +   if(Debug)
 +      std::clog << "pkgAcqDiffIndex: " << Desc.URI << std::endl;
 +
 +   // look for the current package file
 +   CurrentPackagesFile = _config->FindDir("Dir::State::lists");
 +   CurrentPackagesFile += URItoFileName(RealURI);
 +
 +   if(!FileExists(CurrentPackagesFile) || 
 +      !_config->FindB("Acquire::Diffs",true)) {
 +      // we don't have a pkg file or we don't want to queue
 +      if(Debug)
 +       std::clog << "No index file or canceld by user" << std::endl;
 +      Failed("", NULL);
 +      return;
 +   }
 +
 +   if(Debug) {
 +      std::clog << "pkgAcqIndexDiffs::pkgAcqIndexDiffs(): " 
 +              << CurrentPackagesFile << std::endl;
 +   }
 +
 +   QueueURI(Desc);
 +
 +}
 +
 +// AcqIndex::Custom600Headers - Insert custom request headers         /*{{{*/
 +// ---------------------------------------------------------------------
 +/* The only header we use is the last-modified header. */
 +string pkgAcqDiffIndex::Custom600Headers()
 +{
 +   string Final = _config->FindDir("Dir::State::lists");
 +   Final += URItoFileName(RealURI) + string(".IndexDiff");
 +   
 +   if(Debug)
 +      std::clog << "Custom600Header-IMS: " << Final << std::endl;
 +
 +   struct stat Buf;
 +   if (stat(Final.c_str(),&Buf) != 0)
 +      return "\nIndex-File: true";
 +   
 +   return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
 +}
 +
 +
 +bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)
 +{
 +   if(Debug)
 +      std::clog << "pkgAcqIndexDiffs::ParseIndexDiff() " << IndexDiffFile 
 +              << std::endl;
 +
 +   pkgTagSection Tags;
 +   string ServerSha1;
 +   vector<DiffInfo> available_patches;
 +   
 +   FileFd Fd(IndexDiffFile,FileFd::ReadOnly);
 +   pkgTagFile TF(&Fd);
 +   if (_error->PendingError() == true)
 +      return false;
 +
 +   if(TF.Step(Tags) == true)
 +   {
 +      string local_sha1;
 +      bool found = false;
 +      DiffInfo d;
 +      string size;
 +
 +      string tmp = Tags.FindS("SHA1-Current");
 +      std::stringstream ss(tmp);
 +      ss >> ServerSha1;
 +
 +      FileFd fd(CurrentPackagesFile, FileFd::ReadOnly);
 +      SHA1Summation SHA1;
 +      SHA1.AddFD(fd.Fd(), fd.Size());
 +      local_sha1 = string(SHA1.Result());
 +
 +      if(local_sha1 == ServerSha1) {
 +       if(Debug)
 +          std::clog << "Package file is up-to-date" << std::endl;
 +       // set found to true, this will queue a pkgAcqIndexDiffs with
 +       // a empty availabe_patches
 +       found = true;
 +      } else {
 +       if(Debug)
 +          std::clog << "SHA1-Current: " << ServerSha1 << std::endl;
 +
 +       // check the historie and see what patches we need
 +       string history = Tags.FindS("SHA1-History");     
 +       std::stringstream hist(history);
 +       while(hist >> d.sha1 >> size >> d.file) {
 +          d.size = atoi(size.c_str());
 +          // read until the first match is found
 +          if(d.sha1 == local_sha1) 
 +             found=true;
 +          // from that point on, we probably need all diffs
 +          if(found) {
 +             if(Debug)
 +                std::clog << "Need to get diff: " << d.file << std::endl;
 +             available_patches.push_back(d);
 +          }
 +       }
 +      }
 +
 +      // no information how to get the patches, bail out
 +      if(!found) {
 +       if(Debug)
 +          std::clog << "Can't find a patch in the index file" << std::endl;
 +       // Failed will queue a big package file
 +       Failed("", NULL);
 +      } else {
 +       // queue the diffs
 +       new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
 +                            ExpectedMD5, available_patches);
 +       Complete = false;
 +       Status = StatDone;
 +       Dequeue();
 +       return true;
 +      }
 +   }
 +
 +   return false;
 +}
 +
 +void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 +{
 +   if(Debug)
 +      std::clog << "pkgAcqDiffIndex failed: " << Desc.URI << std::endl
 +              << "Falling back to normal index file aquire" << std::endl;
 +
 +   new pkgAcqIndex(Owner, RealURI, Description, Desc.ShortDesc, 
 +                 ExpectedMD5);
 +
 +   Complete = false;
 +   Status = StatDone;
 +   Dequeue();
 +}
 +
 +void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash,
 +                         pkgAcquire::MethodConfig *Cnf)
 +{
 +   if(Debug)
 +      std::clog << "pkgAcqDiffIndex::Done(): " << Desc.URI << std::endl;
 +
 +   Item::Done(Message,Size,Md5Hash,Cnf);
 +
 +   string FinalFile;
 +   FinalFile = _config->FindDir("Dir::State::lists")+URItoFileName(RealURI);
 +
 +   // sucess in downloading the index
 +   // rename the index
 +   FinalFile += string(".IndexDiff");
 +   if(Debug)
 +      std::clog << "Renaming: " << DestFile << " -> " << FinalFile 
 +              << std::endl;
 +   Rename(DestFile,FinalFile);
 +   chmod(FinalFile.c_str(),0644);
 +   DestFile = FinalFile;
 +
 +   if(!ParseDiffIndex(DestFile))
 +      return Failed("", NULL);
 +
 +   Complete = true;
 +   Status = StatDone;
 +   Dequeue();
 +   return;
 +}
 +
 +
 +
 +// AcqIndexDiffs::AcqIndexDiffs - Constructor                 
 +// ---------------------------------------------------------------------
 +/* The package diff is added to the queue. one object is constructed
 + * for each diff and the index
 + */
 +pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
 +                                 string URI,string URIDesc,string ShortDesc,
 +                                 string ExpectedMD5, vector<DiffInfo> diffs)
 +   : Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5), 
 +     available_patches(diffs)
 +{
 +   
 +   DestFile = _config->FindDir("Dir::State::lists") + "partial/";
 +   DestFile += URItoFileName(URI);
 +
 +   Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
 +
 +   Desc.Description = URIDesc;
 +   Desc.Owner = this;
 +   Desc.ShortDesc = ShortDesc;
 +
 +   if(available_patches.size() == 0) {
 +      // we are done (yeah!)
 +      Finish(true);
 +   } else {
 +      // get the next diff
 +      State = StateFetchDiff;
 +      QueueNextDiff();
 +   }
 +}
 +
 +
 +void pkgAcqIndexDiffs::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 +{
 +   if(Debug)
 +      std::clog << "pkgAcqIndexDiffs failed: " << Desc.URI << std::endl
 +              << "Falling back to normal index file acquire" << std::endl;
 +   new pkgAcqIndex(Owner, RealURI, Description,Desc.ShortDesc, 
 +                 ExpectedMD5);
 +   Finish();
 +}
 +
 +
 +// helper that cleans the item out of the fetcher queue
 +void pkgAcqIndexDiffs::Finish(bool allDone)
 +{
 +   // we restore the original name, this is required, otherwise
 +   // the file will be cleaned
 +   if(allDone) {
 +      DestFile = _config->FindDir("Dir::State::lists");
 +      DestFile += URItoFileName(RealURI);
 +
 +      // do the final md5sum checking
 +      MD5Summation sum;
 +      FileFd Fd(DestFile, FileFd::ReadOnly);
 +      sum.AddFD(Fd.Fd(), Fd.Size());
 +      Fd.Close();
 +      string MD5 = (string)sum.Result();
 +
 +      if (!ExpectedMD5.empty() && MD5 != ExpectedMD5)
 +      {
 +       Status = StatAuthError;
 +       ErrorText = _("MD5Sum mismatch");
 +       Rename(DestFile,DestFile + ".FAILED");
 +       Dequeue();
 +       return;
 +      }
 +
 +      // this is for the "real" finish
 +      Complete = true;
 +      Status = StatDone;
 +      Dequeue();
 +      if(Debug)
 +       std::clog << "\n\nallDone: " << DestFile << "\n" << std::endl;
 +      return;
 +   }
 +
 +   if(Debug)
 +      std::clog << "Finishing: " << Desc.URI << std::endl;
 +   Complete = false;
 +   Status = StatDone;
 +   Dequeue();
 +   return;
 +}
 +
 +
 +
 +bool pkgAcqIndexDiffs::QueueNextDiff()
 +{
 +
 +   // calc sha1 of the just patched file
 +   string FinalFile = _config->FindDir("Dir::State::lists");
 +   FinalFile += URItoFileName(RealURI);
 +
 +   FileFd fd(FinalFile, FileFd::ReadOnly);
 +   SHA1Summation SHA1;
 +   SHA1.AddFD(fd.Fd(), fd.Size());
 +   string local_sha1 = string(SHA1.Result());
 +   if(Debug)
 +      std::clog << "QueueNextDiff: " 
 +              << FinalFile << " (" << local_sha1 << ")"<<std::endl;
 +
 +   // remove all patches until the next matching patch is found
 +   // this requires the Index file to be ordered
 +   for(vector<DiffInfo>::iterator I=available_patches.begin();
 +       available_patches.size() > 0 && I != available_patches.end() 
 +        && (*I).sha1 != local_sha1; 
 +       I++) {
 +      available_patches.erase(I);
 +   }
 +
 +   // error checking and falling back if no patch was found
 +   if(available_patches.size() == 0) { 
 +      Failed("", NULL);
 +      return false;
 +   }
 +
 +   // queue the right diff
 +   Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz";
 +   Desc.Description = available_patches[0].file + string(".pdiff");
 +
 +   DestFile = _config->FindDir("Dir::State::lists") + "partial/";
 +   DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file);
 +
 +   if(Debug)
 +      std::clog << "pkgAcqIndexDiffs::QueueNextDiff(): " << Desc.URI << std::endl;
 +   
 +   QueueURI(Desc);
 +
 +   return true;
 +}
 +
 +
 +
 +void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash,
 +                          pkgAcquire::MethodConfig *Cnf)
 +{
 +   if(Debug)
 +      std::clog << "pkgAcqIndexDiffs::Done(): " << Desc.URI << std::endl;
 +
 +   Item::Done(Message,Size,Md5Hash,Cnf);
 +
 +   string FinalFile;
 +   FinalFile = _config->FindDir("Dir::State::lists")+URItoFileName(RealURI);
 +
 +   // sucess in downloading a diff, enter ApplyDiff state
 +   if(State == StateFetchDiff) 
 +   {
 +
 +      if(Debug)
 +       std::clog << "Sending to gzip method: " << FinalFile << std::endl;
 +
 +      string FileName = LookupTag(Message,"Filename");
 +      State = StateUnzipDiff;
 +      Desc.URI = "gzip:" + FileName;
 +      DestFile += ".decomp";
 +      QueueURI(Desc);
 +      Mode = "gzip";
 +      return;
 +   } 
 +
 +   // sucess in downloading a diff, enter ApplyDiff state
 +   if(State == StateUnzipDiff) 
 +   {
 +
 +      // rred excepts the patch as $FinalFile.ed
 +      Rename(DestFile,FinalFile+".ed");
 +
 +      if(Debug)
 +       std::clog << "Sending to rred method: " << FinalFile << std::endl;
 +
 +      State = StateApplyDiff;
 +      Desc.URI = "rred:" + FinalFile;
 +      QueueURI(Desc);
 +      Mode = "rred";
 +      return;
 +   } 
 +
 +
 +   // success in download/apply a diff, queue next (if needed)
 +   if(State == StateApplyDiff)
 +   {
 +      // remove the just applied patch
 +      available_patches.erase(available_patches.begin());
 +
 +      // move into place
 +      if(Debug) 
 +      {
 +       std::clog << "Moving patched file in place: " << std::endl
 +                 << DestFile << " -> " << FinalFile << std::endl;
 +      }
 +      Rename(DestFile,FinalFile);
 +
 +      // see if there is more to download
 +      if(available_patches.size() > 0) {
 +       new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
 +                            ExpectedMD5, available_patches);
 +       return Finish();
 +      } else 
 +       return Finish(true);
 +   }
 +}
 +
 +
  // AcqIndex::AcqIndex - Constructor                                   /*{{{*/
  // ---------------------------------------------------------------------
  /* The package file is added to the queue and a second class is 
     instantiated to fetch the revision file */   
  pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
                         string URI,string URIDesc,string ShortDesc,
 -                       string ExpectedMD5, string comprExt) :
 -   Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5)
 +                       string ExpectedMD5, string comprExt)
 +   Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5)
  {
     Decompression = false;
     Erase = false;
@@@ -583,7 -184,7 +583,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,Desc.URI.size()-1) == "bz2") {
+    if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") {
        Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz"; 
  
        // retry with a gzip one 
@@@ -689,7 -290,7 +689,7 @@@ void pkgAcqIndex::Done(string Message,u
     else
        Local = true;
     
-    string compExt = Desc.URI.substr(Desc.URI.size()-3,Desc.URI.size()-1);
+    string compExt = Desc.URI.substr(Desc.URI.size()-3);
     char *decompProg;
     if(compExt == "bz2") 
        decompProg = "bzip2";
     Mode = decompProg;
  }
  
 +// AcqIndexTrans::pkgAcqIndexTrans - Constructor                      /*{{{*/
 +// ---------------------------------------------------------------------
 +/* The Translation file is added to the queue */
 +pkgAcqIndexTrans::pkgAcqIndexTrans(pkgAcquire *Owner,
 +                          string URI,string URIDesc,string ShortDesc) :
 +                      pkgAcqIndex(Owner, URI, URIDesc, ShortDesc, "", "")
 +{
 +}
 +
 +                                                                      /*}}}*/
 +// AcqIndexTrans::Failed - Silence failure messages for missing files /*{{{*/
 +// ---------------------------------------------------------------------
 +/* */
 +void pkgAcqIndexTrans::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 +{
 +   if (Cnf->LocalOnly == true || 
 +       StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
 +   {      
 +      // Ignore this
 +      Status = StatDone;
 +      Complete = false;
 +      Dequeue();
 +      return;
 +   }
 +   
 +   Item::Failed(Message,Cnf);
 +}
 +                                                                      /*}}}*/
 +
  pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
                             string URI,string URIDesc,string ShortDesc,
                             string MetaIndexURI, string MetaIndexURIDesc,
                             const vector<IndexTarget*>* IndexTargets,
                             indexRecords* MetaIndexParser) :
     Item(Owner), RealURI(URI), MetaIndexURI(MetaIndexURI),
-    MetaIndexURIDesc(MetaIndexURIDesc), MetaIndexShortDesc(MetaIndexShortDesc)
+    MetaIndexURIDesc(MetaIndexURIDesc), MetaIndexShortDesc(MetaIndexShortDesc),
+    MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets)
  {
-    this->MetaIndexParser = MetaIndexParser;
-    this->IndexTargets = IndexTargets;
     DestFile = _config->FindDir("Dir::State::lists") + "partial/";
     DestFile += URItoFileName(URI);
  
@@@ -858,11 -429,9 +857,9 @@@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcq
                                 string SigFile,
                                 const vector<struct IndexTarget*>* IndexTargets,
                                 indexRecords* MetaIndexParser) :
-   Item(Owner), RealURI(URI), SigFile(SigFile)
+    Item(Owner), RealURI(URI), SigFile(SigFile), AuthPass(false),
+    MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets)
  {
-    this->AuthPass = false;
-    this->MetaIndexParser = MetaIndexParser;
-    this->IndexTargets = IndexTargets;
     DestFile = _config->FindDir("Dir::State::lists") + "partial/";
     DestFile += URItoFileName(URI);
  
@@@ -1035,8 -604,8 +1032,8 @@@ void pkgAcqMetaIndex::QueueIndexes(boo
        }
        
        // Queue Packages file
 -      new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
 -                      (*Target)->ShortDesc, ExpectedIndexMD5);
 +      new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description,
 +                        (*Target)->ShortDesc, ExpectedIndexMD5);
     }
  }
  
@@@ -1436,13 -1005,19 +1433,19 @@@ void pkgAcqArchive::Finished(
  // ---------------------------------------------------------------------
  /* The file is added to the queue */
  pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,
-                      unsigned long Size,string Dsc,string ShortDesc) :
+                      unsigned long Size,string Dsc,string ShortDesc,
+                      const string &DestDir, const string &DestFilename) :
                         Item(Owner), Md5Hash(MD5)
  {
     Retries = _config->FindI("Acquire::Retries",0);
     
-    DestFile = flNotDir(URI);
-    
+    if(!DestFilename.empty())
+       DestFile = DestFilename;
+    else if(!DestDir.empty())
+       DestFile = DestDir + "/" + flNotDir(URI);
+    else
+       DestFile = flNotDir(URI);
     // Create the item
     Desc.URI = URI;
     Desc.Description = Dsc;
diff --combined apt-pkg/acquire-item.h
index 323dff2564461a67f106055cecac868e054cbc8f,c34b5ef698bc40d560d79d9868a701bca14a631a..58c915344dc0e90a30cc5933ba77a85c5685ff76
@@@ -9,8 -9,8 +9,8 @@@
     the Owner Acquire class. Derived classes will then call QueueURI to 
     register all the URI's they wish to fetch at the initial moment.   
     
 -   Two item classes are provided to provide functionality for downloading
 -   of Index files and downloading of Packages.
 +   Three item classes are provided to provide functionality for
 +   downloading of Index, Translation and Packages files.
     
     A Archive class is provided for downloading .deb files. It does Md5
     checking and source location as well as a retry algorithm.
  #pragma interface "apt-pkg/acquire-item.h"
  #endif 
  
 -// Item to acquire
 +/** \addtogroup acquire
 + *  @{
 + *
 + *  \file acquire-item.h
 + */
 +
 +/** \brief Represents the process by which a pkgAcquire object should
 + *  retrieve a file or a collection of files.
 + *
 + *  By convention, Item subclasses should insert themselves into the
 + *  acquire queue when they are created by calling QueueURI(), and
 + *  remove themselves by calling Dequeue() when either Done() or
 + *  Failed() is invoked.  Item objects are also responsible for
 + *  notifying the download progress indicator (accessible via
 + *  #Owner->Log) of their status.
 + *
 + *  \see pkgAcquire
 + */
  class pkgAcquire::Item
  {  
     protected:
     
 -   // Some private helper methods for registering URIs
 +   /** \brief The acquire object with which this item is associated. */
     pkgAcquire *Owner;
 +
 +   /** \brief Insert this item into its owner's queue.
 +    *
 +    *  \param ItemDesc Metadata about this item (its URI and
 +    *  description).
 +    */
     inline void QueueURI(ItemDesc &Item)
                   {Owner->Enqueue(Item);};
 +
 +   /** \brief Remove this item from its owner's queue. */
     inline void Dequeue() {Owner->Dequeue(this);};
     
 -   // Safe rename function with timestamp preservation
 +   /** \brief Rename a file without modifying its timestamp.
 +    *
 +    *  Many item methods call this as their final action.
 +    *
 +    *  \param From The file to be renamed.
 +    *
 +    *  \param To The new name of #From.  If #To exists it will be
 +    *  overwritten.
 +    */
     void Rename(string From,string To);
     
     public:
  
 -   // State of the item
 -   enum {StatIdle, StatFetching, StatDone, StatError, StatAuthError} Status;
 +   /** \brief The current status of this item. */
 +   enum ItemState
 +     {
 +       /** \brief The item is waiting to be downloaded. */
 +       StatIdle,
 +
 +       /** \brief The item is currently being downloaded. */
 +       StatFetching,
 +
 +       /** \brief The item has been successfully downloaded. */
 +       StatDone,
 +
 +       /** \brief An error was encountered while downloading this
 +      *  item.
 +      */
 +       StatError,
 +
 +       /** \brief The item was downloaded but its authenticity could
 +      *  not be verified.
 +      */
 +       StatAuthError
 +     } Status;
 +
 +   /** \brief Contains a textual description of the error encountered
 +    *  if #Status is #StatError or #StatAuthError.
 +    */
     string ErrorText;
 +
 +   /** \brief The size of the object to fetch. */
     unsigned long FileSize;
 -   unsigned long PartialSize;   
 +
 +   /** \brief How much of the object was already fetched. */
 +   unsigned long PartialSize;
 +
 +   /** \brief If not \b NULL, contains the name of a subprocess that
 +    *  is operating on this object (for instance, "gzip" or "gpgv").
 +    */
     const char *Mode;
 +
 +   /** \brief A client-supplied unique identifier.
 +    * 
 +    *  This field is initalized to 0; it is meant to be filled in by
 +    *  clients that wish to use it to uniquely identify items.
 +    *
 +    *  \todo it's unused in apt itself
 +    */
     unsigned long ID;
 +
 +   /** \brief If \b true, the entire object has been successfully fetched.
 +    *
 +    *  Subclasses should set this to \b true when appropriate.
 +    */
     bool Complete;
 +
 +   /** \brief If \b true, the URI of this object is "local".
 +    *
 +    *  The only effect of this field is to exclude the object from the
 +    *  download progress indicator's overall statistics.
 +    */
     bool Local;
  
 -   // Number of queues we are inserted into
 +   /** \brief The number of fetch queues into which this item has been
 +    *  inserted.
 +    *
 +    *  There is one queue for each source from which an item could be
 +    *  downloaded.
 +    *
 +    *  \sa pkgAcquire
 +    */
     unsigned int QueueCounter;
     
 -   // File to write the fetch into
 +   /** \brief The name of the file into which the retrieved object
 +    *  will be written.
 +    */
     string DestFile;
  
 -   // Action members invoked by the worker
 +   /** \brief Invoked by the acquire worker when the object couldn't
 +    *  be fetched.
 +    *
 +    *  This is a branch of the continuation of the fetch process.
 +    *
 +    *  \param Message An RFC822-formatted message from the acquire
 +    *  method describing what went wrong.  Use LookupTag() to parse
 +    *  it.
 +    *
 +    *  \param Cnf The method via which the worker tried to fetch this object.
 +    *
 +    *  \sa pkgAcqMethod
 +    */
     virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 +
 +   /** \brief Invoked by the acquire worker when the object was
 +    *  fetched successfully.
 +    *
 +    *  Note that the object might \e not have been written to
 +    *  DestFile; check for the presence of an Alt-Filename entry in
 +    *  Message to find the file to which it was really written.
 +    *
 +    *  Done is often used to switch from one stage of the processing
 +    *  to the next (e.g. fetching, unpacking, copying).  It is one
 +    *  branch of the continuation of the fetch process.
 +    *
 +    *  \param Message Data from the acquire method.  Use LookupTag()
 +    *  to parse it.
 +    *  \param Size The size of the object that was fetched.
 +    *  \param Md5Hash The MD5Sum of the object that was fetched.
 +    *  \param Cnf The method via which the object was fetched.
 +    *
 +    *  \sa pkgAcqMethod
 +    */
     virtual void Done(string Message,unsigned long Size,string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
 +
 +   /** \brief Invoked when the worker starts to fetch this object.
 +    *
 +    *  \param Message RFC822-formatted data from the worker process.
 +    *  Use LookupTag() to parse it.
 +    *
 +    *  \param Size The size of the object being fetched.
 +    *
 +    *  \sa pkgAcqMethod
 +    */
     virtual void Start(string Message,unsigned long Size);
 +
 +   /** \brief Custom headers to be sent to the fetch process.
 +    *
 +    *  \return a string containing RFC822-style headers that are to be
 +    *  inserted into the 600 URI Acquire message sent to the fetch
 +    *  subprocess.  The headers are inserted after a newline-less
 +    *  line, so they should (if nonempty) have a leading newline and
 +    *  no trailing newline.
 +    */
     virtual string Custom600Headers() {return string();};
 +
 +   /** \brief A "descriptive" URI-like string.
 +    *
 +    *  \return a URI that should be used to describe what is being fetched.
 +    */
     virtual string DescURI() = 0;
 +   /** \brief Short item description.
 +    *
 +    *  \return a brief description of the object being fetched.
 +    */
     virtual string ShortDesc() {return DescURI();}
 +
 +   /** \brief Invoked by the worker when the download is completely done. */
     virtual void Finished() {};
     
 -   // Inquire functions
 +   /** \brief MD5Sum.
 +    *
 +    *  \return the MD5Sum of this object, if applicable; otherwise, an
 +    *  empty string.
 +    */
     virtual string MD5Sum() {return string();};
 +
 +   /** \return the acquire process with which this item is associated. */
     pkgAcquire *GetOwner() {return Owner;};
 +
 +   /** \return \b true if this object is being fetched from a trusted source. */
     virtual bool IsTrusted() {return false;};
 -   
 +
 +   /** \brief Initialize an item.
 +    *
 +    *  Adds the item to the list of items known to the acquire
 +    *  process, but does not place it into any fetch queues (you must
 +    *  manually invoke QueueURI() to do so).
 +    *
 +    *  Initializes all fields of the item other than Owner to 0,
 +    *  false, or the empty string.
 +    *
 +    *  \param Owner The new owner of this item.
 +    */
     Item(pkgAcquire *Owner);
 +
 +   /** \brief Remove this item from its owner's queue by invoking
 +    *  pkgAcquire::Remove.
 +    */
     virtual ~Item();
  };
  
 -// Item class for index files
 -class pkgAcqIndex : public pkgAcquire::Item
 +/** \brief Information about an index patch (aka diff). */
 +struct DiffInfo {
 +   /** The filename of the diff. */
 +   string file;
 +
 +   /** The sha1 hash of the diff. */
 +   string sha1;
 +
 +   /** The size of the diff. */
 +   unsigned long size;
 +};
 +
 +/** \brief An item that is responsible for fetching an index file of
 + *  package list diffs and starting the package list's download.
 + *
 + *  This item downloads the Index file and parses it, then enqueues
 + *  additional downloads of either the individual patches (using
 + *  pkgAcqIndexDiffs) or the entire Packages file (using pkgAcqIndex).
 + *
 + *  \sa pkgAcqIndexDiffs, pkgAcqIndex
 + */
 +class pkgAcqDiffIndex : public pkgAcquire::Item
  {
 + protected:
 +   /** \brief If \b true, debugging information will be written to std::clog. */
 +   bool Debug;
 +
 +   /** \brief The item that is currently being downloaded. */
 +   pkgAcquire::ItemDesc Desc;
 +
 +   /** \brief The URI of the index file to recreate at our end (either
 +    *  by downloading it or by applying partial patches).
 +    */
 +   string RealURI;
 +
 +   /** \brief The MD5Sum that the real index file should have after
 +    *  all patches have been applied.
 +    */
 +   string ExpectedMD5;
 +
 +   /** \brief The index file which will be patched to generate the new
 +    *  file.
 +    */
 +   string CurrentPackagesFile;
 +
 +   /** \brief A description of the Packages file (stored in
 +    *  pkgAcquire::ItemDesc::Description).
 +    */
 +   string Description;
 +
 + public:
 +   // Specialized action members
 +   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(string Message,unsigned long Size,string Md5Hash,
 +                   pkgAcquire::MethodConfig *Cnf);
 +   virtual string DescURI() {return RealURI + "Index";};
 +   virtual string Custom600Headers();
 +
 +   /** \brief Parse the Index file for a set of Packages diffs.
 +    *
 +    *  Parses the Index file and creates additional download items as
 +    *  necessary.
 +    *
 +    *  \param IndexDiffFile The name of the Index file.
 +    *
 +    *  \return \b true if the Index file was successfully parsed, \b
 +    *  false otherwise.
 +    */
 +   bool ParseDiffIndex(string IndexDiffFile);
 +   
 +
 +   /** \brief Create a new pkgAcqDiffIndex.
 +    *
 +    *  \param Owner The Acquire object that owns this item.
 +    *
 +    *  \param URI The URI of the list file to download.
 +    *
 +    *  \param URIDesc A long description of the list file to download.
 +    *
 +    *  \param ShortDesc A short description of the list file to download.
 +    *
 +    *  \param ExpectedMD5 The list file's MD5 signature.
 +    */
 +   pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
 +                 string ShortDesc, string ExpectedMD5);
 +};
 +
 +/** \brief An item that is responsible for fetching all the patches
 + *  that need to be applied to a given package index file.
 + *
 + *  After downloading and applying a single patch, this item will
 + *  enqueue a new pkgAcqIndexDiffs to download and apply the remaining
 + *  patches.  If no patch can be found that applies to an intermediate
 + *  file or if one of the patches cannot be downloaded, falls back to
 + *  downloading the entire package index file using pkgAcqIndex.
 + *
 + *  \sa pkgAcqDiffIndex, pkgAcqIndex
 + */
 +class pkgAcqIndexDiffs : public pkgAcquire::Item
 +{
 +   private:
 +
 +   /** \brief Queue up the next diff download.
 +    *
 +    *  Search for the next available diff that applies to the file
 +    *  that currently exists on disk, and enqueue it by calling
 +    *  QueueURI().
 +    *
 +    *  \return \b true if an applicable diff was found, \b false
 +    *  otherwise.
 +    */
 +   bool QueueNextDiff();
 +
 +   /** \brief Handle tasks that must be performed after the item
 +    *  finishes downloading.
 +    *
 +    *  Dequeues the item and checks the resulting file's md5sum
 +    *  against ExpectedMD5 after the last patch was applied.
 +    *  There is no need to check the md5/sha1 after a "normal" 
 +    *  patch because QueueNextDiff() will check the sha1 later.
 +    *
 +    *  \param allDone If \b true, the file was entirely reconstructed,
 +    *  and its md5sum is verified. 
 +    */
 +   void Finish(bool allDone=false);
 +
     protected:
 +
 +   /** \brief If \b true, debugging output will be written to
 +    *  std::clog.
 +    */
 +   bool Debug;
 +
 +   /** \brief A description of the item that is currently being
 +    *  downloaded.
 +    */
 +   pkgAcquire::ItemDesc Desc;
 +
 +   /** \brief The URI of the package index file that is being
 +    *  reconstructed.
 +    */
 +   string RealURI;
 +
 +   /** \brief The MD5Sum of the package index file that is being
 +    *  reconstructed.
 +    */
 +   string ExpectedMD5;
 +
 +   /** A description of the file being downloaded. */
 +   string Description;
 +
 +   /** The patches that remain to be downloaded, including the patch
 +    *  being downloaded right now.  This list should be ordered so
 +    *  that each diff appears before any diff that depends on it.
 +    *
 +    *  \todo These are indexed by sha1sum; why not use some sort of
 +    *  dictionary instead of relying on ordering and stripping them
 +    *  off the front?
 +    */
 +   vector<DiffInfo> available_patches;
 +   /** The current status of this patch. */
 +   enum DiffState
 +     {
 +      /** \brief The diff is in an unknown state. */
 +       StateFetchUnkown,
 +
 +       /** \brief The diff is currently being fetched. */
 +       StateFetchDiff,
 +       
 +       /** \brief The diff is currently being uncompressed. */
 +       StateUnzipDiff,
 +
 +       /** \brief The diff is currently being applied. */
 +       StateApplyDiff
 +   } State;
 +
 +   public:
     
 +   /** \brief Called when the patch file failed to be downloaded.
 +    *
 +    *  This method will fall back to downloading the whole index file
 +    *  outright; its arguments are ignored.
 +    */
 +   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 +
 +   virtual void Done(string Message,unsigned long Size,string Md5Hash,
 +                   pkgAcquire::MethodConfig *Cnf);
 +   virtual string DescURI() {return RealURI + "Index";};
 +
 +   /** \brief Create an index diff item.
 +    *
 +    *  After filling in its basic fields, this invokes Finish(true) if
 +    *  #diffs is empty, or QueueNextDiff() otherwise.
 +    *
 +    *  \param Owner The pkgAcquire object that owns this item.
 +    *
 +    *  \param URI The URI of the package index file being
 +    *  reconstructed.
 +    *
 +    *  \param URIDesc A long description of this item.
 +    *
 +    *  \param ShortDesc A brief description of this item.
 +    *
 +    *  \param ExpectedMD5 The expected md5sum of the completely
 +    *  reconstructed package index file; the index file will be tested
 +    *  against this value when it is entirely reconstructed.
 +    *
 +    *  \param diffs The remaining diffs from the index of diffs.  They
 +    *  should be ordered so that each diff appears before any diff
 +    *  that depends on it.
 +    */
 +   pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
 +                  string ShortDesc, string ExpectedMD5,
 +                  vector<DiffInfo> diffs=vector<DiffInfo>());
 +};
 +
 +/** \brief An acquire item that is responsible for fetching an index
 + *  file (e.g., Packages or Sources).
 + *
 + *  \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans
 + *
 + *  \todo Why does pkgAcqIndex have protected members?
 + */
 +class pkgAcqIndex : public pkgAcquire::Item
 +{
 +   protected:
 +
 +   /** \brief If \b true, the index file has been decompressed. */
     bool Decompression;
 +
 +   /** \brief If \b true, the partially downloaded file will be
 +    *  removed when the download completes.
 +    */
     bool Erase;
 +
 +   /** \brief The download request that is currently being
 +    *   processed.
 +    */
     pkgAcquire::ItemDesc Desc;
 +
 +   /** \brief The object that is actually being fetched (minus any
 +    *  compression-related extensions).
 +    */
     string RealURI;
 +
 +   /** \brief The expected md5sum of the decompressed index file. */
     string ExpectedMD5;
 +
 +   /** \brief The compression-related file extension that is being
 +    *  added to the downloaded file (e.g., ".gz" or ".bz2").
 +    */
     string CompressionExtension;
  
     public:
     virtual string Custom600Headers();
     virtual string DescURI() {return RealURI + CompressionExtension;};
  
 +   /** \brief Create a pkgAcqIndex.
 +    *
 +    *  \param Owner The pkgAcquire object with which this item is
 +    *  associated.
 +    *
 +    *  \param URI The URI of the index file that is to be downloaded.
 +    *
 +    *  \param URIDesc A "URI-style" description of this index file.
 +    *
 +    *  \param ShortDesc A brief description of this index file.
 +    *
 +    *  \param ExpectedMD5 The expected md5sum of this index file.
 +    *
 +    *  \param compressExt The compression-related extension with which
 +    *  this index file should be downloaded, or "" to autodetect
 +    *  (".bz2" is used if bzip2 is installed, ".gz" otherwise).
 +    */
     pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
 -             string ShortDesct, string ExpectedMD5, string compressExt="");
 +             string ShortDesc, string ExpectedMD5, string compressExt="");
  };
  
 +/** \brief An acquire item that is responsible for fetching a
 + *  translated index file.
 + *
 + *  The only difference from pkgAcqIndex is that transient failures
 + *  are suppressed: no error occurs if the translated index file is
 + *  missing.
 + */
 +class pkgAcqIndexTrans : public pkgAcqIndex
 +{
 +   public:
 +  
 +   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 +
 +   /** \brief Create a pkgAcqIndexTrans.
 +    *
 +    *  \param Owner The pkgAcquire object with which this item is
 +    *  associated.
 +    *
 +    *  \param URI The URI of the index file that is to be downloaded.
 +    *
 +    *  \param URIDesc A "URI-style" description of this index file.
 +    *
 +    *  \param ShortDesc A brief description of this index file.
 +    *
 +    *  \param ExpectedMD5 The expected md5sum of this index file.
 +    *
 +    *  \param compressExt The compression-related extension with which
 +    *  this index file should be downloaded, or "" to autodetect
 +    *  (".bz2" is used if bzip2 is installed, ".gz" otherwise).
 +    */
 +   pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
 +                  string ShortDesc);
 +};
 +
 +/** \brief Information about an index file. */
  struct IndexTarget
  {
 +   /** \brief A URI from which the index file can be downloaded. */
     string URI;
 +
 +   /** \brief A description of the index file. */
     string Description;
 +
 +   /** \brief A shorter description of the index file. */
     string ShortDesc;
 +
 +   /** \brief The key by which this index file should be
 +    *  looked up within the meta signature file.
 +    */
     string MetaKey;
  };
  
 -// Item class for index signatures
 +/** \brief An acquire item that downloads the detached signature
 + *  of a meta-index (Release) file, then queues up the release
 + *  file itself.
 + *
 + *  \todo Why protected members?
 + *
 + *  \sa pkgAcqMetaIndex
 + */
  class pkgAcqMetaSig : public pkgAcquire::Item
  {
     protected:
 -   
 +   /** \brief The fetch request that is currently being processed. */
     pkgAcquire::ItemDesc Desc;
 -   string RealURI,MetaIndexURI,MetaIndexURIDesc,MetaIndexShortDesc;
 +
 +   /** \brief The URI of the signature file.  Unlike Desc.URI, this is
 +    *  never modified; it is used to determine the file that is being
 +    *  downloaded.
 +    */
 +   string RealURI;
 +
 +   /** \brief The URI of the meta-index file to be fetched after the signature. */
 +   string MetaIndexURI;
 +
 +   /** \brief A "URI-style" description of the meta-index file to be
 +    *  fetched after the signature.
 +    */
 +   string MetaIndexURIDesc;
 +
 +   /** \brief A brief description of the meta-index file to be fetched
 +    *  after the signature.
 +    */
 +   string MetaIndexShortDesc;
 +
 +   /** \brief A package-system-specific parser for the meta-index file. */
     indexRecords* MetaIndexParser;
 +
 +   /** \brief The index files which should be looked up in the meta-index
 +    *  and then downloaded.
 +    *
 +    *  \todo Why a list of pointers instead of a list of structs?
 +    */
     const vector<struct IndexTarget*>* IndexTargets;
  
     public:
     virtual string Custom600Headers();
     virtual string DescURI() {return RealURI; };
  
 +   /** \brief Create a new pkgAcqMetaSig. */
     pkgAcqMetaSig(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc,
                 string MetaIndexURI, string MetaIndexURIDesc, string MetaIndexShortDesc,
                 const vector<struct IndexTarget*>* IndexTargets,
                 indexRecords* MetaIndexParser);
  };
  
 -// Item class for index signatures
 +/** \brief An item that is responsible for downloading the meta-index
 + *  file (i.e., Release) itself and verifying its signature.
 + *
 + *  Once the download and verification are complete, the downloads of
 + *  the individual index files are queued up using pkgAcqDiffIndex.
 + *  If the meta-index file had a valid signature, the expected md5sums
 + *  of the index files will be the md5sums listed in the meta-index;
 + *  otherwise, the expected md5sums will be "" (causing the
 + *  authentication of the index files to be bypassed).
 + */
  class pkgAcqMetaIndex : public pkgAcquire::Item
  {
     protected:
 -   
 +   /** \brief The fetch command that is currently being processed. */
     pkgAcquire::ItemDesc Desc;
 -   string RealURI; // FIXME: is this redundant w/ Desc.URI?
 +
 +   /** \brief The URI that is actually being downloaded; never
 +    *  modified by pkgAcqMetaIndex.
 +    */
 +   string RealURI;
 +
 +   /** \brief The file in which the signature for this index was stored.
 +    *
 +    *  If empty, the signature and the md5sums of the individual
 +    *  indices will not be checked.
 +    */
     string SigFile;
 +
 +   /** \brief The index files to download. */
     const vector<struct IndexTarget*>* IndexTargets;
 +
 +   /** \brief The parser for the meta-index file. */
     indexRecords* MetaIndexParser;
 +
 +   /** \brief If \b true, the index's signature is currently being verified.
 +    */
     bool AuthPass;
  
 +   /** \brief Check that the release file is a release file for the
 +    *  correct distribution.
 +    *
 +    *  \return \b true if no fatal errors were encountered.
 +    */
     bool VerifyVendor();
 +
 +   /** \brief Called when a file is finished being retrieved.
 +    *
 +    *  If the file was not downloaded to DestFile, a copy process is
 +    *  set up to copy it to DestFile; otherwise, Complete is set to \b
 +    *  true and the file is moved to its final location.
 +    *
 +    *  \param Message The message block received from the fetch
 +    *  subprocess.
 +    */
     void RetrievalDone(string Message);
 +
 +   /** \brief Called when authentication succeeded.
 +    *
 +    *  Sanity-checks the authenticated file, queues up the individual
 +    *  index files for download, and saves the signature in the lists
 +    *  directory next to the authenticated list file.
 +    *
 +    *  \param Message The message block received from the fetch
 +    *  subprocess.
 +    */
     void AuthDone(string Message);
 +
 +   /** \brief Starts downloading the individual index files.
 +    *
 +    *  \param verify If \b true, only indices whose expected md5sum
 +    *  can be determined from the meta-index will be downloaded, and
 +    *  the md5sums of indices will be checked (reporting
 +    *  #StatAuthError if there is a mismatch).  If verify is \b false,
 +    *  no md5sum checking will be performed.
 +    */
     void QueueIndexes(bool verify);
     
     public:
     virtual string Custom600Headers();
     virtual string DescURI() {return RealURI; };
  
 +   /** \brief Create a new pkgAcqMetaIndex. */
     pkgAcqMetaIndex(pkgAcquire *Owner,
                   string URI,string URIDesc, string ShortDesc,
                   string SigFile,
                   indexRecords* MetaIndexParser);
  };
  
 -// Item class for archive files
 +/** \brief An item that is responsible for fetching a package file.
 + *
 + *  If the package file already exists in the cache, nothing will be
 + *  done.
 + */
  class pkgAcqArchive : public pkgAcquire::Item
  {
     protected:
 -   
 -   // State information for the retry mechanism
 +   /** \brief The package version being fetched. */
     pkgCache::VerIterator Version;
 +
 +   /** \brief The fetch command that is currently being processed. */
     pkgAcquire::ItemDesc Desc;
 +
 +   /** \brief The list of sources from which to pick archives to
 +    *  download this package from.
 +    */
     pkgSourceList *Sources;
 +
 +   /** \brief A package records object, used to look up the file
 +    *  corresponding to each version of the package.
 +    */
     pkgRecords *Recs;
 +
 +   /** \brief The md5sum of this package. */
     string MD5;
 +
 +   /** \brief A location in which the actual filename of the package
 +    *  should be stored.
 +    */
     string &StoreFilename;
 +
 +   /** \brief The next file for this version to try to download. */
     pkgCache::VerFileIterator Vf;
 +
 +   /** \brief How many (more) times to try to find a new source from
 +    *  which to download this package version if it fails.
 +    *
 +    *  Set from Acquire::Retries.
 +    */
     unsigned int Retries;
 +
 +   /** \brief \b true if this version file is being downloaded from a
 +    *  trusted source.
 +    */
     bool Trusted; 
  
 -   // Queue the next available file for download.
 +   /** \brief Queue up the next available file for this version. */
     bool QueueNext();
     
     public:
     
 -   // Specialized action members
     virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
     virtual void Done(string Message,unsigned long Size,string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
     virtual string DescURI() {return Desc.URI;};
     virtual string ShortDesc() {return Desc.ShortDesc;};
     virtual void Finished();
 +
     virtual bool IsTrusted();
     
 +   /** \brief Create a new pkgAcqArchive.
 +    *
 +    *  \param Owner The pkgAcquire object with which this item is
 +    *  associated.
 +    *
 +    *  \param Sources The sources from which to download version
 +    *  files.
 +    *
 +    *  \param Recs A package records object, used to look up the file
 +    *  corresponding to each version of the package.
 +    *
 +    *  \param Version The package version to download.
 +    *
 +    *  \param StoreFilename A location in which the actual filename of
 +    *  the package should be stored.  It will be set to a guessed
 +    *  basename in the constructor, and filled in with a fully
 +    *  qualified filename once the download finishes.
 +    */
     pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
                 pkgRecords *Recs,pkgCache::VerIterator const &Version,
                 string &StoreFilename);
  };
  
 -// Fetch a generic file to the current directory
 +/** \brief Retrieve an arbitrary file to the current directory.
 + *
 + *  The file is retrieved even if it is accessed via a URL type that
 + *  normally is a NOP, such as "file".  If the download fails, the
 + *  partial file is renamed to get a ".FAILED" extension.
 + */
  class pkgAcqFile : public pkgAcquire::Item
  {
 +   /** \brief The currently active download process. */
     pkgAcquire::ItemDesc Desc;
 +
 +   /** \brief The md5sum of the file to download, if it is known. */
     string Md5Hash;
 +
 +   /** \brief How many times to retry the download, set from
 +    *  Acquire::Retries.
 +    */
     unsigned int Retries;
     
     public:
     virtual string MD5Sum() {return Md5Hash;};
     virtual string DescURI() {return Desc.URI;};
  
 -   // If DestFilename is empty, download to DestDir/<basename> if
 -   // DestDir is non-empty, $CWD/<basename> otherwise.  If
 -   // DestFilename is NOT empty, DestDir is ignored and DestFilename
 -   // is the absolute name to which the file should be downloaded.
 +   /** \brief Create a new pkgAcqFile object.
 +    *
 +    *  \param Owner The pkgAcquire object with which this object is
 +    *  associated.
 +    *
 +    *  \param URI The URI to download.
 +    *
 +    *  \param MD5 The md5sum of the file to download, if it is known;
 +    *  otherwise "".
 +    *
 +    *  \param Size The size of the file to download, if it is known;
 +    *  otherwise 0.
 +    *
 +    *  \param Desc A description of the file being downloaded.
 +    *
 +    *  \param ShortDesc A brief description of the file being
 +    *  downloaded.
++    *
++    *  \param DestDir The directory the file should be downloaded into.
++    *
++    *  \param DestFilename The filename+path the file is downloaded to.
++    *
++    *
++    * If DestFilename is empty, download to DestDir/<basename> if
++    * DestDir is non-empty, $CWD/<basename> otherwise.  If
++    * DestFilename is NOT empty, DestDir is ignored and DestFilename
++    * is the absolute name to which the file should be downloaded.
 +    */
-    pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,unsigned long Size,
-                 string Desc,string ShortDesc);
++
+    pkgAcqFile(pkgAcquire *Owner, string URI, string MD5, unsigned long Size,
+             string Desc, string ShortDesc,
+             const string &DestDir="", const string &DestFilename="");
  };
  
 +/** @} */
 +
  #endif
diff --combined apt-pkg/cacheiterators.h
index 64fa4636ea27fedf612e5f1acba3f1a1eb1d43c8,2b326bd65884d995133b2158f04848061ab839c0..d5a9c7b0db89712e79255783d808a92f9e00aade
@@@ -99,7 -99,7 +99,7 @@@ class pkgCache::VerIterato
  {
     Version *Ver;
     pkgCache *Owner;
 -   
 +
     void _dummy();
     
     public:
     // Iteration
     void operator ++(int) {if (Ver != Owner->VerP) Ver = Owner->VerP + Ver->NextVer;};
     inline void operator ++() {operator ++(0);};
-    inline bool end() const {return Ver == Owner->VerP?true:false;};
+    inline bool end() const {return Owner == NULL || (Ver == Owner->VerP?true:false);};
     inline void operator =(const VerIterator &B) {Ver = B.Ver; Owner = B.Owner;};
     
     // Comparison
     inline const char *Section() const {return Ver->Section == 0?0:Owner->StrP + Ver->Section;};
     inline const char *Arch() const {return Ver->Arch == 0?0:Owner->StrP + Ver->Arch;};
     inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Ver->ParentPkg);};
 +   inline DescIterator DescriptionList() const;
 +   DescIterator TranslatedDescription() const;
     inline DepIterator DependsList() const;
     inline PrvIterator ProvidesList() const;
     inline VerFileIterator FileList() const;
     };
  };
  
 +// Description Iterator
 +class pkgCache::DescIterator
 +{
 +   Description *Desc;
 +   pkgCache *Owner;
 +   
 +   void _dummy();
 +   
 +   public:
 +
 +   // Iteration
 +   void operator ++(int) {if (Desc != Owner->DescP) Desc = Owner->DescP + Desc->NextDesc;};
 +   inline void operator ++() {operator ++(0);};
 +   inline bool end() const {return Desc == Owner->DescP?true:false;};
 +   inline void operator =(const DescIterator &B) {Desc = B.Desc; Owner = B.Owner;};
 +   
 +   // Comparison
 +   inline bool operator ==(const DescIterator &B) const {return Desc == B.Desc;};
 +   inline bool operator !=(const DescIterator &B) const {return Desc != B.Desc;};
 +   int CompareDesc(const DescIterator &B) const;
 +   
 +   // Accessors
 +   inline Description *operator ->() {return Desc;};
 +   inline Description const *operator ->() const {return Desc;};
 +   inline Description &operator *() {return *Desc;};
 +   inline Description const &operator *() const {return *Desc;};
 +   inline operator Description *() {return Desc == Owner->DescP?0:Desc;};
 +   inline operator Description const *() const {return Desc == Owner->DescP?0:Desc;};
 +   inline pkgCache *Cache() {return Owner;};
 +      
 +   inline const char *LanguageCode() const {return Owner->StrP + Desc->language_code;};
 +   inline const char *md5() const {return Owner->StrP + Desc->md5sum;};
 +   inline DescFileIterator FileList() const;
 +   inline unsigned long Index() const {return Desc - Owner->DescP;};
 +
 +   inline DescIterator() : Desc(0), Owner(0) {};   
 +   inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Desc(Trg), 
 +              Owner(&Owner) 
 +   { 
 +      if (Desc == 0)
 +       Desc = Owner.DescP;
 +   };
 +};
 +
  // Dependency iterator
  class pkgCache::DepIterator
  {
@@@ -384,38 -338,6 +384,38 @@@ class pkgCache::VerFileIterato
     inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), FileP(Trg) {};
  };
  
 +// Description File 
 +class pkgCache::DescFileIterator
 +{
 +   pkgCache *Owner;
 +   DescFile *FileP;
 +
 +   public:
 +
 +   // Iteration
 +   void operator ++(int) {if (FileP != Owner->DescFileP) FileP = Owner->DescFileP + FileP->NextFile;};
 +   inline void operator ++() {operator ++(0);};
 +   inline bool end() const {return FileP == Owner->DescFileP?true:false;};
 +
 +   // Comparison
 +   inline bool operator ==(const DescFileIterator &B) const {return FileP == B.FileP;};
 +   inline bool operator !=(const DescFileIterator &B) const {return FileP != B.FileP;};
 +                         
 +   // Accessors
 +   inline DescFile *operator ->() {return FileP;};
 +   inline DescFile const *operator ->() const {return FileP;};
 +   inline DescFile const &operator *() const {return *FileP;};
 +   inline operator DescFile *() {return FileP == Owner->DescFileP?0:FileP;};
 +   inline operator DescFile const *() const {return FileP == Owner->DescFileP?0:FileP;};
 +   inline pkgCache *Cache() {return Owner;};
 +  
 +   inline PkgFileIterator File() const {return PkgFileIterator(*Owner,FileP->File + Owner->PkgFileP);};
 +   inline unsigned long Index() const {return FileP - Owner->DescFileP;};
 +      
 +   inline DescFileIterator() : Owner(0), FileP(0) {};
 +   inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Owner(&Owner), FileP(Trg) {};
 +};
 +
  // Inlined Begin functions cant be in the class because of order problems
  inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
         {return VerIterator(*Owner,Owner->VerP + Pkg->VersionList);};
@@@ -425,15 -347,11 +425,15 @@@ inline pkgCache::DepIterator pkgCache::
         {return DepIterator(*Owner,Owner->DepP + Pkg->RevDepends,Pkg);};
  inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const
         {return PrvIterator(*Owner,Owner->ProvideP + Pkg->ProvidesList,Pkg);};
 +inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const
 +       {return DescIterator(*Owner,Owner->DescP + Ver->DescriptionList);};
  inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const
         {return PrvIterator(*Owner,Owner->ProvideP + Ver->ProvidesList,Ver);};
  inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const
         {return DepIterator(*Owner,Owner->DepP + Ver->DependsList,Ver);};
  inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const
         {return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);};
 +inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
 +       {return DescFileIterator(*Owner,Owner->DescFileP + Desc->FileList);};
  
  #endif
index 303cb27dbce986be7f972f8ada6c992db0ffc090,d96155917df06f6f4ded17e9c1195bc7427f0145..37d263794b42b9c2049096068e2b3b99124371bd
  #include <regex.h>
  #include <errno.h>
  #include <stdarg.h>
 +#include <iconv.h>
  
  #include "config.h"
  
  using namespace std;
                                                                        /*}}}*/
  
 +// UTF8ToCodeset - Convert some UTF-8 string for some codeset         /*{{{*/
 +// ---------------------------------------------------------------------
 +/* This is handy to use before display some information for enduser  */
 +bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest)
 +{
 +  iconv_t cd;
 +  const char *inbuf;
 +  char *inptr, *outbuf, *outptr;
 +  size_t insize, outsize;
 +  
 +  cd = iconv_open(codeset, "UTF-8");
 +  if (cd == (iconv_t)(-1)) {
 +     // Something went wrong
 +     if (errno == EINVAL)
 +      _error->Error("conversion from 'UTF-8' to '%s' not available",
 +               codeset);
 +     else
 +      perror("iconv_open");
 +     
 +     // Clean the destination string
 +     *dest = "";
 +     
 +     return false;
 +  }
 +
 +  insize = outsize = orig.size();
 +  inbuf = orig.data();
 +  inptr = (char *)inbuf;
 +  outbuf = new char[insize+1];
 +  outptr = outbuf;
 +
 +  iconv(cd, &inptr, &insize, &outptr, &outsize);
 +  *outptr = '\0';
 +
 +  *dest = outbuf;
 +  delete[] outbuf;
 +  
 +  iconv_close(cd);
 +
 +  return true;
 +}
 +                                                                      /*}}}*/
  // strstrip - Remove white space from the front and back of a string  /*{{{*/
  // ---------------------------------------------------------------------
  /* This is handy to use when parsing a file. It also removes \n's left 
@@@ -242,10 -199,10 +242,10 @@@ bool ParseCWord(const char *&String,str
  // QuoteString - Convert a string into quoted from                    /*{{{*/
  // ---------------------------------------------------------------------
  /* */
- string QuoteString(string Str,const char *Bad)
+ string QuoteString(const string &Str, const char *Bad)
  {
     string Res;
-    for (string::iterator I = Str.begin(); I != Str.end(); I++)
+    for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
     {
        if (strchr(Bad,*I) != 0 || isprint(*I) == 0 || 
          *I <= 0x20 || *I >= 0x7F)
  // DeQuoteString - Convert a string from quoted from                    /*{{{*/
  // ---------------------------------------------------------------------
  /* This undoes QuoteString */
- string DeQuoteString(string Str)
+ string DeQuoteString(const string &Str)
  {
     string Res;
     for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
@@@ -360,7 -317,7 +360,7 @@@ string TimeToStr(unsigned long Sec
  // SubstVar - Substitute a string for another string                  /*{{{*/
  // ---------------------------------------------------------------------
  /* This replaces all occurances of Subst with Contents in Str. */
- string SubstVar(string Str,string Subst,string Contents)
+ string SubstVar(const string &Str,const string &Subst,const string &Contents)
  {
     string::size_type Pos = 0;
     string::size_type OldPos = 0;
@@@ -391,21 -348,18 +391,18 @@@ string SubstVar(string Str,const struc
  /* This converts a URI into a safe filename. It quotes all unsafe characters
     and converts / to _ and removes the scheme identifier. The resulting
     file name should be unique and never occur again for a different file */
- string URItoFileName(string URI)
+ string URItoFileName(const string &URI)
  {
     // Nuke 'sensitive' items
     ::URI U(URI);
-    U.User = string();
-    U.Password = string();
-    U.Access = "";
+    U.User.clear();
+    U.Password.clear();
+    U.Access.clear();
     
     // "\x00-\x20{}|\\\\^\\[\\]<>\"\x7F-\xFF";
-    URI = QuoteString(U,"\\|{}[]<>\"^~=!@#$%^&*");
-    string::iterator J = URI.begin();
-    for (; J != URI.end(); J++)
-       if (*J == '/') 
-        *J = '_';
-    return URI;
+    string NewURI = QuoteString(U,"\\|{}[]<>\"^~_=!@#$%^&*");
+    replace(NewURI.begin(),NewURI.end(),'/','_');
+    return NewURI;
  }
                                                                        /*}}}*/
  // Base64Encode - Base64 Encoding routine for short strings           /*{{{*/
     from wget and then patched and bug fixed.
   
     This spec can be found in rfc2045 */
- string Base64Encode(string S)
+ string Base64Encode(const string &S)
  {
     // Conversion table.
     static char tbl[64] = {'A','B','C','D','E','F','G','H',
@@@ -583,17 -537,17 +580,17 @@@ int stringcasecmp(string::const_iterato
  // ---------------------------------------------------------------------
  /* The format is like those used in package files and the method 
     communication system */
- string LookupTag(string Message,const char *Tag,const char *Default)
+ string LookupTag(const string &Message,const char *Tag,const char *Default)
  {
     // Look for a matching tag.
     int Length = strlen(Tag);
-    for (string::iterator I = Message.begin(); I + Length < Message.end(); I++)
+    for (string::const_iterator I = Message.begin(); I + Length < Message.end(); I++)
     {
        // Found the tag
        if (I[Length] == ':' && stringcasecmp(I,I+Length,Tag) == 0)
        {
         // Find the end of line and strip the leading/trailing spaces
-        string::iterator J;
+        string::const_iterator J;
         I += Length + 1;
         for (; isspace(*I) != 0 && I < Message.end(); I++);
         for (J = I; *J != '\n' && J < Message.end(); J++);
  // ---------------------------------------------------------------------
  /* This inspects the string to see if it is true or if it is false and
     then returns the result. Several varients on true/false are checked. */
- int StringToBool(string Text,int Default)
+ int StringToBool(const string &Text,int Default)
  {
     char *End;
     int Res = strtol(Text.c_str(),&End,0);   
@@@ -781,7 -735,7 +778,7 @@@ static time_t timegm(struct tm *t
     'timegm' to convert a struct tm in UTC to a time_t. For some bizzar
     reason the C library does not provide any such function :< This also
     handles the weird, but unambiguous FTP time format*/
- bool StrToTime(string Val,time_t &Result)
+ bool StrToTime(const string &Val,time_t &Result)
  {
     struct tm Tm;
     char Month[10];
@@@ -868,7 -822,7 +865,7 @@@ static int HexDigit(int c
  // Hex2Num - Convert a long hex number into a buffer                  /*{{{*/
  // ---------------------------------------------------------------------
  /* The length of the buffer must be exactly 1/2 the length of the string. */
- bool Hex2Num(string Str,unsigned char *Num,unsigned int Length)
+ bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length)
  {
     if (Str.length() != Length*2)
        return false;
@@@ -1029,7 -983,7 +1026,7 @@@ char *safe_snprintf(char *Buffer,char *
  // ---------------------------------------------------------------------
  /* The domain list is a comma seperate list of domains that are suffix
     matched against the argument */
- bool CheckDomainList(string Host,string List)
+ bool CheckDomainList(const string &Host,const string &List)
  {
     string::const_iterator Start = List.begin();
     for (string::const_iterator Cur = List.begin(); Cur <= List.end(); Cur++)
  // URI::CopyFrom - Copy from an object                                        /*{{{*/
  // ---------------------------------------------------------------------
  /* This parses the URI into all of its components */
- void URI::CopyFrom(string U)
+ void URI::CopyFrom(const string &U)
  {
     string::const_iterator I = U.begin();
  
        SingleSlash = U.end();
  
     // We can now write the access and path specifiers
-    Access = string(U,0,FirstColon - U.begin());
+    Access.assign(U.begin(),FirstColon);
     if (SingleSlash != U.end())
-       Path = string(U,SingleSlash - U.begin());
+       Path.assign(SingleSlash,U.end());
     if (Path.empty() == true)
        Path = "/";
  
     if (At == SingleSlash)
     {
        if (FirstColon < SingleSlash)
-        Host = string(U,FirstColon - U.begin(),SingleSlash - FirstColon);
+        Host.assign(FirstColon,SingleSlash);
     }
     else
     {
-       Host = string(U,At - U.begin() + 1,SingleSlash - At - 1);
-       User = string(U,FirstColon - U.begin(),SecondColon - FirstColon);
+       Host.assign(At+1,SingleSlash);
+       User.assign(FirstColon,SecondColon);
        if (SecondColon < At)
-        Password = string(U,SecondColon - U.begin() + 1,At - SecondColon - 1);
+        Password.assign(SecondColon+1,At);
     }   
     
     // Now we parse the RFC 2732 [] hostnames.
     // Tsk, weird.
     if (InBracket == true)
     {
-       Host = string();
+       Host.clear();
        return;
     }
     
        return;
     
     Port = atoi(string(Host,Pos+1).c_str());
-    Host = string(Host,0,Pos);
+    Host.assign(Host,0,Pos);
  }
                                                                        /*}}}*/
  // URI::operator string - Convert the URI to a string                 /*{{{*/
@@@ -1214,12 -1168,12 +1211,12 @@@ URI::operator string(
  // URI::SiteOnly - Return the schema and site for the URI             /*{{{*/
  // ---------------------------------------------------------------------
  /* */
- string URI::SiteOnly(string URI)
+ string URI::SiteOnly(const string &URI)
  {
     ::URI U(URI);
-    U.User = string();
-    U.Password = string();
-    U.Path = string();
+    U.User.clear();
+    U.Password.clear();
+    U.Path.clear();
     U.Port = 0;
     return U;
  }
diff --combined apt-pkg/contrib/strutl.h
index 72fc34d6d8613704f43f7ebca1b9f95c8e3c981a,6ec2b78119ece7a31a8085f25cfafc7a11eae845..254087267d74476de6b19d9f8696ae8f250d1eea
@@@ -38,30 -38,29 +38,30 @@@ using std::ostream
  #define APT_FORMAT2
  #define APT_FORMAT3
  #endif    
 -    
 +
 +bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest);
  char *_strstrip(char *String);
  char *_strtabexpand(char *String,size_t Len);
  bool ParseQuoteWord(const char *&String,string &Res);
  bool ParseCWord(const char *&String,string &Res);
- string QuoteString(string Str,const char *Bad);
- string DeQuoteString(string Str);
+ string QuoteString(const string &Str,const char *Bad);
+ string DeQuoteString(const string &Str);
  string SizeToStr(double Bytes);
  string TimeToStr(unsigned long Sec);
- string Base64Encode(string Str);
- string URItoFileName(string URI);
+ string Base64Encode(const string &Str);
+ string URItoFileName(const string &URI);
  string TimeRFC1123(time_t Date);
- bool StrToTime(string Val,time_t &Result);
- string LookupTag(string Message,const char *Tag,const char *Default = 0);
- int StringToBool(string Text,int Default = -1);
+ bool StrToTime(const string &Val,time_t &Result);
+ string LookupTag(const string &Message,const char *Tag,const char *Default = 0);
+ int StringToBool(const string &Text,int Default = -1);
  bool ReadMessages(int Fd, vector<string> &List);
  bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
- bool Hex2Num(string Str,unsigned char *Num,unsigned int Length);
+ bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
  bool TokSplitString(char Tok,char *Input,char **List,
                    unsigned long ListMax);
  void ioprintf(ostream &out,const char *format,...) APT_FORMAT2;
  char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3;
- bool CheckDomainList(string Host,string List);
+ bool CheckDomainList(const string &Host, const string &List);
  
  #define APT_MKSTRCMP(name,func) \
  inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
@@@ -102,7 -101,7 +102,7 @@@ inline const char *DeNull(const char *s
  
  class URI
  {
-    void CopyFrom(string From);
+    void CopyFrom(const string &From);
                 
     public:
     
     unsigned int Port;
     
     operator string();
-    inline void operator =(string From) {CopyFrom(From);};
+    inline void operator =(const string &From) {CopyFrom(From);};
     inline bool empty() {return Access.empty();};
-    static string SiteOnly(string URI);
+    static string SiteOnly(const string &URI);
     
     URI(string Path) {CopyFrom(Path);};
     URI() : Port(0) {};
@@@ -128,7 -127,7 +128,7 @@@ struct SubstVa
     const string *Contents;
  };
  string SubstVar(string Str,const struct SubstVar *Vars);
- string SubstVar(string Str,string Subst,string Contents);
+ string SubstVar(const string &Str,const string &Subst,const string &Contents);
  
  struct RxChoiceList
  {
index 97553ab825d2dd6c0982cfd436b020c98aee4658,b11d2531c9784d80923c428001fdb05035d6fb8a..441bb826fa0d59346c957cac91d68c18a001458d
@@@ -15,7 -15,6 +15,7 @@@
  #include <apt-pkg/configuration.h>
  #include <apt-pkg/strutl.h>
  #include <apt-pkg/crc-16.h>
 +#include <apt-pkg/md5.h>
  
  #include <ctype.h>
  
@@@ -118,48 -117,6 +118,48 @@@ bool debListParser::NewVersion(pkgCache
     return true;
  }
                                                                        /*}}}*/
 +// ListParser::Description - Return the description string            /*{{{*/
 +// ---------------------------------------------------------------------
 +/* This is to return the string describing the package in debian
 +   form. If this returns the blank string then the entry is assumed to
 +   only describe package properties */
 +string debListParser::Description()
 +{
 +   if (DescriptionLanguage().empty())
 +      return Section.FindS("Description");
 +   else
 +      return Section.FindS(("Description-" + pkgIndexFile::LanguageCode()).c_str());
 +}
 +                                                                        /*}}}*/
 +// ListParser::DescriptionLanguage - Return the description lang string       /*{{{*/
 +// ---------------------------------------------------------------------
 +/* This is to return the string describing the language of
 +   description. If this returns the blank string then the entry is
 +   assumed to describe original description. */
 +string debListParser::DescriptionLanguage()
 +{
 +   return Section.FindS("Description").empty() ? pkgIndexFile::LanguageCode() : "";
 +}
 +                                                                        /*}}}*/
 +// ListParser::Description - Return the description_md5 MD5SumValue   /*{{{*/
 +// ---------------------------------------------------------------------
 +/* This is to return the md5 string to allow the check if it is the right
 +   description. If no Description-md5 is found in the section it will be
 +   calculated.
 + */
 +MD5SumValue debListParser::Description_md5()
 +{
 +   string value = Section.FindS("Description-md5");
 +
 +   if (value.empty()) 
 +   {
 +      MD5Summation md5;
 +      md5.Add((Description() + "\n").c_str());
 +      return md5.Result();
 +   } else
 +      return MD5SumValue(value);
 +}
 +                                                                        /*}}}*/
  // ListParser::UsePackage - Update a package structure                        /*{{{*/
  // ---------------------------------------------------------------------
  /* This is called to update the package with any new information 
@@@ -420,12 -377,12 +420,12 @@@ const char *debListParser::ParseDepends
        const char *End = I;
        for (; End > Start && isspace(End[-1]); End--);
        
-       Ver = string(Start,End-Start);
+       Ver.assign(Start,End-Start);
        I++;
     }
     else
     {
-       Ver = string();
+       Ver.clear();
        Op = pkgCache::Dep::NoOp;
     }
     
diff --combined apt-pkg/init.cc
index 6118845e835197cb4ee223a1acd0aec209bf087c,b47378d4a96ad6c87565bc010e7797b65996a375..6aa486a7f3d8b5650d6a6c4845681ef49cd8a1f6
@@@ -1,6 -1,6 +1,6 @@@
  // -*- mode: cpp; mode: fold -*-
  // Description                                                                /*{{{*/
- // $Id: init.cc,v 1.21 2004/02/27 00:46:44 mdz Exp $
+ // $Id: init.cc,v 1.20 2003/02/09 20:31:05 doogie Exp $
  /* ######################################################################
  
     Init - Initialize the package library
@@@ -64,13 -64,14 +64,14 @@@ bool pkgInitConfig(Configuration &Cnf
     // Configuration
     Cnf.Set("Dir::Etc","etc/apt/");
     Cnf.Set("Dir::Etc::sourcelist","sources.list");
+    Cnf.Set("Dir::Etc::sourceparts","sources.list.d");
     Cnf.Set("Dir::Etc::vendorlist","vendors.list");
     Cnf.Set("Dir::Etc::vendorparts","vendors.list.d");
     Cnf.Set("Dir::Etc::main","apt.conf");
     Cnf.Set("Dir::Etc::parts","apt.conf.d");
     Cnf.Set("Dir::Etc::preferences","preferences");
     Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
-             
+    
     bool Res = true;
     
     // Read an alternate config file
        bindtextdomain(textdomain(0),Cnf.FindDir("Dir::Locale").c_str());
     }
  #endif
 +
 +   // Translation
 +   Cnf.Set("APT::Acquire::Translation", "environment");
     
     return true;
  }
diff --combined apt-pkg/pkgcache.cc
index 4452079a2ee62cd4f067180010bee3a7a8287f4e,9926befe93f56c61974442ce5e7386aef44fcaa3..162ab4f279f4e3e90d7f700389eb98befeb64ec7
@@@ -26,7 -26,6 +26,7 @@@
  #endif 
  
  #include <apt-pkg/pkgcache.h>
 +#include <apt-pkg/indexfile.h>
  #include <apt-pkg/version.h>
  #include <apt-pkg/error.h>
  #include <apt-pkg/strutl.h>
@@@ -44,7 -43,6 +44,7 @@@
  
  using std::string;
  
 +
  // Cache::Header::Header - Constructor                                        /*{{{*/
  // ---------------------------------------------------------------------
  /* Simply initialize the header */
@@@ -54,7 -52,7 +54,7 @@@ pkgCache::Header::Header(
     
     /* Whenever the structures change the major version should be bumped,
        whenever the generator changes the minor version should be bumped. */
 -   MajorVersion = 4;
 +   MajorVersion = 5;
     MinorVersion = 0;
     Dirty = false;
     
     PackageSz = sizeof(pkgCache::Package);
     PackageFileSz = sizeof(pkgCache::PackageFile);
     VersionSz = sizeof(pkgCache::Version);
 +   DescriptionSz = sizeof(pkgCache::Description);
     DependencySz = sizeof(pkgCache::Dependency);
     ProvidesSz = sizeof(pkgCache::Provides);
     VerFileSz = sizeof(pkgCache::VerFile);
 +   DescFileSz = sizeof(pkgCache::DescFile);
     
     PackageCount = 0;
     VersionCount = 0;
 +   DescriptionCount = 0;
     DependsCount = 0;
     PackageFileCount = 0;
     VerFileCount = 0;
 +   DescFileCount = 0;
     ProvidesCount = 0;
     MaxVerFileSize = 0;
 +   MaxDescFileSize = 0;
     
     FileList = 0;
     StringList = 0;
@@@ -96,10 -89,8 +96,10 @@@ bool pkgCache::Header::CheckSizes(Heade
         PackageSz == Against.PackageSz &&
         PackageFileSz == Against.PackageFileSz &&
         VersionSz == Against.VersionSz &&
 +       DescriptionSz == Against.DescriptionSz &&
         DependencySz == Against.DependencySz &&
         VerFileSz == Against.VerFileSz &&
 +       DescFileSz == Against.DescFileSz &&
         ProvidesSz == Against.ProvidesSz)
        return true;
     return false;
@@@ -124,10 -115,8 +124,10 @@@ bool pkgCache::ReMap(
     HeaderP = (Header *)Map.Data();
     PkgP = (Package *)Map.Data();
     VerFileP = (VerFile *)Map.Data();
 +   DescFileP = (DescFile *)Map.Data();
     PkgFileP = (PackageFile *)Map.Data();
     VerP = (Version *)Map.Data();
 +   DescP = (Description *)Map.Data();
     ProvideP = (Provides *)Map.Data();
     DepP = (Dependency *)Map.Data();
     StringItemP = (StringItem *)Map.Data();
  /* This is used to generate the hash entries for the HashTable. With my
     package list from bo this function gets 94% table usage on a 512 item
     table (480 used items) */
- unsigned long pkgCache::sHash(string Str) const
+ unsigned long pkgCache::sHash(const string &Str) const
  {
     unsigned long Hash = 0;
     for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
@@@ -184,7 -173,7 +184,7 @@@ unsigned long pkgCache::sHash(const cha
  // Cache::FindPkg - Locate a package by name                          /*{{{*/
  // ---------------------------------------------------------------------
  /* Returns 0 on error, pointer to the package otherwise */
- pkgCache::PkgIterator pkgCache::FindPkg(string Name)
+ pkgCache::PkgIterator pkgCache::FindPkg(const string &Name)
  {
     // Look at the hash bucket
     Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)];
@@@ -246,11 -235,11 +246,11 @@@ const char *pkgCache::Priority(unsigne
     return 0;
  }
                                                                        /*}}}*/
 -
  // Bases for iterator classes                                         /*{{{*/
  void pkgCache::VerIterator::_dummy() {}
  void pkgCache::DepIterator::_dummy() {}
  void pkgCache::PrvIterator::_dummy() {}
 +void pkgCache::DescIterator::_dummy() {}
                                                                        /*}}}*/
  // PkgIterator::operator ++ - Postfix incr                            /*{{{*/
  // ---------------------------------------------------------------------
@@@ -610,20 -599,3 +610,20 @@@ string pkgCache::PkgFileIterator::RelSt
     return Res;
  }
                                                                        /*}}}*/
 +// VerIterator::TranslatedDescription - Return the a DescIter for locale/*{{{*/
 +// ---------------------------------------------------------------------
 +/* return a DescIter for the current locale or the default if none is 
 + * found
 + */
 +pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
 +{
 +   pkgCache::DescIterator DescDefault = DescriptionList();
 +   pkgCache::DescIterator Desc = DescDefault;
 +   for (; Desc.end() == false; Desc++)
 +      if (pkgIndexFile::LanguageCode() == Desc.LanguageCode())
 +       break;
 +   if (Desc.end() == true) Desc = DescDefault;
 +   return Desc;
 +};
 +
 +                                                                      /*}}}*/
diff --combined apt-pkg/pkgcache.h
index 6a54ad5ba66afee6cf3baf609dc6b19c5592bb07,587d97534436b6a30fc84bcb665d7e625a25bdf8..c7a3172cc0986d04f8476787332115072c4f0ac7
@@@ -38,30 -38,24 +38,30 @@@ class pkgCach
     struct Package;
     struct PackageFile;
     struct Version;
 +   struct Description;
     struct Provides;
     struct Dependency;
     struct StringItem;
     struct VerFile;
 +   struct DescFile;
     
     // Iterators
     class PkgIterator;
     class VerIterator;
 +   class DescIterator;
     class DepIterator;
     class PrvIterator;
     class PkgFileIterator;
     class VerFileIterator;
 +   class DescFileIterator;
     friend class PkgIterator;
     friend class VerIterator;
 +   friend class DescInterator;
     friend class DepIterator;
     friend class PrvIterator;
     friend class PkgFileIterator;
     friend class VerFileIterator;
 +   friend class DescFileIterator;
     
     class Namespace;
     
@@@ -95,7 -89,7 +95,7 @@@
     string CacheFile;
     MMap &Map;
  
-    unsigned long sHash(string S) const;
+    unsigned long sHash(const string &S) const;
     unsigned long sHash(const char *S) const;
     
     public:
     Header *HeaderP;
     Package *PkgP;
     VerFile *VerFileP;
 +   DescFile *DescFileP;
     PackageFile *PkgFileP;
     Version *VerP;
 +   Description *DescP;
     Provides *ProvideP;
     Dependency *DepP;
     StringItem *StringItemP;
     inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();};
        
     // String hashing function (512 range)
-    inline unsigned long Hash(string S) const {return sHash(S);};
+    inline unsigned long Hash(const string &S) const {return sHash(S);};
     inline unsigned long Hash(const char *S) const {return sHash(S);};
  
     // Usefull transformation things
     const char *Priority(unsigned char Priority);
     
     // Accessors
-    PkgIterator FindPkg(string Name);
+    PkgIterator FindPkg(const string &Name);
     Header &Head() {return *HeaderP;};
     inline PkgIterator PkgBegin();
     inline PkgIterator PkgEnd();
@@@ -159,20 -151,16 +159,20 @@@ struct pkgCache::Heade
     unsigned short PackageSz;
     unsigned short PackageFileSz;
     unsigned short VersionSz;
 +   unsigned short DescriptionSz;
     unsigned short DependencySz;
     unsigned short ProvidesSz;
     unsigned short VerFileSz;
 +   unsigned short DescFileSz;
     
     // Structure counts
     unsigned long PackageCount;
     unsigned long VersionCount;
 +   unsigned long DescriptionCount;
     unsigned long DependsCount;
     unsigned long PackageFileCount;
     unsigned long VerFileCount;
 +   unsigned long DescFileCount;
     unsigned long ProvidesCount;
     
     // Offsets
     map_ptrloc VerSysName;            // StringTable
     map_ptrloc Architecture;          // StringTable
     unsigned long MaxVerFileSize;
 +   unsigned long MaxDescFileSize;
  
     /* Allocation pools, there should be one of these for each structure
        excluding the header */
 -   DynamicMMap::Pool Pools[7];
 +   DynamicMMap::Pool Pools[8];
     
     // Rapid package name lookup
     map_ptrloc HashTable[2*1048];
@@@ -206,7 -193,7 +206,7 @@@ struct pkgCache::Packag
     map_ptrloc NextPackage;       // Package
     map_ptrloc RevDepends;        // Dependency
     map_ptrloc ProvidesList;      // Provides
 -   
 +
     // Install/Remove/Purge etc
     unsigned char SelectedState;     // What
     unsigned char InstState;         // Flags
@@@ -245,14 -232,6 +245,14 @@@ struct pkgCache::VerFil
     unsigned short Size;
  };
  
 +struct pkgCache::DescFile
 +{
 +   map_ptrloc File;           // PackageFile
 +   map_ptrloc NextFile;       // PkgVerFile
 +   map_ptrloc Offset;         // File offset
 +   unsigned short Size;
 +};
 +
  struct pkgCache::Version
  {
     map_ptrloc VerStr;            // Stringtable
     // Lists
     map_ptrloc FileList;          // VerFile
     map_ptrloc NextVer;           // Version
 +   map_ptrloc DescriptionList;   // Description
     map_ptrloc DependsList;       // Dependency
     map_ptrloc ParentPkg;         // Package
     map_ptrloc ProvidesList;      // Provides
     unsigned char Priority;
  };
  
 +struct pkgCache::Description
 +{
 +   // Language Code store the description translation language code. If
 +   // the value has a 0 lenght then this is readed using the Package
 +   // file else the Translation-CODE are used.
 +   map_ptrloc language_code;     // StringTable
 +   map_ptrloc md5sum;            // StringTable
 +
 +   // Linked list 
 +   map_ptrloc FileList;          // DescFile
 +   map_ptrloc NextDesc;          // Description
 +   map_ptrloc ParentPkg;         // Package
 +
 +   unsigned short ID;
 +};
 +
  struct pkgCache::Dependency
  {
     map_ptrloc Version;         // Stringtable
@@@ -337,13 -299,11 +337,13 @@@ class pkgCache::Namespac
  
     typedef pkgCache::PkgIterator PkgIterator;
     typedef pkgCache::VerIterator VerIterator;
 +   typedef pkgCache::DescIterator DescIterator;
     typedef pkgCache::DepIterator DepIterator;
     typedef pkgCache::PrvIterator PrvIterator;
     typedef pkgCache::PkgFileIterator PkgFileIterator;
     typedef pkgCache::VerFileIterator VerFileIterator;   
     typedef pkgCache::Version Version;
 +   typedef pkgCache::Description Description;
     typedef pkgCache::Package Package;
     typedef pkgCache::Header Header;
     typedef pkgCache::Dep Dep;
diff --combined apt-pkg/pkgcachegen.cc
index 1ba791b45774e583823ce9c7836a6940f3705e00,de854bee53ea9b4b5ef3eba100c57b61484aba26..1106667d5a3309c023a4f7cb5c44853d1d889d0a
@@@ -125,46 -125,16 +125,46 @@@ bool pkgCacheGenerator::MergeList(ListP
        string Version = List.Version();
        if (Version.empty() == true)
        {
 +       // we first process the package, then the descriptions
 +       // (this has the bonus that we get MMap error when we run out
 +       //  of MMap space)
         if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false)
            return _error->Error(_("Error occurred while processing %s (UsePackage1)"),
                                 PackageName.c_str());
 +
 +       // Find the right version to write the description
 +       MD5SumValue CurMd5 = List.Description_md5();
 +       pkgCache::VerIterator Ver = Pkg.VersionList();
 +       map_ptrloc *LastVer = &Pkg->VersionList;
 +
 +       for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++) 
 +       {
 +          pkgCache::DescIterator Desc = Ver.DescriptionList();
 +          map_ptrloc *LastDesc = &Ver->DescriptionList;
 +
 +          for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++)
 +          {
 +
 +             if (MD5SumValue(Desc.md5()) == CurMd5) 
 +               {
 +                // Add new description
 +                *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), CurMd5, *LastDesc);
 +                Desc->ParentPkg = Pkg.Index();
 +                
 +                if (NewFileDesc(Desc,List) == false)
 +                   return _error->Error(_("Error occured while processing %s (NewFileDesc1)"),PackageName.c_str());
 +                break;
 +             }
 +          }
 +       }
 +
         continue;
        }
  
        pkgCache::VerIterator Ver = Pkg.VersionList();
 -      map_ptrloc *Last = &Pkg->VersionList;
 +      map_ptrloc *LastVer = &Pkg->VersionList;
        int Res = 1;
 -      for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
 +      for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
        {
         Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
         if (Res >= 0)
        // Skip to the end of the same version set.
        if (Res == 0)
        {
 -       for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
 +       for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
         {
            Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
            if (Res != 0)
        }
  
        // Add a new version
 -      *Last = NewVersion(Ver,Version,*Last);
 +      *LastVer = NewVersion(Ver,Version,*LastVer);
        Ver->ParentPkg = Pkg.Index();
        Ver->Hash = Hash;
 +
        if (List.NewVersion(Ver) == false)
         return _error->Error(_("Error occurred while processing %s (NewVersion1)"),
                              PackageName.c_str());
         FoundFileDeps |= List.HasFileDeps();
         return true;
        }      
 +
 +      /* Record the Description data. Description data always exist in
 +       Packages and Translation-* files. */
 +      pkgCache::DescIterator Desc = Ver.DescriptionList();
 +      map_ptrloc *LastDesc = &Ver->DescriptionList;
 +      
 +      // Skip to the end of description set
 +      for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++);
 +
 +      // Add new description
 +      *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), List.Description_md5(), *LastDesc);
 +      Desc->ParentPkg = Pkg.Index();
 +
 +      if (NewFileDesc(Desc,List) == false)
 +       return _error->Error(_("Error occured while processing %s (NewFileDesc2)"),PackageName.c_str());
     }
  
     FoundFileDeps |= List.HasFileDeps();
     if (Cache.HeaderP->VersionCount >= (1ULL<<(sizeof(Cache.VerP->ID)*8))-1)
        return _error->Error(_("Wow, you exceeded the number of versions "
                             "this APT is capable of."));
 +   if (Cache.HeaderP->DescriptionCount >= (1ULL<<(sizeof(Cache.DescP->ID)*8))-1)
 +      return _error->Error(_("Wow, you exceeded the number of descriptions "
 +                           "this APT is capable of."));
     if (Cache.HeaderP->DependsCount >= (1ULL<<(sizeof(Cache.DepP->ID)*8))-1ULL)
        return _error->Error(_("Wow, you exceeded the number of dependencies "
                             "this APT is capable of."));
@@@ -315,12 -266,12 +315,12 @@@ bool pkgCacheGenerator::MergeFileProvid
  // CacheGenerator::NewPackage - Add a new package                     /*{{{*/
  // ---------------------------------------------------------------------
  /* This creates a new package structure and adds it to the hash table */
- bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,string Name)
+ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name)
  {
     Pkg = Cache.FindPkg(Name);
     if (Pkg.end() == false)
        return true;
 -       
 +
     // Get a structure
     unsigned long Package = Map.Allocate(sizeof(pkgCache::Package));
     if (Package == 0)
@@@ -379,7 -330,7 +379,7 @@@ bool pkgCacheGenerator::NewFileVer(pkgC
  // ---------------------------------------------------------------------
  /* This puts a version structure in the linked list */
  unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
-                                           string VerStr,
+                                           const string &VerStr,
                                            unsigned long Next)
  {
     // Get a structure
     return Version;
  }
                                                                        /*}}}*/
 +// CacheGenerator::NewFileDesc - Create a new File<->Desc association /*{{{*/
 +// ---------------------------------------------------------------------
 +/* */
 +bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc,
 +                                 ListParser &List)
 +{
 +   if (CurrentFile == 0)
 +      return true;
 +   
 +   // Get a structure
 +   unsigned long DescFile = Map.Allocate(sizeof(pkgCache::DescFile));
 +   if (DescFile == 0)
 +      return 0;
 +
 +   pkgCache::DescFileIterator DF(Cache,Cache.DescFileP + DescFile);
 +   DF->File = CurrentFile - Cache.PkgFileP;
 +
 +   // Link it to the end of the list
 +   map_ptrloc *Last = &Desc->FileList;
 +   for (pkgCache::DescFileIterator D = Desc.FileList(); D.end() == false; D++)
 +      Last = &D->NextFile;
 +
 +   DF->NextFile = *Last;
 +   *Last = DF.Index();
 +   
 +   DF->Offset = List.Offset();
 +   DF->Size = List.Size();
 +   if (Cache.HeaderP->MaxDescFileSize < DF->Size)
 +      Cache.HeaderP->MaxDescFileSize = DF->Size;
 +   Cache.HeaderP->DescFileCount++;
 +   
 +   return true;
 +}
 +                                                                      /*}}}*/
 +// CacheGenerator::NewDescription - Create a new Description          /*{{{*/
 +// ---------------------------------------------------------------------
 +/* This puts a description structure in the linked list */
 +map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
 +                                          const string &Lang, const MD5SumValue &md5sum,
 +                                          map_ptrloc Next)
 +{
 +   // Get a structure
 +   map_ptrloc Description = Map.Allocate(sizeof(pkgCache::Description));
 +   if (Description == 0)
 +      return 0;
 +
 +   // Fill it in
 +   Desc = pkgCache::DescIterator(Cache,Cache.DescP + Description);
 +   Desc->NextDesc = Next;
 +   Desc->ID = Cache.HeaderP->DescriptionCount++;
 +   Desc->language_code = Map.WriteString(Lang);
 +   Desc->md5sum = Map.WriteString(md5sum.Value());
 +
 +   return Description;
 +}
 +                                                                      /*}}}*/
  // ListParser::NewDepends - Create a dependency element                       /*{{{*/
  // ---------------------------------------------------------------------
  /* This creates a dependency element in the tree. It is linked to the
     version and to the package that it is pointing to. */
  bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
-                                              string PackageName,
-                                              string Version,
+                                              const string &PackageName,
+                                              const string &Version,
                                               unsigned int Op,
                                               unsigned int Type)
  {
  // ---------------------------------------------------------------------
  /* */
  bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
-                                               string PackageName,
-                                               string Version)
+                                               const string &PackageName,
+                                               const string &Version)
  {
     pkgCache &Cache = Owner->Cache;
  
  // ---------------------------------------------------------------------
  /* This is used to select which file is to be associated with all newly
     added versions. The caller is responsible for setting the IMS fields. */
- bool pkgCacheGenerator::SelectFile(string File,string Site,
+ bool pkgCacheGenerator::SelectFile(const string &File,const string &Site,
                                   const pkgIndexFile &Index,
                                   unsigned long Flags)
  {
@@@ -648,7 -543,7 +648,7 @@@ unsigned long pkgCacheGenerator::WriteU
  /* This just verifies that each file in the list of index files exists,
     has matching attributes with the cache and the cache does not have
     any extra files. */
- static bool CheckValidity(string CacheFile, FileIterator Start, 
+ static bool CheckValidity(const string &CacheFile, FileIterator Start, 
                            FileIterator End,MMap **OutMap = 0)
  {
     // No file, certainly invalid
        pkgCache::PkgFileIterator File = (*Start)->FindInCache(Cache);
        if (File.end() == true)
         return false;
 -      
 +
        Visited[File->ID] = true;
     }
     
diff --combined apt-pkg/pkgcachegen.h
index 6ab8594d932ef63cc9e78765f0a053a33f6dbb2a,9a729eea4f9b0689611b8cb14b541e22d8382788..fae1a60a6d0ab153c3e946e8a269bf5bdad33c97
@@@ -24,7 -24,6 +24,7 @@@
  #endif 
  
  #include <apt-pkg/pkgcache.h>
 +#include <apt-pkg/md5.h>
  
  class pkgSourceList;
  class OpProgress;
@@@ -54,19 -53,17 +54,19 @@@ class pkgCacheGenerato
     // Flag file dependencies
     bool FoundFileDeps;
     
-    bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);
+    bool NewPackage(pkgCache::PkgIterator &Pkg,const string &Pkg);
     bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
-    unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next);
 +   bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
+    unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next);
 +   map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lang,const MD5SumValue &md5sum,map_ptrloc Next);
  
     public:
  
     unsigned long WriteUniqString(const char *S,unsigned int Size);
-    inline unsigned long WriteUniqString(string S) {return WriteUniqString(S.c_str(),S.length());};
+    inline unsigned long WriteUniqString(const string &S) {return WriteUniqString(S.c_str(),S.length());};
  
     void DropProgress() {Progress = 0;};
-    bool SelectFile(string File,string Site,pkgIndexFile const &Index,
+    bool SelectFile(const string &File,const string &Site,pkgIndexFile const &Index,
                   unsigned long Flags = 0);
     bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
     inline pkgCache &GetCache() {return Cache;};
@@@ -97,12 -94,13 +97,13 @@@ class pkgCacheGenerator::ListParse
  
     inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
     inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
-    inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
+    inline unsigned long WriteString(const string &S) {return Owner->Map.WriteString(S);};
     inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
-    bool NewDepends(pkgCache::VerIterator Ver,string Package,
-                  string Version,unsigned int Op,
+    bool NewDepends(pkgCache::VerIterator Ver,const string &Package,
+                  const string &Version,unsigned int Op,
                   unsigned int Type);
-    bool NewProvides(pkgCache::VerIterator Ver,string Package,string Version);
+    bool NewProvides(pkgCache::VerIterator Ver,const string &Package,
+                   const string &Version);
     
     public:
     
     virtual string Package() = 0;
     virtual string Version() = 0;
     virtual bool NewVersion(pkgCache::VerIterator Ver) = 0;
 +   virtual string Description() = 0;
 +   virtual string DescriptionLanguage() = 0;
 +   virtual MD5SumValue Description_md5() = 0;
     virtual unsigned short VersionHash() = 0;
     virtual bool UsePackage(pkgCache::PkgIterator Pkg,
                           pkgCache::VerIterator Ver) = 0;
diff --combined configure.in
index f85afae5f4fc3c70fdade3197d9eec79086162ca,18cdbfddeb2c9a9b7df52dc3789be0932dba13e7..46dd246582424d2adfaf8f3f7cbf01cef61a481e
@@@ -18,7 -18,7 +18,7 @@@ AC_CONFIG_AUX_DIR(buildlib
  AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
  
  dnl -- SET THIS TO THE RELEASE VERSION --
- AC_DEFINE_UNQUOTED(VERSION,"0.6.42.3exp1")
 -AC_DEFINE_UNQUOTED(VERSION,"0.6.43")
++AC_DEFINE_UNQUOTED(VERSION,"0.6.43exp1")
  PACKAGE="apt"
  AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
  AC_SUBST(PACKAGE)
@@@ -175,21 -175,12 +175,21 @@@ dnl Check for debiando
  AC_PATH_PROG(DEBIANDOC_HTML,debiandoc2html)
  AC_PATH_PROG(DEBIANDOC_TEXT,debiandoc2text)
  
 +dnl Check for doxygen
 +AC_PATH_PROG(DOXYGEN, doxygen)
 +
  dnl Check for the SGML tools needed to build man pages
  AC_PATH_PROG(DOCBOOK2MAN,docbook2man)
  
  dnl Check for the XML tools needed to build man pages
  AC_PATH_PROG(XMLTO,xmlto)
  
 +dnl Check for graphviz
 +AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO])
 +AC_PATH_PROG([DOT], [dot], [])
 +DOTDIR=$(dirname $DOT)
 +AC_SUBST(DOTDIR)
 +
  dnl Check for YODL
  dnl AC_CHECK_PROG(YODL_MAN,yodl2man,"yes","")
  
@@@ -209,4 -200,4 +209,4 @@@ f
  AC_SUBST(USE_NLS)
  AC_PATH_PROG(BASH, bash)
  
 -AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in,make -s dirs)
 +AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile,make -s dirs)
diff --combined debian/changelog
index d9ceff5eaf9f6630d1a3c3863f9ea9c9d4a1c993,86ca0135df25e458c863895e2c0cfefe055325f6..a065fd00e11eed4cead3ba827864b3ea7967fa8e
@@@ -1,16 -1,30 +1,37 @@@
- apt (0.6.42.3exp1) experimental; urgency=low
 -apt (0.6.43.1) unstable; urgency=low
 -
 -  * Merge bubulle@debian.org--2005/apt--main--0 up to patch-133:
 -    * fr.po: Completed to 510 strings
 -
 - -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 30 Nov 2005 10:14:02 +0100
++apt (0.6.43exp1) experimental; urgency=low
 +
 +  * added support for package index diffs 
 +  * added support for i18n of the package descriptions
 +  * synced with the apt--debian-sid--0 branch
 +  * build from mvo@debian.org--2005/apt--debian-experimental--0
 +    (from http://people.debian.org/~mvo/arch)
 +  * fix bug in apt-cache when displaying the record (closes: #334887)
 +  * add patch to fix http download corruption problem (thanks to
 +    Petr Vandrovec, closes: #280844, #290694)
++  * changed abi version to 3.12
 +  
 + -- Michael Vogt <mvo@debian.org>  Sun, 13 Nov 2005 13:33:57 +0100
  
+ apt (0.6.43) unstable; urgency=medium
+   * Merge bubulle@debian.org--2005/apt--main--0 up to patch-132:  
+     * zh_CN.po: Completed to 510 strings(Closes: #338267)
+     * gl.po: Completed to 510 strings (Closes: #338356)
+   * added support for "/etc/apt/sources.list.d" directory 
+     (closes: #66325)
+   * make pkgDirStream (a bit) more complete
+   * fix bug in pkgCache::VerIterator::end() (thanks to Daniel Burrows)
+     (closes: #339533)
+   * pkgAcqFile is more flexible now (closes: #57091)
+   * support a download rate limit for http (closes: #146877)
+   * included lots of the speedup changes from #319377
+   * add stdint.h to contrib/md5.h (closes: #340448)
+   * ABI change, library name changed (closes: #339147)
+   * Fix GNU/kFreeBSD crash on non-existing server file (closes: #317718)
+   * switch to libdb4.3 in build-depends
+   
+  -- Michael Vogt <mvo@debian.org>  Tue, 29 Nov 2005 00:17:07 +0100
  apt (0.6.42.3) unstable; urgency=low
  
    * Merge bubulle@debian.org--2005/apt--main--0 up to patch-129:
@@@ -83,7 -97,7 +104,7 @@@ apt (0.6.42) unstable; urgency=lo
    * cmdline/apt-cdrom.cc: 
      - fix some missing gettext() calls (closes: #334539)
    * doc/apt-cache.8.xml: fix typo (closes: #334714)
 -  
 +
   -- Michael Vogt <mvo@debian.org>  Wed, 19 Oct 2005 22:02:09 +0200
  
  apt (0.6.41) unstable; urgency=low
@@@ -168,7 -182,6 +189,7 @@@ apt (0.6.38) unstable; urgency=lo
    
   -- Matt Zimmerman <mdz@debian.org>  Sat, 25 Jun 2005 09:51:00 -0700
  
 +>>>>>>> MERGE-SOURCE
  apt (0.6.37) breezy; urgency=low
  
    * Merge bubulle@debian.org--2005/apt--main--0 up to patch-81
diff --combined methods/http.cc
index dbf2d1b438d7042908bcc595be09c03931588f98,dc3f0b7639f7d5f34530b65a1adea7bb5b0eddcc..cb63ada499f9df866f96f143a0eec53608fbf7ad
@@@ -58,7 -58,12 +58,11 @@@ unsigned long PipelineDepth = 10
  unsigned long TimeOut = 120;
  bool Debug = false;
  
--
+ unsigned long CircleBuf::BwReadLimit=0;
+ unsigned long CircleBuf::BwTickReadData=0;
+ struct timeval CircleBuf::BwReadTick={0,0};
+ const unsigned int CircleBuf::BW_HZ=10;
+   
  // CircleBuf::CircleBuf - Circular input buffer                               /*{{{*/
  // ---------------------------------------------------------------------
  /* */
@@@ -66,6 -71,8 +70,8 @@@ CircleBuf::CircleBuf(unsigned long Size
  {
     Buf = new unsigned char[Size];
     Reset();
+    CircleBuf::BwReadLimit = _config->FindI("Acquire::http::Dl-Limit",0)*1024;
  }
                                                                        /*}}}*/
  // CircleBuf::Reset - Reset to the default state                      /*{{{*/
@@@ -91,16 -98,45 +97,45 @@@ void CircleBuf::Reset(
     is non-blocking.. */
  bool CircleBuf::Read(int Fd)
  {
+    unsigned long BwReadMax;
     while (1)
     {
        // Woops, buffer is full
        if (InP - OutP == Size)
         return true;
  
+       // what's left to read in this tick
+       BwReadMax = CircleBuf::BwReadLimit/BW_HZ;
+       if(CircleBuf::BwReadLimit) {
+        struct timeval now;
+        gettimeofday(&now,0);
+        unsigned long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
+           now.tv_usec-CircleBuf::BwReadTick.tv_usec;
+        if(d > 1000000/BW_HZ) {
+           CircleBuf::BwReadTick = now;
+           CircleBuf::BwTickReadData = 0;
+        } 
+        
+        if(CircleBuf::BwTickReadData >= BwReadMax) {
+           usleep(1000000/BW_HZ);
+           return true;
+        }
+       }
        // Write the buffer segment
        int Res;
-       Res = read(Fd,Buf + (InP%Size),LeftRead());
+       if(CircleBuf::BwReadLimit) {
+        Res = read(Fd,Buf + (InP%Size), 
+                   BwReadMax > LeftRead() ? LeftRead() : BwReadMax);
+       } else
+        Res = read(Fd,Buf + (InP%Size),LeftRead());
        
+       if(Res > 0 && BwReadLimit > 0) 
+        CircleBuf::BwTickReadData += Res;
+     
        if (Res == 0)
         return false;
        if (Res < 0)
@@@ -205,23 -241,28 +240,23 @@@ bool CircleBuf::WriteTillEl(string &Dat
        if (Buf[I%Size] != '\n')
         continue;
        ++I;
 -      if (I < InP  && Buf[I%Size] == '\r')
 -         ++I;
        
        if (Single == false)
        {
 -       if (Buf[I%Size] != '\n')
 -          continue;
 -         ++I;
           if (I < InP  && Buf[I%Size] == '\r')
              ++I;
 +         if (I >= InP || Buf[I%Size] != '\n')
 +            continue;
 +         ++I;
        }
        
 -      if (I > InP)
 -       I = InP;
 -      
        Data = "";
        while (OutP < I)
        {
         unsigned long Sz = LeftWrite();
         if (Sz == 0)
            return false;
 -       if (I - OutP < LeftWrite())
 +       if (I - OutP < Sz)
            Sz = I - OutP;
         Data += string((char *)(Buf + (OutP%Size)),Sz);
         OutP += Sz;
@@@ -783,7 -824,10 +818,10 @@@ bool HttpMethod::Flush(ServerState *Srv
  {
     if (File != 0)
     {
-       SetNonBlock(File->Fd(),false);
+       // on GNU/kFreeBSD, apt dies on /dev/null because non-blocking
+       // can't be set
+       if (File->Name() != "/dev/null")
+        SetNonBlock(File->Fd(),false);
        if (Srv->In.WriteSpace() == false)
         return true;
        
@@@ -811,7 -855,10 +849,10 @@@ bool HttpMethod::ServerDie(ServerState 
     // Dump the buffer to the file
     if (Srv->State == ServerState::Data)
     {
-       SetNonBlock(File->Fd(),false);
+       // on GNU/kFreeBSD, apt dies on /dev/null because non-blocking
+       // can't be set
+       if (File->Name() != "/dev/null")
+        SetNonBlock(File->Fd(),false);
        while (Srv->In.WriteSpace() == true)
        {
         if (Srv->In.Write(File->Fd()) == false)
diff --combined po/apt-all.pot
index 541a90df494262c2b3e59614ca79eab2b9fe4d62,311549b4fa170b361b565b7dd20a47279d74f0c9..1057afa5e294978a3f444078bd2326f5472c2ccf
@@@ -7,7 -7,7 +7,7 @@@ msgid "
  msgstr ""
  "Project-Id-Version: PACKAGE VERSION\n"
  "Report-Msgid-Bugs-To: \n"
- "POT-Creation-Date: 2005-10-17 19:31+0200\n"
 -"POT-Creation-Date: 2005-11-30 08:37+0100\n"
++"POT-Creation-Date: 2005-11-30 11:23+0100\n"
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  "Language-Team: LANGUAGE <LL@li.org>\n"
  "Content-Type: text/plain; charset=CHARSET\n"
  "Content-Transfer-Encoding: 8bit\n"
  
 -#: cmdline/apt-cache.cc:135
 +#: cmdline/apt-cache.cc:141
  #, c-format
  msgid "Package %s version %s has an unmet dep:\n"
  msgstr ""
  
 -#: cmdline/apt-cache.cc:175 cmdline/apt-cache.cc:527 cmdline/apt-cache.cc:615
 -#: cmdline/apt-cache.cc:771 cmdline/apt-cache.cc:989 cmdline/apt-cache.cc:1357
 -#: cmdline/apt-cache.cc:1508
 +#: cmdline/apt-cache.cc:181 cmdline/apt-cache.cc:550 cmdline/apt-cache.cc:638
 +#: cmdline/apt-cache.cc:794 cmdline/apt-cache.cc:1012
- #: cmdline/apt-cache.cc:1419 cmdline/apt-cache.cc:1570
++#: cmdline/apt-cache.cc:1413 cmdline/apt-cache.cc:1564
  #, c-format
  msgid "Unable to locate package %s"
  msgstr ""
  
 -#: cmdline/apt-cache.cc:232
 +#: cmdline/apt-cache.cc:245
  msgid "Total package names : "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:272
 +#: cmdline/apt-cache.cc:285
  msgid "  Normal packages: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:273
 +#: cmdline/apt-cache.cc:286
  msgid "  Pure virtual packages: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:274
 +#: cmdline/apt-cache.cc:287
  msgid "  Single virtual packages: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:275
 +#: cmdline/apt-cache.cc:288
  msgid "  Mixed virtual packages: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:276
 +#: cmdline/apt-cache.cc:289
  msgid "  Missing: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:278
 +#: cmdline/apt-cache.cc:291
  msgid "Total distinct versions: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:280
 +#: cmdline/apt-cache.cc:293
 +msgid "Total Distinct Descriptions: "
 +msgstr ""
 +
 +#: cmdline/apt-cache.cc:295
  msgid "Total dependencies: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:283
 +#: cmdline/apt-cache.cc:298
  msgid "Total ver/file relations: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:285
 +#: cmdline/apt-cache.cc:300
 +msgid "Total Desc/File relations: "
 +msgstr ""
 +
 +#: cmdline/apt-cache.cc:302
  msgid "Total Provides mappings: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:297
 +#: cmdline/apt-cache.cc:314
  msgid "Total globbed strings: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:311
 +#: cmdline/apt-cache.cc:328
  msgid "Total dependency version space: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:316
 +#: cmdline/apt-cache.cc:333
  msgid "Total slack space: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:324
 +#: cmdline/apt-cache.cc:341
  msgid "Total space accounted for: "
  msgstr ""
  
 -#: cmdline/apt-cache.cc:446 cmdline/apt-cache.cc:1189
 +#: cmdline/apt-cache.cc:469 cmdline/apt-cache.cc:1212
  #, c-format
  msgid "Package file %s is out of sync."
  msgstr ""
  
- #: cmdline/apt-cache.cc:1293
 -#: cmdline/apt-cache.cc:1231
++#: cmdline/apt-cache.cc:1287
  msgid "You must give exactly one pattern"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1447
 -#: cmdline/apt-cache.cc:1385
++#: cmdline/apt-cache.cc:1441
  msgid "No packages found"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1524
 -#: cmdline/apt-cache.cc:1462
++#: cmdline/apt-cache.cc:1518
  msgid "Package files:"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1531 cmdline/apt-cache.cc:1617
 -#: cmdline/apt-cache.cc:1469 cmdline/apt-cache.cc:1555
++#: cmdline/apt-cache.cc:1525 cmdline/apt-cache.cc:1611
  msgid "Cache is out of sync, can't x-ref a package file"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1532
 -#: cmdline/apt-cache.cc:1470
++#: cmdline/apt-cache.cc:1526
  #, c-format
  msgid "%4i %s\n"
  msgstr ""
  
  #. Show any packages have explicit pins
- #: cmdline/apt-cache.cc:1544
 -#: cmdline/apt-cache.cc:1482
++#: cmdline/apt-cache.cc:1538
  msgid "Pinned packages:"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1556 cmdline/apt-cache.cc:1597
 -#: cmdline/apt-cache.cc:1494 cmdline/apt-cache.cc:1535
++#: cmdline/apt-cache.cc:1550 cmdline/apt-cache.cc:1591
  msgid "(not found)"
  msgstr ""
  
  #. Installed version
- #: cmdline/apt-cache.cc:1577
 -#: cmdline/apt-cache.cc:1515
++#: cmdline/apt-cache.cc:1571
  msgid "  Installed: "
  msgstr ""
  
- #: cmdline/apt-cache.cc:1579 cmdline/apt-cache.cc:1587
 -#: cmdline/apt-cache.cc:1517 cmdline/apt-cache.cc:1525
++#: cmdline/apt-cache.cc:1573 cmdline/apt-cache.cc:1581
  msgid "(none)"
  msgstr ""
  
  #. Candidate Version
- #: cmdline/apt-cache.cc:1584
 -#: cmdline/apt-cache.cc:1522
++#: cmdline/apt-cache.cc:1578
  msgid "  Candidate: "
  msgstr ""
  
- #: cmdline/apt-cache.cc:1594
 -#: cmdline/apt-cache.cc:1532
++#: cmdline/apt-cache.cc:1588
  msgid "  Package pin: "
  msgstr ""
  
  #. Show the priority tables
- #: cmdline/apt-cache.cc:1603
 -#: cmdline/apt-cache.cc:1541
++#: cmdline/apt-cache.cc:1597
  msgid "  Version table:"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1618
 -#: cmdline/apt-cache.cc:1556
++#: cmdline/apt-cache.cc:1612
  #, c-format
  msgid "       %4i %s\n"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1713 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70
 -#: cmdline/apt-cache.cc:1651 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70
++#: cmdline/apt-cache.cc:1707 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70
  #: cmdline/apt-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:550
- #: cmdline/apt-get.cc:2325 cmdline/apt-sortpkgs.cc:144
+ #: cmdline/apt-get.cc:2352 cmdline/apt-sortpkgs.cc:144
  #, c-format
  msgid "%s %s for %s %s compiled on %s %s\n"
  msgstr ""
  
- #: cmdline/apt-cache.cc:1720
 -#: cmdline/apt-cache.cc:1658
++#: cmdline/apt-cache.cc:1714
  msgid ""
  "Usage: apt-cache [options] command\n"
  "       apt-cache [options] add file1 [file2 ...]\n"
  "See the apt-cache(8) and apt.conf(5) manual pages for more information.\n"
  msgstr ""
  
+ #: cmdline/apt-cdrom.cc:78
+ msgid "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'"
+ msgstr ""
+ #: cmdline/apt-cdrom.cc:93
+ msgid "Please insert a Disc in the drive and press enter"
+ msgstr ""
+ #: cmdline/apt-cdrom.cc:117
+ msgid "Repeat this process for the rest of the CDs in your set."
+ msgstr ""
  #: cmdline/apt-config.cc:41
  msgid "Arguments not in pairs"
  msgstr ""
@@@ -239,7 -243,7 +251,7 @@@ msgid "
  "  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"
  msgstr ""
  
 -#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:710
 +#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:815
  #, c-format
  msgid "Unable to write to %s"
  msgstr ""
@@@ -422,12 -426,12 +434,12 @@@ msgstr "
  msgid "Archive had no package field"
  msgstr ""
  
- #: ftparchive/writer.cc:394 ftparchive/writer.cc:602
+ #: ftparchive/writer.cc:394 ftparchive/writer.cc:603
  #, c-format
  msgid "  %s has no override entry\n"
  msgstr ""
  
- #: ftparchive/writer.cc:437 ftparchive/writer.cc:688
+ #: ftparchive/writer.cc:437 ftparchive/writer.cc:689
  #, c-format
  msgid "  %s maintainer is %s not %s\n"
  msgstr ""
@@@ -531,7 -535,7 +543,7 @@@ msgstr "
  msgid "Y"
  msgstr ""
  
- #: cmdline/apt-get.cc:140 cmdline/apt-get.cc:1486
+ #: cmdline/apt-get.cc:140 cmdline/apt-get.cc:1513
  #, c-format
  msgid "Regex compilation error - %s"
  msgstr ""
@@@ -690,11 -694,11 +702,11 @@@ msgstr "
  msgid "Internal error, Ordering didn't finish"
  msgstr ""
  
- #: cmdline/apt-get.cc:789 cmdline/apt-get.cc:1780 cmdline/apt-get.cc:1813
+ #: cmdline/apt-get.cc:789 cmdline/apt-get.cc:1807 cmdline/apt-get.cc:1840
  msgid "Unable to lock the download directory"
  msgstr ""
  
- #: cmdline/apt-get.cc:799 cmdline/apt-get.cc:1861 cmdline/apt-get.cc:2073
+ #: cmdline/apt-get.cc:799 cmdline/apt-get.cc:1888 cmdline/apt-get.cc:2100
  #: apt-pkg/cachefile.cc:67
  msgid "The list of sources could not be read."
  msgstr ""
@@@ -723,7 -727,7 +735,7 @@@ msgstr "
  msgid "After unpacking %sB disk space will be freed.\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:844 cmdline/apt-get.cc:1927
+ #: cmdline/apt-get.cc:844 cmdline/apt-get.cc:1954
  #, c-format
  msgid "Couldn't determine free space in %s"
  msgstr ""
@@@ -757,7 -761,7 +769,7 @@@ msgstr "
  msgid "Do you want to continue [Y/n]? "
  msgstr ""
  
- #: cmdline/apt-get.cc:959 cmdline/apt-get.cc:1336 cmdline/apt-get.cc:1970
+ #: cmdline/apt-get.cc:959 cmdline/apt-get.cc:1363 cmdline/apt-get.cc:1997
  #, c-format
  msgid "Failed to fetch %s  %s\n"
  msgstr ""
  msgid "Some files failed to download"
  msgstr ""
  
- #: cmdline/apt-get.cc:978 cmdline/apt-get.cc:1979
+ #: cmdline/apt-get.cc:978 cmdline/apt-get.cc:2006
  msgid "Download complete and in download only mode"
  msgstr ""
  
@@@ -858,45 -862,45 +870,45 @@@ msgstr "
  msgid "Selected version %s (%s) for %s\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:1284
+ #: cmdline/apt-get.cc:1311
  msgid "The update command takes no arguments"
  msgstr ""
  
- #: cmdline/apt-get.cc:1297 cmdline/apt-get.cc:1391
+ #: cmdline/apt-get.cc:1324 cmdline/apt-get.cc:1418
  msgid "Unable to lock the list directory"
  msgstr ""
  
- #: cmdline/apt-get.cc:1355
+ #: cmdline/apt-get.cc:1382
  msgid ""
  "Some index files failed to download, they have been ignored, or old ones "
  "used instead."
  msgstr ""
  
- #: cmdline/apt-get.cc:1374
+ #: cmdline/apt-get.cc:1401
  msgid "Internal error, AllUpgrade broke stuff"
  msgstr ""
  
- #: cmdline/apt-get.cc:1473 cmdline/apt-get.cc:1509
+ #: cmdline/apt-get.cc:1500 cmdline/apt-get.cc:1536
  #, c-format
  msgid "Couldn't find package %s"
  msgstr ""
  
- #: cmdline/apt-get.cc:1496
+ #: cmdline/apt-get.cc:1523
  #, c-format
  msgid "Note, selecting %s for regex '%s'\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:1526
+ #: cmdline/apt-get.cc:1553
  msgid "You might want to run `apt-get -f install' to correct these:"
  msgstr ""
  
- #: cmdline/apt-get.cc:1529
+ #: cmdline/apt-get.cc:1556
  msgid ""
  "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a "
  "solution)."
  msgstr ""
  
- #: cmdline/apt-get.cc:1541
+ #: cmdline/apt-get.cc:1568
  msgid ""
  "Some packages could not be installed. This may mean that you have\n"
  "requested an impossible situation or if you are using the unstable\n"
  "or been moved out of Incoming."
  msgstr ""
  
- #: cmdline/apt-get.cc:1549
+ #: cmdline/apt-get.cc:1576
  msgid ""
  "Since you only requested a single operation it is extremely likely that\n"
  "the package is simply not installable and a bug report against\n"
  "that package should be filed."
  msgstr ""
  
- #: cmdline/apt-get.cc:1554
+ #: cmdline/apt-get.cc:1581
  msgid "The following information may help to resolve the situation:"
  msgstr ""
  
- #: cmdline/apt-get.cc:1557
+ #: cmdline/apt-get.cc:1584
  msgid "Broken packages"
  msgstr ""
  
- #: cmdline/apt-get.cc:1583
+ #: cmdline/apt-get.cc:1610
  msgid "The following extra packages will be installed:"
  msgstr ""
  
- #: cmdline/apt-get.cc:1654
+ #: cmdline/apt-get.cc:1681
  msgid "Suggested packages:"
  msgstr ""
  
- #: cmdline/apt-get.cc:1655
+ #: cmdline/apt-get.cc:1682
  msgid "Recommended packages:"
  msgstr ""
  
- #: cmdline/apt-get.cc:1675
+ #: cmdline/apt-get.cc:1702
  msgid "Calculating upgrade... "
  msgstr ""
  
- #: cmdline/apt-get.cc:1678 methods/ftp.cc:702 methods/connect.cc:101
+ #: cmdline/apt-get.cc:1705 methods/ftp.cc:702 methods/connect.cc:101
  msgid "Failed"
  msgstr ""
  
- #: cmdline/apt-get.cc:1683
+ #: cmdline/apt-get.cc:1710
  msgid "Done"
  msgstr ""
  
- #: cmdline/apt-get.cc:1748 cmdline/apt-get.cc:1756
+ #: cmdline/apt-get.cc:1775 cmdline/apt-get.cc:1783
  msgid "Internal error, problem resolver broke stuff"
  msgstr ""
  
- #: cmdline/apt-get.cc:1856
+ #: cmdline/apt-get.cc:1883
  msgid "Must specify at least one package to fetch source for"
  msgstr ""
  
- #: cmdline/apt-get.cc:1883 cmdline/apt-get.cc:2091
+ #: cmdline/apt-get.cc:1910 cmdline/apt-get.cc:2118
  #, c-format
  msgid "Unable to find a source package for %s"
  msgstr ""
  
- #: cmdline/apt-get.cc:1930
+ #: cmdline/apt-get.cc:1957
  #, c-format
  msgid "You don't have enough free space in %s"
  msgstr ""
  
- #: cmdline/apt-get.cc:1935
+ #: cmdline/apt-get.cc:1962
  #, c-format
  msgid "Need to get %sB/%sB of source archives.\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:1938
+ #: cmdline/apt-get.cc:1965
  #, c-format
  msgid "Need to get %sB of source archives.\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:1944
+ #: cmdline/apt-get.cc:1971
  #, c-format
  msgid "Fetch source %s\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:1975
+ #: cmdline/apt-get.cc:2002
  msgid "Failed to fetch some archives."
  msgstr ""
  
- #: cmdline/apt-get.cc:2003
+ #: cmdline/apt-get.cc:2030
  #, c-format
  msgid "Skipping unpack of already unpacked source in %s\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:2015
+ #: cmdline/apt-get.cc:2042
  #, c-format
  msgid "Unpack command '%s' failed.\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:2016
+ #: cmdline/apt-get.cc:2043
  #, c-format
  msgid "Check if the 'dpkg-dev' package is installed.\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:2033
+ #: cmdline/apt-get.cc:2060
  #, c-format
  msgid "Build command '%s' failed.\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:2052
+ #: cmdline/apt-get.cc:2079
  msgid "Child process failed"
  msgstr ""
  
- #: cmdline/apt-get.cc:2068
+ #: cmdline/apt-get.cc:2095
  msgid "Must specify at least one package to check builddeps for"
  msgstr ""
  
- #: cmdline/apt-get.cc:2096
+ #: cmdline/apt-get.cc:2123
  #, c-format
  msgid "Unable to get build-dependency information for %s"
  msgstr ""
  
- #: cmdline/apt-get.cc:2116
+ #: cmdline/apt-get.cc:2143
  #, c-format
  msgid "%s has no build depends.\n"
  msgstr ""
  
- #: cmdline/apt-get.cc:2168
+ #: cmdline/apt-get.cc:2195
  #, c-format
  msgid ""
  "%s dependency for %s cannot be satisfied because the package %s cannot be "
  "found"
  msgstr ""
  
- #: cmdline/apt-get.cc:2220
+ #: cmdline/apt-get.cc:2247
  #, c-format
  msgid ""
  "%s dependency for %s cannot be satisfied because no available versions of "
  "package %s can satisfy version requirements"
  msgstr ""
  
- #: cmdline/apt-get.cc:2255
+ #: cmdline/apt-get.cc:2282
  #, c-format
  msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new"
  msgstr ""
  
- #: cmdline/apt-get.cc:2280
+ #: cmdline/apt-get.cc:2307
  #, c-format
  msgid "Failed to satisfy %s dependency for %s: %s"
  msgstr ""
  
- #: cmdline/apt-get.cc:2294
+ #: cmdline/apt-get.cc:2321
  #, c-format
  msgid "Build-dependencies for %s could not be satisfied."
  msgstr ""
  
- #: cmdline/apt-get.cc:2298
+ #: cmdline/apt-get.cc:2325
  msgid "Failed to process build dependencies"
  msgstr ""
  
- #: cmdline/apt-get.cc:2330
+ #: cmdline/apt-get.cc:2357
  msgid "Supported modules:"
  msgstr ""
  
- #: cmdline/apt-get.cc:2371
+ #: cmdline/apt-get.cc:2398
  msgid ""
  "Usage: apt-get [options] command\n"
  "       apt-get [options] install|remove pkg1 [pkg2 ...]\n"
@@@ -1256,7 -1260,7 +1268,7 @@@ msgstr "
  msgid "Failed to write file %s"
  msgstr ""
  
- #: apt-inst/dirstream.cc:80 apt-inst/dirstream.cc:88
+ #: apt-inst/dirstream.cc:96 apt-inst/dirstream.cc:104
  #, c-format
  msgid "Failed to close file %s"
  msgstr ""
@@@ -1309,7 -1313,8 +1321,8 @@@ msgid "File %s/%s overwrites the one i
  msgstr ""
  
  #: apt-inst/extract.cc:467 apt-pkg/contrib/configuration.cc:750
- #: apt-pkg/contrib/cdromutl.cc:153 apt-pkg/acquire.cc:417 apt-pkg/clean.cc:38
+ #: apt-pkg/contrib/cdromutl.cc:153 apt-pkg/sourcelist.cc:324
+ #: apt-pkg/acquire.cc:421 apt-pkg/clean.cc:38
  #, c-format
  msgid "Unable to read %s"
  msgstr ""
@@@ -1339,9 -1344,9 +1352,9 @@@ msgid "The info and temp directories ne
  msgstr ""
  
  #. Build the status cache
 -#: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:643
 -#: apt-pkg/pkgcachegen.cc:712 apt-pkg/pkgcachegen.cc:717
 -#: apt-pkg/pkgcachegen.cc:840
 +#: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:748
 +#: apt-pkg/pkgcachegen.cc:817 apt-pkg/pkgcachegen.cc:822
 +#: apt-pkg/pkgcachegen.cc:945
  msgid "Reading package lists"
  msgstr ""
  
@@@ -1474,12 -1479,11 +1487,12 @@@ msgid "File not found
  msgstr ""
  
  #: methods/copy.cc:42 methods/gpgv.cc:265 methods/gzip.cc:133
 -#: methods/gzip.cc:142
 +#: methods/gzip.cc:142 methods/rred.cc:234 methods/rred.cc:243
  msgid "Failed to stat"
  msgstr ""
  
  #: methods/copy.cc:79 methods/gpgv.cc:262 methods/gzip.cc:139
 +#: methods/rred.cc:240
  msgid "Failed to set modification time"
  msgstr ""
  
@@@ -1539,7 -1543,7 +1552,7 @@@ msgstr "
  msgid "Server closed the connection"
  msgstr ""
  
--#: methods/ftp.cc:338 apt-pkg/contrib/fileutl.cc:471 methods/rsh.cc:190
++#: methods/ftp.cc:338 methods/rsh.cc:190 apt-pkg/contrib/fileutl.cc:471
  msgid "Read error"
  msgstr ""
  
@@@ -1551,7 -1555,7 +1564,7 @@@ msgstr "
  msgid "Protocol corruption"
  msgstr ""
  
--#: methods/ftp.cc:446 apt-pkg/contrib/fileutl.cc:510 methods/rsh.cc:232
++#: methods/ftp.cc:446 methods/rsh.cc:232 apt-pkg/contrib/fileutl.cc:510
  msgid "Write error"
  msgstr ""
  
@@@ -1605,7 -1609,7 +1618,7 @@@ msgstr "
  msgid "Unable to accept connection"
  msgstr ""
  
- #: methods/ftp.cc:864 methods/http.cc:921 methods/rsh.cc:303
 -#: methods/ftp.cc:864 methods/http.cc:963 methods/rsh.cc:303
++#: methods/ftp.cc:864 methods/http.cc:957 methods/rsh.cc:303
  msgid "Problem hashing file"
  msgstr ""
  
@@@ -1735,79 -1739,79 +1748,87 @@@ msgstr "
  msgid "Read error from %s process"
  msgstr ""
  
- #: methods/http.cc:345
 -#: methods/http.cc:381
++#: methods/http.cc:375
  msgid "Waiting for headers"
  msgstr ""
  
- #: methods/http.cc:491
 -#: methods/http.cc:527
++#: methods/http.cc:521
  #, c-format
  msgid "Got a single header line over %u chars"
  msgstr ""
  
- #: methods/http.cc:499
 -#: methods/http.cc:535
++#: methods/http.cc:529
  msgid "Bad header line"
  msgstr ""
  
- #: methods/http.cc:518 methods/http.cc:525
 -#: methods/http.cc:554 methods/http.cc:561
++#: methods/http.cc:548 methods/http.cc:555
  msgid "The HTTP server sent an invalid reply header"
  msgstr ""
  
- #: methods/http.cc:554
 -#: methods/http.cc:590
++#: methods/http.cc:584
  msgid "The HTTP server sent an invalid Content-Length header"
  msgstr ""
  
- #: methods/http.cc:569
 -#: methods/http.cc:605
++#: methods/http.cc:599
  msgid "The HTTP server sent an invalid Content-Range header"
  msgstr ""
  
- #: methods/http.cc:571
 -#: methods/http.cc:607
++#: methods/http.cc:601
  msgid "This HTTP server has broken range support"
  msgstr ""
  
- #: methods/http.cc:595
 -#: methods/http.cc:631
++#: methods/http.cc:625
  msgid "Unknown date format"
  msgstr ""
  
- #: methods/http.cc:742
 -#: methods/http.cc:778
++#: methods/http.cc:772
  msgid "Select failed"
  msgstr ""
  
- #: methods/http.cc:747
 -#: methods/http.cc:783
++#: methods/http.cc:777
  msgid "Connection timed out"
  msgstr ""
  
- #: methods/http.cc:770
 -#: methods/http.cc:806
++#: methods/http.cc:800
  msgid "Error writing to output file"
  msgstr ""
  
- #: methods/http.cc:798
 -#: methods/http.cc:837
++#: methods/http.cc:831
  msgid "Error writing to file"
  msgstr ""
  
- #: methods/http.cc:823
 -#: methods/http.cc:865
++#: methods/http.cc:859
  msgid "Error writing to the file"
  msgstr ""
  
- #: methods/http.cc:837
 -#: methods/http.cc:879
++#: methods/http.cc:873
  msgid "Error reading from server. Remote end closed connection"
  msgstr ""
  
- #: methods/http.cc:839
 -#: methods/http.cc:881
++#: methods/http.cc:875
  msgid "Error reading from server"
  msgstr ""
  
- #: methods/http.cc:1070
 -#: methods/http.cc:1112
++#: methods/http.cc:1106
  msgid "Bad header data"
  msgstr ""
  
- #: methods/http.cc:1087
 -#: methods/http.cc:1129
++#: methods/http.cc:1123
  msgid "Connection failed"
  msgstr ""
  
- #: methods/http.cc:1178
 -#: methods/http.cc:1220
++#: methods/http.cc:1214
  msgid "Internal error"
  msgstr ""
  
++#: methods/rred.cc:219
++msgid "Could not patch file"
++msgstr ""
++
++#: methods/rsh.cc:330
++msgid "Connection closed prematurely"
++msgstr ""
++
  #: apt-pkg/contrib/mmap.cc:82
  msgid "Can't mmap an empty file"
  msgstr ""
  msgid "Couldn't make mmap of %lu bytes"
  msgstr ""
  
- #: apt-pkg/contrib/strutl.cc:984
 -#: apt-pkg/contrib/strutl.cc:938
++#: apt-pkg/contrib/strutl.cc:981
  #, c-format
  msgid "Selection %s not found"
  msgstr ""
@@@ -1938,7 -1942,7 +1959,7 @@@ msgstr "
  msgid "Unable to stat the mount point %s"
  msgstr ""
  
- #: apt-pkg/contrib/cdromutl.cc:149 apt-pkg/acquire.cc:423 apt-pkg/clean.cc:44
+ #: apt-pkg/contrib/cdromutl.cc:149 apt-pkg/acquire.cc:427 apt-pkg/clean.cc:44
  #, c-format
  msgid "Unable to change to %s"
  msgstr ""
@@@ -2014,72 -2018,72 +2035,72 @@@ msgstr "
  msgid "Problem syncing the file"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:135
 -#: apt-pkg/pkgcache.cc:126
++#: apt-pkg/pkgcache.cc:137
  msgid "Empty package cache"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:141
 -#: apt-pkg/pkgcache.cc:132
++#: apt-pkg/pkgcache.cc:143
  msgid "The package cache file is corrupted"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:146
 -#: apt-pkg/pkgcache.cc:137
++#: apt-pkg/pkgcache.cc:148
  msgid "The package cache file is an incompatible version"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:151
 -#: apt-pkg/pkgcache.cc:142
++#: apt-pkg/pkgcache.cc:153
  #, c-format
  msgid "This APT does not support the versioning system '%s'"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:156
 -#: apt-pkg/pkgcache.cc:147
++#: apt-pkg/pkgcache.cc:158
  msgid "The package cache was built for a different architecture"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:227
 -#: apt-pkg/pkgcache.cc:218
++#: apt-pkg/pkgcache.cc:229
  msgid "Depends"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:227
 -#: apt-pkg/pkgcache.cc:218
++#: apt-pkg/pkgcache.cc:229
  msgid "PreDepends"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:227
 -#: apt-pkg/pkgcache.cc:218
++#: apt-pkg/pkgcache.cc:229
  msgid "Suggests"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:228
 -#: apt-pkg/pkgcache.cc:219
++#: apt-pkg/pkgcache.cc:230
  msgid "Recommends"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:228
 -#: apt-pkg/pkgcache.cc:219
++#: apt-pkg/pkgcache.cc:230
  msgid "Conflicts"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:228
 -#: apt-pkg/pkgcache.cc:219
++#: apt-pkg/pkgcache.cc:230
  msgid "Replaces"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:229
 -#: apt-pkg/pkgcache.cc:220
++#: apt-pkg/pkgcache.cc:231
  msgid "Obsoletes"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:240
 -#: apt-pkg/pkgcache.cc:231
++#: apt-pkg/pkgcache.cc:242
  msgid "important"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:240
 -#: apt-pkg/pkgcache.cc:231
++#: apt-pkg/pkgcache.cc:242
  msgid "required"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:240
 -#: apt-pkg/pkgcache.cc:231
++#: apt-pkg/pkgcache.cc:242
  msgid "standard"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:241
 -#: apt-pkg/pkgcache.cc:232
++#: apt-pkg/pkgcache.cc:243
  msgid "optional"
  msgstr ""
  
- #: apt-pkg/pkgcache.cc:241
 -#: apt-pkg/pkgcache.cc:232
++#: apt-pkg/pkgcache.cc:243
  msgid "extra"
  msgstr ""
  
@@@ -2105,52 -2109,52 +2126,52 @@@ msgstr "
  msgid "Unable to parse package file %s (2)"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:87
+ #: apt-pkg/sourcelist.cc:94
  #, c-format
  msgid "Malformed line %lu in source list %s (URI)"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:89
+ #: apt-pkg/sourcelist.cc:96
  #, c-format
  msgid "Malformed line %lu in source list %s (dist)"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:92
+ #: apt-pkg/sourcelist.cc:99
  #, c-format
  msgid "Malformed line %lu in source list %s (URI parse)"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:98
+ #: apt-pkg/sourcelist.cc:105
  #, c-format
  msgid "Malformed line %lu in source list %s (absolute dist)"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:105
+ #: apt-pkg/sourcelist.cc:112
  #, c-format
  msgid "Malformed line %lu in source list %s (dist parse)"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:156
+ #: apt-pkg/sourcelist.cc:203
  #, c-format
  msgid "Opening %s"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:170 apt-pkg/cdrom.cc:450
 -#: apt-pkg/sourcelist.cc:220 apt-pkg/cdrom.cc:426
++#: apt-pkg/sourcelist.cc:220 apt-pkg/cdrom.cc:450
  #, c-format
  msgid "Line %u too long in source list %s."
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:187
+ #: apt-pkg/sourcelist.cc:240
  #, c-format
  msgid "Malformed line %u in source list %s (type)"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:191
+ #: apt-pkg/sourcelist.cc:244
  #, c-format
  msgid "Type '%s' is not known on line %u in source list %s"
  msgstr ""
  
- #: apt-pkg/sourcelist.cc:199 apt-pkg/sourcelist.cc:202
+ #: apt-pkg/sourcelist.cc:252 apt-pkg/sourcelist.cc:255
  #, c-format
  msgid "Malformed line %u in source list %s (vendor id)"
  msgstr ""
@@@ -2194,7 -2198,7 +2215,7 @@@ msgstr "
  msgid "Archive directory %spartial is missing."
  msgstr ""
  
- #: apt-pkg/acquire.cc:817
+ #: apt-pkg/acquire.cc:821
  #, c-format
  msgid "Downloading file %li of %li (%s remaining)"
  msgstr ""
@@@ -2214,12 -2218,12 +2235,12 @@@ msgstr "
  msgid "Please insert the disc labeled: '%s' in the drive '%s' and press enter."
  msgstr ""
  
- #: apt-pkg/init.cc:122
 -#: apt-pkg/init.cc:120
++#: apt-pkg/init.cc:123
  #, c-format
  msgid "Packaging system '%s' is not supported"
  msgstr ""
  
- #: apt-pkg/init.cc:138
 -#: apt-pkg/init.cc:136
++#: apt-pkg/init.cc:139
  msgid "Unable to determine a suitable packaging system type"
  msgstr ""
  
@@@ -2262,121 -2266,106 +2283,121 @@@ msgstr "
  msgid "Error occurred while processing %s (NewPackage)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:129
 +#: apt-pkg/pkgcachegen.cc:132
  #, c-format
  msgid "Error occurred while processing %s (UsePackage1)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:150
 +#: apt-pkg/pkgcachegen.cc:155
 +#, c-format
 +msgid "Error occured while processing %s (NewFileDesc1)"
 +msgstr ""
 +
 +#: apt-pkg/pkgcachegen.cc:180
  #, c-format
  msgid "Error occurred while processing %s (UsePackage2)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:154
 +#: apt-pkg/pkgcachegen.cc:184
  #, c-format
  msgid "Error occurred while processing %s (NewFileVer1)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:184
 +#: apt-pkg/pkgcachegen.cc:215
  #, c-format
  msgid "Error occurred while processing %s (NewVersion1)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:188
 +#: apt-pkg/pkgcachegen.cc:219
  #, c-format
  msgid "Error occurred while processing %s (UsePackage3)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:192
 +#: apt-pkg/pkgcachegen.cc:223
  #, c-format
  msgid "Error occurred while processing %s (NewVersion2)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:207
 +#: apt-pkg/pkgcachegen.cc:247
 +#, c-format
 +msgid "Error occured while processing %s (NewFileDesc2)"
 +msgstr ""
 +
 +#: apt-pkg/pkgcachegen.cc:253
  msgid "Wow, you exceeded the number of package names this APT is capable of."
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:210
 +#: apt-pkg/pkgcachegen.cc:256
  msgid "Wow, you exceeded the number of versions this APT is capable of."
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:213
 +#: apt-pkg/pkgcachegen.cc:259
 +msgid "Wow, you exceeded the number of descriptions this APT is capable of."
 +msgstr ""
 +
 +#: apt-pkg/pkgcachegen.cc:262
  msgid "Wow, you exceeded the number of dependencies this APT is capable of."
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:241
 +#: apt-pkg/pkgcachegen.cc:290
  #, c-format
  msgid "Error occurred while processing %s (FindPkg)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:254
 +#: apt-pkg/pkgcachegen.cc:303
  #, c-format
  msgid "Error occurred while processing %s (CollectFileProvides)"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:260
 +#: apt-pkg/pkgcachegen.cc:309
  #, c-format
  msgid "Package %s %s was not found while processing file dependencies"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:574
 +#: apt-pkg/pkgcachegen.cc:679
  #, c-format
  msgid "Couldn't stat source package list %s"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:658
 +#: apt-pkg/pkgcachegen.cc:763
  msgid "Collecting File Provides"
  msgstr ""
  
 -#: apt-pkg/pkgcachegen.cc:785 apt-pkg/pkgcachegen.cc:792
 +#: apt-pkg/pkgcachegen.cc:890 apt-pkg/pkgcachegen.cc:897
  msgid "IO Error saving source cache"
  msgstr ""
  
 -#: apt-pkg/acquire-item.cc:126
 +#: apt-pkg/acquire-item.cc:129
  #, c-format
  msgid "rename failed, %s (%s -> %s)."
  msgstr ""
  
 -#: apt-pkg/acquire-item.cc:236 apt-pkg/acquire-item.cc:911
 +#: apt-pkg/acquire-item.cc:391 apt-pkg/acquire-item.cc:635
- #: apt-pkg/acquire-item.cc:1336
++#: apt-pkg/acquire-item.cc:1339
  msgid "MD5Sum mismatch"
  msgstr ""
  
- #: apt-pkg/acquire-item.cc:1150
 -#: apt-pkg/acquire-item.cc:719
++#: apt-pkg/acquire-item.cc:1147
  #, c-format
  msgid ""
  "I wasn't able to locate a file for the %s package. This might mean you need "
  "to manually fix this package. (due to missing arch)"
  msgstr ""
  
- #: apt-pkg/acquire-item.cc:1203
 -#: apt-pkg/acquire-item.cc:778
++#: apt-pkg/acquire-item.cc:1206
  #, c-format
  msgid ""
  "I wasn't able to locate file for the %s package. This might mean you need to "
  "manually fix this package."
  msgstr ""
  
- #: apt-pkg/acquire-item.cc:1239
 -#: apt-pkg/acquire-item.cc:814
++#: apt-pkg/acquire-item.cc:1242
  #, c-format
  msgid ""
  "The package index files are corrupted. No Filename: field for package %s."
  msgstr ""
  
- #: apt-pkg/acquire-item.cc:1326
 -#: apt-pkg/acquire-item.cc:901
++#: apt-pkg/acquire-item.cc:1329
  msgid "Size mismatch"
  msgstr ""
  
  msgid "Vendor block %s contains no fingerprint"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:507
 +#: apt-pkg/cdrom.cc:531
  #, c-format
  msgid ""
  "Using CD-ROM mount point %s\n"
  "Mounting CD-ROM\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:516 apt-pkg/cdrom.cc:598
 +#: apt-pkg/cdrom.cc:540 apt-pkg/cdrom.cc:622
  msgid "Identifying.. "
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:541
 +#: apt-pkg/cdrom.cc:565
  #, c-format
  msgid "Stored label: %s \n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:561
 +#: apt-pkg/cdrom.cc:585
  #, c-format
  msgid "Using CD-ROM mount point %s\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:579
 +#: apt-pkg/cdrom.cc:603
  msgid "Unmounting CD-ROM\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:583
 +#: apt-pkg/cdrom.cc:607
  msgid "Waiting for disc...\n"
  msgstr ""
  
  #. Mount the new CDROM
 -#: apt-pkg/cdrom.cc:591
 +#: apt-pkg/cdrom.cc:615
  msgid "Mounting CD-ROM...\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:609
 +#: apt-pkg/cdrom.cc:633
  msgid "Scanning disc for index files..\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:647
 +#: apt-pkg/cdrom.cc:673
  #, c-format
 -msgid "Found %i package indexes, %i source indexes and %i signatures\n"
 +msgid ""
 +"Found %i package indexes, %i source indexes, %i translation indexes and %i "
 +"signatures\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:710
 +#: apt-pkg/cdrom.cc:737
  msgid "That is not a valid name, try again.\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:726
 +#: apt-pkg/cdrom.cc:753
  #, c-format
  msgid ""
  "This disc is called: \n"
  "'%s'\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:730
 +#: apt-pkg/cdrom.cc:757
  msgid "Copying package lists..."
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:754
 +#: apt-pkg/cdrom.cc:783
  msgid "Writing new source list\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:763
 +#: apt-pkg/cdrom.cc:792
  msgid "Source list entries for this disc are:\n"
  msgstr ""
  
 -#: apt-pkg/cdrom.cc:803
 +#: apt-pkg/cdrom.cc:832
  msgid "Unmounting CD-ROM..."
  msgstr ""
  
 -#: apt-pkg/indexcopy.cc:261
 +#: apt-pkg/indexcopy.cc:263 apt-pkg/indexcopy.cc:830
  #, c-format
  msgid "Wrote %i records.\n"
  msgstr ""
  
 -#: apt-pkg/indexcopy.cc:263
 +#: apt-pkg/indexcopy.cc:265 apt-pkg/indexcopy.cc:832
  #, c-format
  msgid "Wrote %i records with %i missing files.\n"
  msgstr ""
  
 -#: apt-pkg/indexcopy.cc:266
 +#: apt-pkg/indexcopy.cc:268 apt-pkg/indexcopy.cc:835
  #, c-format
  msgid "Wrote %i records with %i mismatched files\n"
  msgstr ""
  
 -#: apt-pkg/indexcopy.cc:269
 +#: apt-pkg/indexcopy.cc:271 apt-pkg/indexcopy.cc:838
  #, c-format
  msgid "Wrote %i records with %i missing files and %i mismatched files\n"
  msgstr ""
@@@ -2526,11 -2513,7 +2547,3 @@@ msgstr "
  #, c-format
  msgid "Removed with config %s"
  msgstr ""
- #: methods/rred.cc:219
- msgid "Could not patch file"
- msgstr ""
--
--#: methods/rsh.cc:330
--msgid "Connection closed prematurely"
--msgstr ""