]> git.saurik.com Git - apt.git/commitdiff
* merged with apt--mvo
authorMichael Vogt <michael.vogt@ubuntu.com>
Tue, 27 Sep 2005 22:30:23 +0000 (22:30 +0000)
committerMichael Vogt <michael.vogt@ubuntu.com>
Tue, 27 Sep 2005 22:30:23 +0000 (22:30 +0000)
Patches applied:

 * bubulle@debian.org--2005/apt--main--0--patch-96
   Sync with Matt

 * bubulle@debian.org--2005/apt--main--0--patch-97
   Merge with Matt

 * bubulle@debian.org--2005/apt--main--0--patch-98
   Update PO files with the POT

 * bubulle@debian.org--2005/apt--main--0--patch-99
   Added Galician translation

 * bubulle@debian.org--2005/apt--main--0--patch-100
   Completed Danish translation

 * bubulle@debian.org--2005/apt--main--0--patch-101
   Merge with Matt

 * bubulle@debian.org--2005/apt--main--0--patch-102
   Merge with Michael Vogt's archive

 * bubulle@debian.org--2005/apt--main--0--patch-103
   Update the POT files and all PO files to resync with recent code

 * bubulle@debian.org--2005/apt--main--0--patch-104
   French translation completed

 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-79

 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-1
   * merged with mainline and apt--fixes--0

 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-2
   * patch from aj (slighly modified to use auto_ptr<>) applied

 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-3
   * changelog updated

 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-4
   * work for arch=all packages too now

 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-5
   * merged with apt--main--0

 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-6
   * fixed a incorrect po/he.po merge

 * michael.vogt@ubuntu.com--2005/apt--cdrom-fallback--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-110

 * michael.vogt@ubuntu.com--2005/apt--cdrom-fallback--0--patch-1
   * initial patch to make falling back from cdrom possible

 * michael.vogt@ubuntu.com--2005/apt--cdrom-fallback--0--patch-2
   * fix in methods/cdrom.cc: don't call Fail() but return false so that apt can fallback to a differencent source

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-7
   * fixed incorrect man-page example

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-8
   * changelog udpate

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-9
   * we only need to check once for xmlto

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-10
   * fix a bug in a man-page, fix a problem with overly long lines in apt-cdrom

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-11
   * merged with apt--main--0

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-12
   * fix a incorrect error message (it always added .gz regardless what was downloaded)

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-13
   * merged with main

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-14
   * added Hashsum support for file and cdrom

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-15
   * added README.arch

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-16
   * merged with main

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-17
   * move the changelog to the right place

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-18
   * Change pkgPolicy::Pin from private to protected

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-19
   * added a default constructor for PrvIterator

 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-20
   * applied otavios patch to reread the statusFile on debSystem::Initialize

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-33
   * merged with matt's tree

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-34
   * merged with matts tree

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-35
   * build debian and ubuntu package from the same source

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-36
   * added debian/patches dir

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-37
   * fix the breakage from my last commit (note to self: always, _always_ run baz diff before a commit)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-38
   * removed the lsb_release build patch (nobody except me seems to like it)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-39
   * merged from main

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-40
   * merged the apt--sane-handle-timeout--0 branch

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-41
   * merged apt--bts225947--0

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

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-43
   * added patch that adds a apt-secure man-page (thanks to jfs@computer.org)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-44
   * added author credits

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-45
   * added apt-ftparchive.conf example

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-46
   * corrected the utf8 of javier fernandes pena

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-47
   * improve the timeout handling (again)

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

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-49
   * README.arch updates, comment in apt-pkg/algorithm.h added, apt-pkg/cacheiterators.h order in initlist changed to remove warning

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-50
   * meda-change message is send over status-fd now

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-51
   * include a human readable string for the MediaChange status-fd message as well

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-52
   * finalizing changelog

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-53
   * check ctime as well in cron.daily when cleaning up packages in apt.cron.daily

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-54
   * fix a stupid typo in apt.cron.daily

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-55
   * fix apt-pkg/cdrom.cc to umount the cdrom again if anything fails

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-56
   * merged from apt--cdrom-fallback--0

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

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-58
   * better error string for a failed dpkg-source

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-59
   * make sure that the pkgRecords D'tor does not segfault

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-60
   * merged updated french man-page

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

 * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-87

 * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-1
   * report timeouts (from Connect) and fail if they happen in pkgAcqMetaSig

 * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-2
   * merged with the fixes branch to make it build again

 * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-3
   * merged with main

 * otavio@debian.org--2005/apt--fixes--0--patch-28
   Reread status configuration, needed for clients using independent apt ...

 * philippe.batailler@free.fr--2005/VOGTapt--mvo--0--patch-1
   French L10N update

 * philippe.batailler@free.fr--2005/VOGTapt--mvo--0--patch-2
   Generate correctly french manpages

