]> git.donarmstrong.com Git - dak.git/blobdiff - dak/generate_packages_sources2.py
stop using deprecated python-apt functions
[dak.git] / dak / generate_packages_sources2.py
index 86a321e7763b7801ee4e9c9e839a8f1b73a16537..f0e08654525c5debb9e2a86bc650f5c2c46de95c 100755 (executable)
@@ -54,11 +54,11 @@ SELECT
   (SELECT
      STRING_AGG(
        CASE
-         WHEN key = 'Source' THEN 'Package\: '
+         WHEN key = 'Source' THEN E'Package\: '
          WHEN key = 'Files' THEN E'Files\:\n ' || f.md5sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z')
          WHEN key = 'Checksums-Sha1' THEN E'Checksums-Sha1\:\n ' || f.sha1sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z')
          WHEN key = 'Checksums-Sha256' THEN E'Checksums-Sha256\:\n ' || f.sha256sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z')
-         ELSE key || '\: '
+         ELSE key || E'\: '
        END || value, E'\n' ORDER BY mk.ordering, mk.key)
    FROM
      source_metadata sm
@@ -151,7 +151,7 @@ WITH
 
 SELECT
   (SELECT
-     STRING_AGG(key || '\: ' || value, E'\n' ORDER BY ordering, key)
+     STRING_AGG(key || E'\: ' || value, E'\n' ORDER BY ordering, key)
    FROM
      (SELECT key, ordering,
         CASE WHEN :include_long_description = 'false' AND key = 'Description'
@@ -167,7 +167,7 @@ SELECT
      ) AS metadata
   )
   || COALESCE(E'\n' || (SELECT
-     STRING_AGG(key || '\: ' || value, E'\n' ORDER BY key)
+     STRING_AGG(key || E'\: ' || value, E'\n' ORDER BY key)
    FROM external_overrides eo
    WHERE
      eo.package = tmp.package
@@ -255,7 +255,7 @@ WITH
       FROM suite AS s LEFT JOIN suite AS os ON s.overridesuite = os.suite_name)
 
 SELECT
-     'Package\: ' || b.package
+     E'Package\: ' || b.package
   || E'\nDescription-md5\: ' || bm_description_md5.value
   || E'\nDescription-en\: ' || bm_description.value
   || E'\n'
@@ -273,8 +273,8 @@ FROM binaries b
   JOIN source s ON b.source = s.id
 
 WHERE ba.suite = :suite AND o.component = :component
-GROUP BY s.source, b.package, bm_description_md5.value, bm_description.value
-ORDER BY s.source, b.package, bm_description_md5.value
+GROUP BY b.package, bm_description_md5.value, bm_description.value
+ORDER BY MIN(s.source), b.package, bm_description_md5.value
 """
 
 def generate_translations(suite_id, component_id):
@@ -313,9 +313,9 @@ def main():
                  ('f',"force","Generate-Packages-Sources::Options::Force"),
                  ('o','option','','ArbItem')]
 
-    suite_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
+    suite_names = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
     try:
-        Options = cnf.SubTree("Generate-Packages-Sources::Options")
+        Options = cnf.subtree("Generate-Packages-Sources::Options")
     except KeyError:
         Options = {}
 
@@ -360,6 +360,7 @@ def main():
 
     for s in suites:
         if s.untouchable and not force:
+            import utils
             utils.fubar("Refusing to touch %s (untouchable and not forced)" % s.suite_name)
         for c in component_ids:
             pool.apply_async(generate_sources, [s.suite_id, c], callback=parse_results)