[Piuparts-commits] [piuparts] 01/01: lib: add support for Packages.xz

Holger Levsen holger at moszumanska.debian.org
Wed Aug 12 12:25:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit a4b2610c5959a9c35617d105c704bf402d5d0b38
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Aug 11 19:26:31 2015 +0200

    lib: add support for Packages.xz
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 debian/changelog        | 4 +++-
 debian/control          | 1 +
 piupartslib/__init__.py | 8 ++++++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a0f7e65..7522d8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,9 +18,11 @@ piuparts (0.65) UNRELEASED; urgency=medium
     - Put package in 'dependency-does-not-exist' state if a pass/ log exists
       but a dependency has been removed from the archive since then.
     - Prepare improvements for handling foreign arch dependencies.
-  * piupartslib/open_packages_url(): Support uncompressed Packages files.
+  * piupartslib/open_packages_url(): Support xz-compressed and uncompressed
+    Packages files.
   * piuparts-master-backend.py:
     - Catch URLError, log it and abort without backtrace.
+  * piuparts-common: Add Depends: python-lzma.
   * scripts/post_distupgrade_exceptions:
     - Fix the /etc/nsswitch.conf wheezy -> jessie upgrade handling.
   * scripts/pre_remove_40_find_unowned_lib_links: Ignore some symlinks caused
diff --git a/debian/control b/debian/control
index 97bf15c..4b91a53 100644
--- a/debian/control
+++ b/debian/control
@@ -117,6 +117,7 @@ Architecture: all
 Depends:
  python-apt,
  python-distro-info,
+ python-lzma,
  ${misc:Depends},
  ${python:Depends}
 Breaks:
diff --git a/piupartslib/__init__.py b/piupartslib/__init__.py
index f6c9ae2..e317405 100644
--- a/piupartslib/__init__.py
+++ b/piupartslib/__init__.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 # Copyright 2005 Lars Wirzenius (liw at iki.fi)
-# Copyright © 2013 Andreas Beckmann (anbe at debian.org)
+# Copyright © 2013-2015 Andreas Beckmann (anbe at debian.org)
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -19,6 +19,7 @@
 
 
 import bz2
+import lzma
 import zlib
 import urllib2
 
@@ -80,7 +81,7 @@ class DecompressedStream():
 def open_packages_url(url):
     """Open a Packages.bz2 file pointed to by a URL"""
     socket = None
-    for ext in ['.bz2', '.gz', '']:
+    for ext in ['.xz', '.bz2', '.gz', '']:
         try:
             socket = urllib2.urlopen(url + ext)
         except urllib2.HTTPError as httperror:
@@ -96,6 +97,9 @@ def open_packages_url(url):
     elif ext == '.gz':
         decompressor = zlib.decompressobj(16 + zlib.MAX_WBITS)
         decompressed = DecompressedStream(socket, decompressor)
+    elif ext == '.xz':
+        decompressor = lzma.LZMADecompressor()
+        decompressed = DecompressedStream(socket, decompressor)
     elif ext == '':
         decompressed = socket
     else:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list