]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/contents.py
Handle empty packages in 'dak contents scan'.
[dak.git] / daklib / contents.py
index 65e7e3f1c31dedd1f0fc660550d0b0ed3f077268..4a6330f827fdd349306890f14a09196af457ac8d 100755 (executable)
@@ -92,7 +92,7 @@ unique_override as
         where o.suite = :overridesuite and o.type = :type_id and o.section = s.id and
         o.component = :component)
 
-select bc.file, substring(o.section from position('/' in o.section) + 1) || '/' || b.package as package
+select bc.file, o.section || '/' || b.package as package
     from newest_binaries b, bin_contents bc, unique_override o
     where b.id = bc.binary_id and o.package = b.package
     order by bc.file, b.package'''
@@ -120,7 +120,7 @@ unique_override as
         where o.suite = :overridesuite and o.type = :type_id and o.section = s.id
         order by o.package, s.section, o.modified desc)
 
-select bc.file, substring(o.section from position('/' in o.section) + 1) || '/' || b.package as package
+select bc.file, o.section || '/' || b.package as package
     from newest_binaries b, bin_contents bc, unique_override o
     where b.id = bc.binary_id and o.package = b.package
     order by bc.file, b.package'''
@@ -252,8 +252,12 @@ class ContentsScanner(object):
         '''
         session = DBConn().session()
         binary = session.query(DBBinary).get(self.binary_id)
+        empty_package = True
         for filename in binary.scan_contents():
             binary.contents.append(BinContents(file = filename))
+            empty_package = False
+        if empty_package:
+            binary.contents.append(BinContents(file = 'EMPTY_PACKAGE'))
         try:
             session.commit()
         except IntegrityError: