From 3e4a9b06cdab9216006bd4cb68924b206fcb95f8 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 30 Aug 2011 19:11:56 +0200 Subject: [PATCH] Fix reading filelists from new package format. --- pakfire/packages/file.py | 48 +++++++++--------------------------- pakfire/packages/packager.py | 2 +- po/pakfire.pot | 8 +++--- 3 files changed, 16 insertions(+), 42 deletions(-) diff --git a/pakfire/packages/file.py b/pakfire/packages/file.py index 8cdc8fb4b..3a3deaff4 100644 --- a/pakfire/packages/file.py +++ b/pakfire/packages/file.py @@ -332,13 +332,23 @@ class FilePackage(Package): return inst_size - def __filelist_from_metadata(self): + @property + def filelist(self): + """ + Return a list of the files that are contained in the package + payload. + """ a = self.open_archive() f = a.extractfile("filelist") ret = [] for line in f.readlines(): line = line.strip() + + if self.format >= 1: + line = line.split() + line = line[0] + if not line.startswith("/"): line = "/%s" % line @@ -349,42 +359,6 @@ class FilePackage(Package): return ret - def __filelist_from_payload(self): - # XXX expect uncompressed payload for now - # this is very simple and very slow - - a = self.open_archive() - f = a.extractfile("data.img") - t = tarfile.open(fileobj=f) - - ret = ["/%s" % n for n in t.getnames()] - - t.close() - f.close() - a.close() - - return ret - - @property - def filelist(self): - """ - Return a list of the files that are contained in the package - payload. - - At first, we try to get them from the metadata (which is the - 'filelist' file). - If the file is not existant, we will open the payload and - read it instead. The latter is a very slow procedure and - should not be used anyway. - """ - if not hasattr(self, "__filelist"): - try: - self.__filelist = self.__filelist_from_metadata() - except KeyError: - self.__filelist = self.__filelist_from_payload() - - return self.__filelist - @property def configfiles(self): a = self.open_archive() diff --git a/pakfire/packages/packager.py b/pakfire/packages/packager.py index b97bac678..dd45c8ff4 100644 --- a/pakfire/packages/packager.py +++ b/pakfire/packages/packager.py @@ -164,7 +164,7 @@ class Packager(object): # For other files, just finish the line. else: f.write(" -\n") - + logging.info("") datafile.close() diff --git a/po/pakfire.pot b/po/pakfire.pot index ada58f328..ac979b9d5 100644 --- a/po/pakfire.pot +++ b/po/pakfire.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-30 16:41+0200\n" +"POT-Creation-Date: 2011-08-30 19:09+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -334,7 +334,7 @@ msgstr "" msgid "Do not verify build dependencies." msgstr "" -#: ../pakfire/compress.py:133 ../pakfire/packages/packager.py:489 +#: ../pakfire/compress.py:133 ../pakfire/packages/packager.py:491 #, python-format msgid "Compressing %s" msgstr "" @@ -465,11 +465,11 @@ msgid "Package version is undefined." msgstr "" #. Load progressbar. -#: ../pakfire/packages/packager.py:315 +#: ../pakfire/packages/packager.py:317 msgid "Packaging" msgstr "" -#: ../pakfire/packages/packager.py:606 +#: ../pakfire/packages/packager.py:608 #, python-format msgid "Building source package %s:" msgstr "" -- 2.39.5