]> git.decadent.org.uk Git - dak.git/blobdiff - dak/generate_packages_sources2.py
Debug suites might also miss the source package
[dak.git] / dak / generate_packages_sources2.py
index 7eca3c8cacc0460b858e9f2678fcc52f2a68b75c..ed12e9f14a0fa2eefc968e4597c4b71b62ba3960 100755 (executable)
@@ -94,9 +94,6 @@ LEFT JOIN override o ON o.package = s.source
 LEFT JOIN section sec ON o.section = sec.id
 LEFT JOIN priority pri ON o.priority = pri.id
 
-WHERE
-  (src_associations_full.extra_source OR o.suite IS NOT NULL)
-
 ORDER BY
 s.source, s.version
 """
@@ -155,7 +152,15 @@ WITH
       f.size AS size,
       f.md5sum AS md5sum,
       f.sha1sum AS sha1sum,
-      f.sha256sum AS sha256sum
+      f.sha256sum AS sha256sum,
+      (SELECT value FROM binaries_metadata
+        WHERE bin_id = b.id
+          AND key_id = (SELECT key_id FROM metadata_keys WHERE key = 'Priority'))
+       AS fallback_priority,
+      (SELECT value FROM binaries_metadata
+        WHERE bin_id = b.id
+          AND key_id = (SELECT key_id FROM metadata_keys WHERE key = 'Section'))
+       AS fallback_section
     FROM
       binaries b
       JOIN bin_associations ba ON b.id = ba.bin
@@ -192,8 +197,8 @@ SELECT
      eo.package = tmp.package
      AND eo.suite = :overridesuite AND eo.component = :component
   ), '')
-  || E'\nSection\: ' || sec.section
-  || E'\nPriority\: ' || pri.priority
+  || E'\nSection\: ' || COALESCE(sec.section, tmp.fallback_section)
+  || E'\nPriority\: ' || COALESCE(pri.priority, tmp.fallback_priority)
   || E'\nFilename\: pool/' || :component_name || '/' || tmp.filename
   || E'\nSize\: ' || tmp.size
   || E'\nMD5sum\: ' || tmp.md5sum
@@ -202,9 +207,12 @@ SELECT
 
 FROM
   tmp
-  JOIN override o ON o.package = tmp.package
-  JOIN section sec ON sec.id = o.section
-  JOIN priority pri ON pri.id = o.priority
+  LEFT JOIN override o ON o.package = tmp.package
+                      AND o.type = :type_id
+                      AND o.suite = :overridesuite
+                      AND o.component = :component
+  LEFT JOIN section sec ON sec.id = o.section
+  LEFT JOIN priority pri ON pri.id = o.priority
 
 WHERE
   (
@@ -214,8 +222,6 @@ WHERE
     OR
       (architecture = :arch_all AND source NOT IN (SELECT DISTINCT source FROM tmp WHERE architecture <> :arch_all))
   )
-  AND
-    o.type = :type_id AND o.suite = :overridesuite AND o.component = :component
 
 ORDER BY tmp.source, tmp.package, tmp.version
 """
@@ -397,6 +403,10 @@ def main():
         else:
             logger.log(['E: ', msg])
 
+    # Lock tables so that nobody can change things underneath us
+    session.execute("LOCK TABLE src_associations IN SHARE MODE")
+    session.execute("LOCK TABLE bin_associations IN SHARE MODE")
+
     for s in suites:
         component_ids = [ c.component_id for c in s.components ]
         if s.untouchable and not force: