]> git.decadent.org.uk Git - dak.git/blobdiff - dak/generate_packages_sources2.py
Add ordering to component table and use this when checking policy
[dak.git] / dak / generate_packages_sources2.py
index 478aadf1748b27dce30807784a033047f5f0c7da..d941d98487d782996b4fafcf2006b2aeb32890c9 100755 (executable)
@@ -67,24 +67,35 @@ SELECT
    WHERE s.id=sm.src_id
   )
   ||
+  CASE
+    WHEN src_associations_full.extra_source THEN E'\nExtra-Source-Only\: yes'
+    ELSE ''
+  END
+  ||
   E'\nDirectory\: pool/' || :component_name || '/' || SUBSTRING(f.filename FROM E'\\A(.*)/[^/]*\\Z')
   ||
-  E'\nPriority\: ' || pri.priority
+  E'\nPriority\: ' || COALESCE(pri.priority, 'extra')
   ||
-  E'\nSection\: ' || sec.section
+  E'\nSection\: ' || COALESCE(sec.section, 'misc')
 
 FROM
 
 source s
-JOIN src_associations sa ON s.id = sa.source
+JOIN src_associations_full ON src_associations_full.suite = :suite AND s.id = src_associations_full.source
 JOIN files f ON s.file=f.id
-JOIN override o ON o.package = s.source
-JOIN section sec ON o.section = sec.id
-JOIN priority pri ON o.priority = pri.id
+JOIN files_archive_map fam
+  ON fam.file_id = f.id
+     AND fam.archive_id = (SELECT archive_id FROM suite WHERE id = :suite)
+     AND fam.component_id = :component
+LEFT JOIN override o ON o.package = s.source
+                     AND o.suite = :overridesuite
+                     AND o.component = :component
+                     AND o.type = :dsc_type
+LEFT JOIN section sec ON o.section = sec.id
+LEFT JOIN priority pri ON o.priority = pri.id
 
 WHERE
-  sa.suite = :suite
-  AND o.suite = :overridesuite AND o.component = :component AND o.type = :dsc_type
+  (src_associations_full.extra_source OR o.suite IS NOT NULL)
 
 ORDER BY
 s.source, s.version
@@ -331,7 +342,7 @@ def main():
 
     logger = daklog.Logger('generate-packages-sources2')
 
-    from daklib.dbconn import Component, DBConn, get_suite, Suite
+    from daklib.dbconn import Component, DBConn, get_suite, Suite, Archive
     session = DBConn().session()
     session.execute("SELECT add_missing_description_md5()")
     session.commit()