1  2 
apt-pkg/acquire-item.cc
apt-pkg/acquire-item.h
apt-pkg/cacheiterators.h
apt-pkg/cdrom.cc
apt-pkg/pkgrecords.cc
apt-pkg/pkgrecords.h
debian/changelog

diff --combined apt-pkg/acquire-item.cc
index 12dc811a66b53e9c7da328f3491d84c7432a2b7e,dea68f3eef8259034f58e2ae222595529f1bdf0b..e0e0611f04e94dc527be17c21ecef7cd5c28f164
@@@ -142,20 -142,21 +142,21 @@@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Ow
  {
     Decompression = false;
     Erase = false;
-    
     DestFile = _config->FindDir("Dir::State::lists") + "partial/";
     DestFile += URItoFileName(URI);
  
     if(comprExt.empty()) 
     {
-       // autoselect 
-       if(FileExists("/usr/bin/bzip2"))
-        Desc.URI = URI + ".bz2"; 
-       else
-        Desc.URI = URI + ".gz"; 
+       // autoselect the compression method
+       if(FileExists("/usr/bin/bzip2")) 
+        CompressionExtension = ".bz2";
+       else 
+        CompressionExtension = ".gz";
     } else {
-       Desc.URI = URI + comprExt; 
+       CompressionExtension = comprExt;
     }
+    Desc.URI = URI + CompressionExtension; 
  
     Desc.Description = URIDesc;
     Desc.Owner = this;
@@@ -307,35 -308,6 +308,35 @@@ void pkgAcqIndex::Done(string Message,u
     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,
@@@ -429,6 -401,13 +430,13 @@@ void pkgAcqMetaSig::Failed(string Messa
     string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
     unlink(Final.c_str());
  
+    // if we get a timeout if fail
+    if(LookupTag(Message,"FailReason") == "Timeout" || 
+       LookupTag(Message,"FailReason") == "TmpResolveFailure") {
+       Item::Failed(Message,Cnf);
+       return;
+    }
     // queue a pkgAcqMetaIndex with no sigfile
     new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
                       "", IndexTargets, MetaIndexParser);
@@@ -927,7 -906,8 +935,8 @@@ void pkgAcqArchive::Done(string Message
        {
         Status = StatError;
         ErrorText = _("MD5Sum mismatch");
-        Rename(DestFile,DestFile + ".FAILED");
+        if(FileExists(DestFile))
+           Rename(DestFile,DestFile + ".FAILED");
         return;
        }
     }
diff --combined apt-pkg/acquire-item.h
index 2f7c71a8156abb658d94766bedb956a522b86287,90f80368b9c6f29d5db712972df23af639bae4a5..ae2fba4d589009dd5eac12f173ee902b4b2b6911
@@@ -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.
@@@ -92,7 -92,8 +92,8 @@@ class pkgAcqIndex : public pkgAcquire::
     pkgAcquire::ItemDesc Desc;
     string RealURI;
     string ExpectedMD5;
-    
+    string CompressionExtension;
     public:
     
     // Specialized action members
     virtual void Done(string Message,unsigned long Size,string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
     virtual string Custom600Headers();
-    virtual string DescURI() {return RealURI + ".gz";};
+    virtual string DescURI() {return RealURI + CompressionExtension;};
  
     pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
               string ShortDesct, string ExpectedMD5, string compressExt="");
  };
  
 +// Item class for translated package index files
 +class pkgAcqIndexTrans : public pkgAcqIndex
 +{
 +   public:
 +  
 +   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 +   pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
 +                  string ShortDesct);
 +};
 +
  struct IndexTarget
  {
     string URI;
diff --combined apt-pkg/cacheiterators.h
index e34920032b62b6bad2da45495c0755bf19e9244f,c3a0d0a5a45fa3132a30ea57118e26d0b9737069..f0aafb52df1b7092b36a8544a166958c058c19be
@@@ -99,7 -99,7 +99,7 @@@ class pkgCache::VerIterato
  {
     Version *Ver;
     pkgCache *Owner;
 -   
 +
     void _dummy();
     
     public:
     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;
     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
  {
@@@ -267,7 -222,7 +267,7 @@@ class pkgCache::PrvIterato
     void operator ++(int) {if (Prv != Owner->ProvideP) Prv = Owner->ProvideP +
        (Type == PrvVer?Prv->NextPkgProv:Prv->NextProvides);};
     inline void operator ++() {operator ++(0);};
-    inline bool end() const {return Prv == Owner->ProvideP?true:false;};
+    inline bool end() const {return Owner == 0 || Prv == Owner->ProvideP?true:false;};
     
     // Comparison
     inline bool operator ==(const PrvIterator &B) const {return Prv == B.Prv;};
     inline PkgIterator OwnerPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Prv->Version].ParentPkg);};
     inline unsigned long Index() const {return Prv - Owner->ProvideP;};
  
