On Mon, Nov 21, 2011 at 01:03:08PM +0100, David Kalnischkies wrote:
> On Mon, Nov 21, 2011 at 01:26, Steve McIntyre <st...@einval.com> wrote:
> > I've just added support for translated description files into
> > debian-cd, creating Translation-$LANG.bz2 on CDs to match the
> > archive. A problem report from a user shortly afterwards described
> > apt-cdrom issues using a DVD generated with this new code. [1] I've
> > dug through the code in cdrom.cc and tagfile.cc and I've found that
> > apt simply does not support .bz2 versions of the Translation files
> > *from CD*. AFAICS it *does* support them in the main archive via HTTP
> > etc. That's a bit of a surprise, to say the least.
> 
> I am not that surprised, given that apt-cdrom is touched only once
> in a blue moon - last serious change is from 2009 (udev), the one
> before that is adding Translation support in 2007, the 2005 change
> is imported from the previous vcs… You get the pattern.
> All in all its properly save to say that the code you looked at mostly
> comes straight from the last millennium (literally speaking!)…
> 
> My personal excuse is that i haven't used it a single time, so i am
> properly not the best one to hack on it, but i fear the rest of the
> (lets count optimistic) trio seems to have the same excuse…

Yes, definitely the same here. I don't even have a single Debian
CD/DVD/Blu-Ray disc. I exclusively install systems via network,
and do not use optical discs at all.

It would be great if someone who actually needs it takes a look
at it. That said, I have pushed out the following patch to
the debian-experimental2 branch, please test it (I didn't
test it, but it compiles and looks logically right).

------------------------------------------------------------
revno: 2190
revision-id: j...@debian.org-20111121175329-4kynotjqxk6oehsa
parent: michael.v...@ubuntu.com-20111110151055-gkbk6bfx6biids40
fixes bug(s): http://bugs.debian.org/649451
committer: Julian Andres Klode <j...@debian.org>
branch nick: debian-experimental2
timestamp: Mon 2011-11-21 18:53:29 +0100
message:
  apt-pkg/cdrom.cc: Accept .bz2, .xz files in addition to .gz files (Closes: 
#649451)
diff:
=== modified file 'apt-pkg/cdrom.cc'
--- apt-pkg/cdrom.cc    2011-09-19 17:14:19 +0000
+++ apt-pkg/cdrom.cc    2011-11-21 17:53:29 +0000
@@ -81,7 +81,8 @@
    /* Aha! We found some package files. We assume that everything under 
       this dir is controlled by those package files so we don't look down
       anymore */
-   if (stat("Packages",&Buf) == 0 || stat("Packages.gz",&Buf) == 0)
+   if (stat("Packages",&Buf) == 0 || stat("Packages.gz",&Buf) == 0 ||
+       stat("Packages.bz2",&Buf) == 0 || stat("Packages.xz",&Buf) == 0)
    {
       List.push_back(CD);
       
@@ -89,7 +90,8 @@
       if (_config->FindB("APT::CDROM::Thorough",false) == false)
         return true;
    }
-   if (stat("Sources.gz",&Buf) == 0 || stat("Sources",&Buf) == 0)
+   if (stat("Sources.xz",&Buf) == 0 || stat("Sources.bz2",&Buf) == 0 ||
+       stat("Sources.gz",&Buf) == 0 || stat("Sources",&Buf) == 0)
    {
       SList.push_back(CD);
       
@@ -109,8 +111,11 @@
            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")
+           if(file.substr(file.size()-3,file.size()) == ".gz" ||
+              file.substr(file.size()-3,file.size()) == ".xz")
               file = file.substr(0,file.size()-3);
+           if(file.substr(file.size()-4,file.size()) == ".bz2")
+              file = file.substr(0,file.size()-4);
            TransList.push_back(CD+"i18n/"+ file);
         }
       }
@@ -258,7 +263,9 @@
    {
       struct stat Buf;
       if (stat((List[I] + Name).c_str(),&Buf) != 0 &&
-         stat((List[I] + Name + ".gz").c_str(),&Buf) != 0)
+         stat((List[I] + Name + ".gz").c_str(),&Buf) != 0 && 
+         stat((List[I] + Name + ".bz2").c_str(),&Buf) != 0 && 
+         stat((List[I] + Name + ".xz").c_str(),&Buf) != 0)
         _error->Errno("stat","Failed to stat %s%s",List[I].c_str(),
                       Name);
       Inodes[I] = Buf.st_ino;

=== modified file 'debian/changelog'
--- debian/changelog    2011-11-03 14:41:14 +0000
+++ debian/changelog    2011-11-21 17:53:29 +0000
@@ -1,3 +1,10 @@
+apt (0.8.16~exp9) UNRELEASED; urgency=low
+
+  * apt-pkg/cdrom.cc:
+    - Accept .bz2, .xz files in addition to .gz files (Closes: #649451)
+
+ -- Julian Andres Klode <j...@debian.org>  Mon, 21 Nov 2011 18:46:36 +0100
+
 apt (0.8.16~exp8) experimental; urgency=low
 
   [ David Kalnischkies ]

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Attachment: pgpUwGMFPdCRT.pgp
Description: PGP signature

Reply via email to