X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=daklib%2Fdbconn.py;h=bdb223e23cb148429b505da228ecb14a61a52496;hb=0d651b1c6eefaabfe8be90355ea181a5e275bd9d;hp=e53da961d870fe6f06b77331f9ac65377ec47183;hpb=e4a42d41b7f9c48159861e143d7a2021a7579d25;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index e53da961..bdb223e2 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -34,6 +34,7 @@ ################################################################################ import os +from os.path import normpath import re import psycopg2 import traceback @@ -49,6 +50,8 @@ except: from datetime import datetime, timedelta from errno import ENOENT from tempfile import mkstemp, mkdtemp +from subprocess import Popen, PIPE +from tarfile import TarFile from inspect import getargspec @@ -502,6 +505,21 @@ class DBBinary(ORMObject): def get_component_name(self): return self.poolfile.location.component.component_name + def scan_contents(self): + ''' + Yields the contents of the package. Only regular files are yielded and + the path names are normalized. + ''' + fullpath = self.poolfile.fullpath + debdata = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], + stdout = PIPE).stdout + tar = TarFile.open(fileobj = debdata, mode = 'r|') + for member in tar.getmembers(): + if member.isfile(): + yield normpath(member.name) + tar.close() + debdata.close() + __all__.append('DBBinary') @session_wrapper @@ -2933,6 +2951,7 @@ class DBConn(object): 'changes_pending_source_files', 'changes_pool_files', 'deb_contents', + # TODO: the maintainer column in table override should be removed. 'override', 'suite_architectures', 'suite_src_formats',