Bug#510526: support for Packages.lzma / Sources.lzma
Package: apt
Version: 0.7.19
Severity: wishlist
Tags: patch
This patch implements support for lzma compression in index files.
-- System Information:
Debian Release: 5.0
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.18-6-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages apt depends on:
ii debian-archive-keyring 2008.04.16+nmu1 GnuPG archive keys of the Debian a
ii libc6 2.7-16 GNU C Library: Shared libraries
ii libgcc1 1:4.3.2-1 GCC support library
ii libstdc++6 4.3.2-1 The GNU Standard C++ Library v3
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none> (no description available)
ii aptitude 0.4.11.11-1 terminal-based package manager
ii bzip2 1.0.5-1 high-quality block-sorting file co
ii dpkg-dev 1.14.23 Debian package development tools
ii lzma 4.43-14 Compression method of 7z format in
pn python-apt <none> (no description available)
ii synaptic 0.62.3 Graphical package manager
-- no debconf information
diff -x po -ur apt-0.7.19/apt-pkg/acquire-item.cc apt-0.7.19.new/apt-pkg/acquire-item.cc
--- apt-0.7.19/apt-pkg/acquire-item.cc 2008-11-24 09:32:23.000000000 +0000
+++ apt-0.7.19.new/apt-pkg/acquire-item.cc 2009-01-02 20:15:04.000000000 +0000
@@ -563,7 +563,9 @@
if(comprExt.empty())
{
// autoselect the compression method
- if(FileExists("/bin/bzip2"))
+ if(FileExists("/usr/bin/lzma"))
+ CompressionExtension = ".lzma";
+ else if(FileExists("/bin/bzip2"))
CompressionExtension = ".bz2";
else
CompressionExtension = ".gz";
@@ -598,8 +600,16 @@
void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
{
bool descChanged = false;
+ // no .lzma found, retry with .bz2
+ if(Desc.URI.substr(Desc.URI.size()-4) == "lzma") {
+ Desc.URI = Desc.URI.substr(0,Desc.URI.size()-4) + "bz2";
+
+ new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc,
+ ExpectedHash, string(".bz2"));
+ descChanged = true;
+ }
// no .bz2 found, retry with .gz
- if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") {
+ else if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") {
Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz";
new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc,
@@ -713,7 +723,9 @@
string compExt = flExtension(flNotDir(URI(Desc.URI).Path));
const char *decompProg;
- if(compExt == "bz2")
+ if(compExt == "lzma")
+ decompProg = "lzma";
+ else if(compExt == "bz2")
decompProg = "bzip2";
else if(compExt == "gz")
decompProg = "gzip";
diff -x po -ur apt-0.7.19/ftparchive/writer.cc apt-0.7.19.new/ftparchive/writer.cc
--- apt-0.7.19/ftparchive/writer.cc 2008-06-09 21:10:09.000000000 +0000
+++ apt-0.7.19.new/ftparchive/writer.cc 2009-01-02 19:41:21.000000000 +0000
@@ -815,9 +815,11 @@
AddPattern("Packages");
AddPattern("Packages.gz");
AddPattern("Packages.bz2");
+ AddPattern("Packages.lzma");
AddPattern("Sources");
AddPattern("Sources.gz");
AddPattern("Sources.bz2");
+ AddPattern("Sources.lzma");
AddPattern("Release");
AddPattern("md5sum.txt");
Reply to: