X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=04823061814912e5da33d084acaeb5cc1ecdf45f;hb=cd33ae05e818e0b6161ef4c1a9eb368cae6db5f4;hp=bdb223e23cb148429b505da228ecb14a61a52496;hpb=0d651b1c6eefaabfe8be90355ea181a5e275bd9d;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index bdb223e2..04823061 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -508,17 +508,22 @@ class DBBinary(ORMObject): def scan_contents(self): ''' Yields the contents of the package. Only regular files are yielded and - the path names are normalized. + the path names are normalized after converting them from either utf-8 or + iso8859-1 encoding. ''' fullpath = self.poolfile.fullpath - debdata = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], - stdout = PIPE).stdout - tar = TarFile.open(fileobj = debdata, mode = 'r|') + dpkg = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], stdout = PIPE) + tar = TarFile.open(fileobj = dpkg.stdout, mode = 'r|') for member in tar.getmembers(): if member.isfile(): - yield normpath(member.name) + try: + name = member.name.decode('utf-8') + except UnicodeDecodeError: + name = member.name.decode('iso8859-1') + yield normpath(name) tar.close() - debdata.close() + dpkg.stdout.close() + dpkg.wait() __all__.append('DBBinary')