diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-08-18 15:13:28 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-08-18 15:13:28 +0200 |
| commit | 681990602c8569721dae83d887195548845d1656 (patch) | |
| tree | c1235f60de344e00481ca7ed8495e8d3b2cc42fb /apt | |
| parent | 24567ef6dddd56c1777a5908a2fd9b29374cde7e (diff) | |
| download | python-apt-681990602c8569721dae83d887195548845d1656.tar.gz | |
apt/debfile.py: Adapt to class-based API (WARNING: changes behavior on certain invalid packages).
Use the class-based API now. This also means that if the archive is no
valid Debian package (because it misses a 'data.tar.*', 'control.tar.gz'
or a 'debian-binary' member) the method open() will now raise an Error;
previously it only raised an error if there was no 'debian-binary'
member or no 'control.tar.gz' member.
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/debfile.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/apt/debfile.py b/apt/debfile.py index 421129c8..65f43f20 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -52,11 +52,8 @@ class DebPackage(object): def open(self, filename): " open given debfile " self.filename = filename - if not apt_inst.ar_check_member(open(self.filename), "debian-binary"): - raise NoDebArchiveException(_("This is not a valid DEB archive, " - "missing '%s' member" % - "debian-binary")) - control = apt_inst.deb_extract_control(open(self.filename)) + self._debfile = apt_inst.DebFile(self.filename) + control = self._debfile.control.extractdata("control") self._sections = apt_pkg.TagSection(control) self.pkgname = self._sections["Package"] @@ -67,19 +64,11 @@ class DebPackage(object): def filelist(self): """return the list of files in the deb.""" files = [] - - def extract_cb(what, name, *_): - files.append(name) - - for member in self._supported_data_members: - if apt_inst.ar_check_member(open(self.filename), member): - try: - apt_inst.deb_extract(open(self.filename), extract_cb, - member) - break - except SystemError: - return [_("List of files for '%s' could not be read" % - self.filename)] + try: + self._debfile.data.go(lambda item, data: files.append(item.name)) + except SystemError: + return [_("List of files for '%s' could not be read" % + self.filename)] return files def _is_or_group_satisfied(self, or_group): |