+    inline PrvIterator() : Prv(0), Type(PrvVer), Owner(0)  {};
     inline PrvIterator(pkgCache &Owner,Provides *Trg,Version *) :
            Prv(Trg), Type(PrvVer), Owner(&Owner) 
     {
@@@ -381,38 -338,6 +383,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);};
@@@ -422,15 -347,11 +424,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
diff --combined apt-pkg/cdrom.cc
index 7e194e2532b6527171826862aeecad4136b27a42,ce1beb39b8c3b24084fadc155cf2efa2573671e0..b42c82dd0f0e9fedbcb245668e505dd65a9535e6
@@@ -30,16 -30,12 +30,16 @@@ using namespace std
     search that short circuits when it his a package file in the dir.
     This speeds it up greatly as the majority of the size is in the
     binary-* sub dirs. */
 -bool pkgCdrom::FindPackages(string CD,vector<string> &List,
 -                          vector<string> &SList, vector<string> &SigList,
 +bool pkgCdrom::FindPackages(string CD,
 +                          vector<string> &List,
 +                          vector<string> &SList, 
 +                          vector<string> &SigList,
 +                          vector<string> &TransList,
                            string &InfoDir, pkgCdromStatus *log,
                            unsigned int Depth)
  {
     static ino_t Inodes[9];
 +   DIR *D;
  
     // if we have a look we "pulse" now
     if(log)
        if (_config->FindB("APT::CDROM::Thorough",false) == false)
         return true;
     }
 +
 +   // see if we find translatin indexes
 +   if (stat("i18n",&Buf) == 0)
 +   {
 +      D = opendir("i18n");
 +      for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D))
 +      {
 +       if(strstr(Dir->d_name,"Translation") != NULL) 
 +       {
 +          if (_config->FindB("Debug::aptcdrom",false) == true)
 +             std::clog << "found translations: " << Dir->d_name << "\n";
 +          string file = Dir->d_name;
 +          if(file.substr(file.size()-3,file.size()) == ".gz")
 +             file = file.substr(0,file.size()-3);
 +          TransList.push_back(CD+"i18n/"+ file);
 +       }
 +      }
 +      closedir(D);
 +   }
 +
     
 -   DIR *D = opendir(".");
 +   D = opendir(".");
     if (D == 0)
        return _error->Errno("opendir","Unable to read %s",CD.c_str());
     
        Inodes[Depth] = Buf.st_ino;
  
        // Descend
 -      if (FindPackages(CD + Dir->d_name,List,SList,SigList,InfoDir,log,Depth+1) == false)
 +      if (FindPackages(CD + Dir->d_name,List,SList,SigList,TransList,InfoDir,log,Depth+1) == false)
         break;
  
        if (chdir(CD.c_str()) != 0)
