]> git.decadent.org.uk Git - dak.git/commitdiff
Save a dummy filename for packages without files.
authorTorsten Werner <twerner@debian.org>
Fri, 4 Mar 2011 21:28:57 +0000 (22:28 +0100)
committerTorsten Werner <twerner@debian.org>
Fri, 4 Mar 2011 21:28:57 +0000 (22:28 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
daklib/dbconn.py

index 87db1a35fa1a0dda87bc5ee2237079854caae879..6827891d555445adfc357f1a1addfcd1c1a1f28b 100755 (executable)
@@ -508,12 +508,14 @@ class DBBinary(ORMObject):
     def scan_contents(self):
         '''
         Yields the contents of the package. Only regular files are yielded and
-        the path names are normalized after converting them from either utf-8 or
-        iso8859-1 encoding.
+        the path names are normalized after converting them from either utf-8
+        or iso8859-1 encoding. It yields the string ' <EMPTY PACKAGE>' if the
+        package does not contain any regular file.
         '''
         fullpath = self.poolfile.fullpath
         dpkg = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], stdout = PIPE)
         tar = TarFile.open(fileobj = dpkg.stdout, mode = 'r|')
+        anything_yielded = False
         for member in tar.getmembers():
             if member.isfile():
                 name = normpath(member.name)
@@ -523,6 +525,9 @@ class DBBinary(ORMObject):
                 except UnicodeDecodeError:
                     name = name.decode('iso8859-1').encode('utf-8')
                 yield name
+                anything_yielded = True
+        if not anything_yielded:
+            yield ' <EMPTY PACKAGE>'
         tar.close()
         dpkg.stdout.close()
         dpkg.wait()