Browse Source

* ftparchive/multicompress.cc, apt-inst/deb/debfile.cc:
- support xz compressor to create xz-compressed Indexes and be able
to open data.tar.xz files

David Kalnischkies 15 years ago
parent
commit
bc33e0f0b6
5 changed files with 22 additions and 6 deletions
  1. 7 1
      apt-inst/deb/debfile.cc
  2. 4 1
      debian/changelog
  3. 5 1
      ftparchive/contents.cc
  4. 1 0
      ftparchive/multicompress.cc
  5. 5 3
      test/integration/framework

+ 7 - 1
apt-inst/deb/debfile.cc

@@ -46,7 +46,9 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
 
    if (!CheckMember("data.tar.gz") &&
        !CheckMember("data.tar.bz2") &&
-       !CheckMember("data.tar.lzma")) {
+       !CheckMember("data.tar.lzma") &&
+       !CheckMember("data.tar.xz")) {
+      // FIXME: add data.tar.xz here - adding it now would require a Translation round for a very small gain
       _error->Error(_("This is not a valid DEB archive, it has no '%s', '%s' or '%s' member"), "data.tar.gz", "data.tar.bz2", "data.tar.lzma");
       return;
    }
@@ -136,6 +138,10 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
       Member = AR.FindMember("data.tar.lzma");
       Compressor = "lzma";
    }
+   if (Member == 0) {
+      Member = AR.FindMember("data.tar.xz");
+      Compressor = "xz";
+   }
    if (Member == 0)
       return _error->Error(_("Internal error, could not locate member"));   
    if (File.Seek(Member->Start) == false)

+ 4 - 1
debian/changelog

@@ -13,8 +13,11 @@ apt (0.8.10.3+squeeze1) UNRELEASED; urgency=low
   * apt-pkg/contrib/fileutl.cc:
     - reorder the loaded filesize bytes for big endian (Closes: #612986)
       Thanks to Jörg Sommer for the detailed analyse!
+  * ftparchive/multicompress.cc, apt-inst/deb/debfile.cc:
+    - support xz compressor to create xz-compressed Indexes and be able
+      to open data.tar.xz files
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 22 Feb 2011 11:25:58 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 22 Feb 2011 12:47:31 +0100
 
 apt (0.8.10.3) unstable; urgency=low
 

+ 5 - 1
ftparchive/contents.cc

@@ -317,9 +317,13 @@ bool ContentsExtract::Read(debDebFile &Deb)
       Member = Deb.GotoMember("data.tar.lzma");
       Compressor = "lzma";
    }
+   if (Member == 0) {
+      Member = Deb.GotoMember("data.tar.xz");
+      Compressor = "xz";
+   }
    if (Member == 0) {
       _error->Error(_("Internal error, could not locate member %s"),
-		    "data.tar.{gz,bz2,lzma}");
+		    "data.tar.{gz,bz2,lzma,xz}");
       return false;
    }
       

+ 1 - 0
ftparchive/multicompress.cc

@@ -35,6 +35,7 @@ const MultiCompress::CompType MultiCompress::Compressors[] =
        {"gzip",".gz","gzip","-9n","-d",2},
        {"bzip2",".bz2","bzip2","-9","-d",3},
        {"lzma",".lzma","lzma","-9","-d",4},
+       {"xz",".xz","xz","-6","-d",5},
        {}};
 
 // MultiCompress::MultiCompress - Constructor				/*{{{*/

+ 5 - 3
test/integration/framework

@@ -251,9 +251,9 @@ createaptftparchiveconfig() {
 	echo -n '";
 };
 Default {
-	Packages::Compress ". gzip bzip2 lzma";
-	Sources::Compress ". gzip bzip2 lzma";
-	Contents::Compress ". gzip bzip2 lzma";
+	Packages::Compress ". gzip bzip2 lzma xz";
+	Sources::Compress ". gzip bzip2 lzma xz";
+	Contents::Compress ". gzip bzip2 lzma xz";
 };
 TreeDefault {
 	Directory "pool/";
@@ -332,6 +332,7 @@ buildaptarchivefromfiles() {
 		cat Packages | gzip > Packages.gz
 		cat Packages | bzip2 > Packages.bz2
 		cat Packages | lzma > Packages.lzma
+		cat Packages | xz > Packages.xz
 		msgdone "info"
 	fi
 	if [ -f Sources ]; then
@@ -339,6 +340,7 @@ buildaptarchivefromfiles() {
 		cat Sources | gzip > Sources.gz
 		cat Sources | bzip2 > Sources.bz2
 		cat Sources | lzma > Sources.lzma
+		cat Sources | xz > Sources.xz
 		msgdone "info"
 	fi
 	msgninfo "\tRelease file… "