@@@ -446,6 -422,9 +446,9 @@@ bool pkgCdrom::WriteSourceList(string N
     {      
        F.getline(Buffer,sizeof(Buffer));
        CurLine++;
+       if (F.fail() && !F.eof())
+        return _error->Error(_("Line %u too long in source list %s."),
+                             CurLine,File.c_str());
        _strtabexpand(Buffer,sizeof(Buffer));
        _strstrip(Buffer);
              
@@@ -588,7 -567,7 +591,7 @@@ bool pkgCdrom::Add(pkgCdromStatus *log
     string DFile = _config->FindFile("Dir::State::cdroms");
     if (FileExists(DFile) == true)
     {
-       if (ReadConfigFile(Database,DFile) == false)
+       if (ReadConfigFile(Database,DFile) == false) 
         return _error->Error("Unable to read the cdrom database %s",
                              DFile.c_str());
     }
     vector<string> List;
     vector<string> SourceList;
     vector<string> SigList;
 +   vector<string> TransList;
     string StartDir = SafeGetCWD();
     string InfoDir;
 -   if (FindPackages(CDROM,List,SourceList, SigList,InfoDir,log) == false)
 +   if (FindPackages(CDROM,List,SourceList, SigList,TransList,InfoDir,log) == false)
     {
        log->Update("\n");
        return false;
     DropRepeats(List,"Packages");
     DropRepeats(SourceList,"Sources");
     DropRepeats(SigList,"Release.gpg");
 +   DropRepeats(TransList,"");
     if(log) {
        msg.str("");
 -      ioprintf(msg, _("Found %i package indexes, %i source indexes and "
 -                    "%i signatures\n"), 
 -             List.size(), SourceList.size(), SigList.size());
 +      ioprintf(msg, _("Found %i package indexes, %i source indexes, "
 +                    "%i translation indexes and %i signatures\n"), 
 +             List.size(), SourceList.size(), TransList.size(),
 +             SigList.size());
        log->Update(msg.str(), STEP_SCAN);
     }
  
-    if (List.size() == 0 && SourceList.size() == 0)
+    if (List.size() == 0 && SourceList.size() == 0) 
+    {
+       UnmountCdrom(CDROM);
        return _error->Error("Unable to locate any package files, perhaps this is not a Debian Disc");
+    }
  
     // Check if the CD is in the database
     string Name;
          Name.empty() == true)
        {
         if(!log) 
+          {
+           UnmountCdrom(CDROM);
            return _error->Error("No disc name found and no way to ask for it");
+        }
  
         while(true) {
            if(!log->AskCdromName(Name)) {
     // Copy the package files to the state directory
     PackageCopy Copy;
     SourceCopy SrcCopy;
 +   TranslationsCopy TransCopy;
     if (Copy.CopyPackages(CDROM,Name,List, log) == false ||
 -       SrcCopy.CopyPackages(CDROM,Name,SourceList, log) == false)
 +       SrcCopy.CopyPackages(CDROM,Name,SourceList, log) == false ||
 +       TransCopy.CopyTranslations(CDROM,Name,TransList, log) == false)
        return false;
  
     // reduce the List so that it takes less space in sources.list
     {
        string::size_type Space = (*I).find(' ');
        if (Space == string::npos)
+       {
+        UnmountCdrom(CDROM);
         return _error->Error("Internal error");
+       }
  
        if(log) {
         msg.str("");
     {
        string::size_type Space = (*I).find(' ');
        if (Space == string::npos)
+       {
+        UnmountCdrom(CDROM);
         return _error->Error("Internal error");
+       }
  
        if(log) {
         msg.str("");
diff --combined apt-pkg/pkgrecords.cc
index b22f3e73fc80ccf6ffe2943529f17aaa30561102,1d71d3e2fb67af1085ea441ae64e2d75d8d3d39a..f62f945b5b03cb8c14e9072bb6901498ca37ef91
@@@ -42,6 -42,9 +42,9 @@@ pkgRecords::pkgRecords(pkgCache &Cache
        if (Files[I->ID] == 0)
         return;
     }   
+    // We store that to make sure that the destructor won't segfault,
+    // even if the Cache object was destructed before this instance.
+    PackageFileCount = Cache.HeaderP->PackageFileCount;
  }
                                                                        /*}}}*/
  // Records::~pkgRecords - Destructor                                  /*{{{*/
@@@ -49,7 -52,7 +52,7 @@@
  /* */
  pkgRecords::~pkgRecords()
  {
-    for (unsigned I = 0; I != Cache.HeaderP->PackageFileCount; I++)
+    for (unsigned I = 0; I != PackageFileCount; I++)
        delete Files[I];
     delete [] Files;
  }
@@@ -63,12 -66,3 +66,12 @@@ pkgRecords::Parser &pkgRecords::Lookup(
     return *Files[Ver.File()->ID];
  }
                                                                        /*}}}*/
 +// Records::Lookup - Get a parser for the package description file    /*{{{*/
 +// ---------------------------------------------------------------------
 +/* */
 +pkgRecords::Parser &pkgRecords::Lookup(pkgCache::DescFileIterator const &Desc)
 +{
 +   Files[Desc.File()->ID]->Jump(Desc);
 +   return *Files[Desc.File()->ID];
 +}
 +                                                                      /*}}}*/
diff --combined apt-pkg/pkgrecords.h
index 31c444dbf9c82becf1cdde4fbf94be5eea74d890,f31e83afefb9be378bc111bc951b7489835b9ab1..ece91680e518e3daf3b86cd912ded17c35bc7128
@@@ -33,12 -33,12 +33,13 @@@ class pkgRecord
     
     pkgCache &Cache;
     Parser **Files;
+    int PackageFileCount;
        
     public:
  
     // Lookup function
     Parser &Lookup(pkgCache::VerFileIterator const &Ver);
 +   Parser &Lookup(pkgCache::DescFileIterator const &Desc);
  
     // Construct destruct
     pkgRecords(pkgCache &Cache);
@@@ -50,7 -50,6 +51,7 @@@ class pkgRecords::Parse
     protected:
     
     virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
 +   virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
     
     public:
     friend class pkgRecords;
diff --combined debian/changelog
index a0092d3664a179ff51da4a36f5a187cd06fb8d13,ac1e0e663fe10ca2230117a39fcca6fdf885d10d..acf74d1667a175e32f1bd8e74c48dec36d0206df
@@@ -1,10 -1,48 +1,48 @@@
- apt (0.6.40.2) unstable; urgency=low
+ apt (0.6.41.1) unstable; urgency=low
+   * apt-pkg/cdrom.cc:
+     - unmount the cdrom when apt failed to locate any package files
+   * allow cdrom failures and fallback to other sources in that case
+     (closes: #44135)
+   * better error text when dpkg-source fails 
+   * Merge bubulle@debian.org--2005/apt--main--0 up to patch-104:
+     - patch-99: Added Galician translation
+     - patch-100: Completed Danish translation (Closes: #325686)
+     - patch-104: French translation completed
+   * applied frensh man-page update (thanks to Philippe Batailler)
+   
+  -- 
+ apt (0.6.41) unstable; urgency=low
  
    * improved the support for "error" and "conffile" reporting from
      dpkg, added the format to README.progress-reporting
    * added README.progress-reporting to the apt-doc package
-  --
+   * improved the network timeout handling, if a index file from a 
+     sources.list times out or EAI_AGAIN is returned from getaddrinfo, 
+     don't try to get the other files from that entry
+   * Support architecture-specific extra overrides
+     (closes: #225947). Thanks to  Anthony Towns for idea and
+     the patch, thanks to Colin Watson for testing it.
+   * Javier Fernandez-Sanguino Pen~a:
+     - Added a first version of an apt-secure.8 manpage, and modified
+       apt-key and apt.end accordingly. Also added the 'update'
+       argument to apt-key which was previously not documented 
+       (Closes: #322120)
+   * Andreas Pakulat:
+     - added example apt-ftparchive.conf file to doc/examples 
+       (closes: #322483)
+   * Fix a incorrect example in the man-page (closes: #282918)
+   * Fix a bug for very long lines in the apt-cdrom code (closes: #280356)
+   * Fix a manual page bug (closes: #316314)
+   * Do md5sum checking for file and cdrom method (closes: #319142)
+   * Change pkgPolicy::Pin from private to protected to let subclasses
+     access it too (closes: #321799)
+   * add default constructor for PrvIterator (closes: #322267)
+   * Reread status configuration on debSystem::Initialize() 
+     (needed for apt-proxy, thanks to Otavio for this patch)
+   
+  -- Michael Vogt <mvo@debian.org>  Mon,  5 Sep 2005 22:59:03 +0200
  
  apt (0.6.40.1) unstable; urgency=low
  
@@@ -57,7 -95,6 +95,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