[Reproducible-commits] [diffoscope] 02/05: Use libarchive instead of debian.arfile to extract .deb
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Nov 13 11:26:05 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository diffoscope.
commit 60abd5c9141f1f4974b3d1b465ba8c57d2bd5037
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri Nov 13 11:38:32 2015 +0100
Use libarchive instead of debian.arfile to extract .deb
This will make it easier to make python-debian optional.
---
diffoscope/comparators/deb.py | 27 ++-------------------------
1 file changed, 2 insertions(+), 25 deletions(-)
diff --git a/diffoscope/comparators/deb.py b/diffoscope/comparators/deb.py
index 6888328..b7e92cc 100644
--- a/diffoscope/comparators/deb.py
+++ b/diffoscope/comparators/deb.py
@@ -19,39 +19,16 @@
import re
import os.path
-from debian.arfile import ArFile
from diffoscope import logger
from diffoscope.difference import Difference
from diffoscope.comparators.binary import File, needs_content
+from diffoscope.comparators.libarchive import LibarchiveContainer
from diffoscope.comparators.utils import \
Archive, ArchiveMember, get_ar_content
from diffoscope.comparators.tar import TarContainer, TarListing
-AR_EXTRACTION_BUFFER_SIZE = 32768
-class ArContainer(Archive):
- def open_archive(self, path):
- return ArFile(filename=path)
-
- def close_archive(self):
- # ArFile don't have to be closed
- pass
-
- def get_member_names(self):
- return self.archive.getnames()
-
- def extract(self, member_name, dest_dir):
- logger.debug('ar extracting %s to %s', member_name, dest_dir)
- member = self.archive.getmember(member_name)
- dest_path = os.path.join(dest_dir, os.path.basename(member_name))
- member.seek(0)
- with open(dest_path, 'wb') as fp:
- for buf in iter(lambda: member.read(AR_EXTRACTION_BUFFER_SIZE), b''):
- fp.write(buf)
- return dest_path
-
-
-class DebContainer(ArContainer):
+class DebContainer(LibarchiveContainer):
pass
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the Reproducible-commits
mailing list