From 3d0bd9350a1473cdcb9f82ba4e22c64cc1fdaa91 Mon Sep 17 00:00:00 2001 From: Alexey Tourbin Date: Wed, 26 May 2010 16:52:21 +0400 Subject: [PATCH] acquire-item.cc: added support for xz-compressed pkglists --- apt.spec | 4 +++- apt/apt-pkg/acquire-item.cc | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apt.spec b/apt.spec index d80c9c1..38f3509 100644 --- a/apt.spec +++ b/apt.spec @@ -80,7 +80,8 @@ Patch101: apt-0.5.4cnc9-alt-getsrc-debug.patch Requires: libapt = %version-%release Requires: rpm >= 4.0.4-alt28, /etc/apt/pkgpriorities, apt-conf # for methods. -Requires: bzip2, gzip, gnupg, alt-gpgkeys +Requires: gzip, bzip2, xz +Requires: gnupg, alt-gpgkeys # for autopoint. BuildPreReq: cvs @@ -321,6 +322,7 @@ install -pm644 %SOURCE1 %buildroot%_sysconfdir/%name/ # This is still needed. ln -sf rsh %buildroot%_libdir/%name/methods/ssh ln -sf gzip %buildroot%_libdir/%name/methods/bzip2 +ln -sf gzip %buildroot%_libdir/%name/methods/xz # Cleanup find %buildroot%_includedir -type f -name rpmshowprogress.h -delete -print diff --git a/apt/apt-pkg/acquire-item.cc b/apt/apt-pkg/acquire-item.cc index 15ea22d..9701947 100644 --- a/apt/apt-pkg/acquire-item.cc +++ b/apt/apt-pkg/acquire-item.cc @@ -191,7 +191,7 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,pkgRepository *Repository, // Create the item // CNC:2002-07-03 - Desc.URI = URI + _config->Find("Acquire::ComprExtension", ".bz2"); + Desc.URI = URI + ".bz2"; Desc.Description = URIDesc; Desc.Owner = this; Desc.ShortDesc = ShortDesc; @@ -227,6 +227,9 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,pkgRepository *Repository, unlink(FinalFile.c_str()); unlink(DestFile.c_str()); } + + if (Repository->FindChecksums(RealURI + ".xz", Size, MD5Hash) == true) + Desc.URI = URI + ".xz"; } else if (Repository->IsAuthenticated() == true) { @@ -360,11 +363,15 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5, Decompression = true; DestFile += ".decomp"; + // CNC:2002-07-03 - Desc.URI = "bzip2:" + FileName; + const char *prog = "bzip2"; + if (flExtension(Desc.URI) == "xz") + prog = "xz"; + Desc.URI = string(prog) + ":" + FileName; QueueURI(Desc); // CNC:2002-07-03 - Mode = "bzip2"; + Mode = prog; } /*}}}*/