]> git.decadent.org.uk Git - dak.git/commitdiff
suite_architectures
authorJoerg Jaspert <joerg@debian.org>
Thu, 19 Feb 2009 21:36:34 +0000 (22:36 +0100)
committerJoerg Jaspert <joerg@debian.org>
Thu, 19 Feb 2009 21:42:19 +0000 (22:42 +0100)
new function, daklib.database.get_suite_architectures.
Use that instead of Cnf.ValueList("Suites::%s::Architectures") everywhere
to find out which suite supports which architectures

Signed-off-by: Joerg Jaspert <joerg@debian.org>
12 files changed:
dak/check_archive.py
dak/check_proposed_updates.py
dak/compare_suites.py
dak/cruft_report.py
dak/import_archive.py
dak/init_db.py
dak/make_suite_file_list.py
dak/new_security_install.py
dak/process_unchecked.py
dak/rm.py
dak/stats.py
daklib/database.py

index 65b5cae4c13f5b1e4f906dc4c77cdf54d2ce9dd4..018761207a75ee23442145d303edb5fb5ffb621d 100755 (executable)
@@ -412,7 +412,7 @@ def check_indices_files_exist():
     """
     for suite in [ "stable", "testing", "unstable" ]:
         for component in Cnf.ValueList("Suite::%s::Components" % (suite)):
-            architectures = Cnf.ValueList("Suite::%s::Architectures" % (suite))
+            architectures = get_suite_architectures(suite)
             for arch in [ i.lower() for i in architectures ]:
                 if arch == "source":
                     validate_sources(suite, component)
index 5b9283f712e3cee0d54711991ec795cb2c760ea8..57d068a3401427a2ee91e0c0b78cd8d43aff3bb9 100755 (executable)
@@ -242,7 +242,7 @@ def parse_packages():
     suite = "stable"
     stable = {}
     components = Cnf.ValueList("Suite::%s::Components" % (suite))
-    architectures = filter(utils.real_arch, Cnf.ValueList("Suite::%s::Architectures" % (suite)))
+    architectures = filter(utils.real_arch, get_suite_architectures(suite))
     for component in components:
         for architecture in architectures:
             filename = "%s/dists/%s/%s/binary-%s/Packages" % (Cnf["Dir::Root"], suite, component, architecture)
index ab0ab3c0d6d8c04f5456c15cf72258321ef3e572..22b00101b15e40716b471ffb9806140820b55344 100755 (executable)
@@ -67,7 +67,7 @@ def main ():
     arch_all_id = database.get_architecture_id("all")
     dsc_type_id = database.get_override_type_id("dsc")
 
-    for arch in Cnf.ValueList("Suite::%s::Architectures" % (src_suite)):
+    for arch in get_suite_architectures(src_suite_id):
         if arch == "source":
             continue
 
index d88c799b019d857ecaf689530a2ce6174e58a994..19b0217206d2ea15dae5121568eb23c16b319e8f 100755 (executable)
@@ -426,7 +426,7 @@ def main ():
     if suite != "experimental":
         check_components.append('main/debian-installer');
     for component in check_components:
-        architectures = filter(utils.real_arch, Cnf.ValueList("Suite::%s::Architectures" % (suite)))
+        architectures = filter(utils.real_arch, get_suite_architectures(suite))
         for architecture in architectures:
             filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (Cnf["Dir::Root"], suite, component, architecture)
             # apt_pkg.ParseTagFile needs a real file handle
index d87d6ca9e3fd98e638620807aed50be1929cbdb3..d61a1a19704e203feec8d012d509d765d34ca140 100755 (executable)
@@ -254,7 +254,7 @@ def update_suites ():
         for i in ("Version", "Origin", "Description"):
             if SubSec.has_key(i):
                 projectB.query("UPDATE suite SET %s = '%s' WHERE suite_name = '%s'" % (i.lower(), SubSec[i], suite.lower()))
-        for architecture in Cnf.ValueList("Suite::%s::Architectures" % (suite)):
+        for architecture in get_suite_architectures(suite):
             architecture_id = database.get_architecture_id (architecture)
             projectB.query("INSERT INTO suite_architectures (suite, architecture) VALUES (currval('suite_id_seq'), %d)" % (architecture_id))
 
@@ -570,8 +570,7 @@ Please read the documentation before running this script.
                 udeb_components = map(lambda x: x+"/debian-installer",
                                       Cnf.ValueList("Suite::%s::UdebComponents" % suite))
                 for component in Cnf.SubTree("Component").List() + udeb_components:
-                    architectures = filter(utils.real_arch,
-                                           Cnf.ValueList("Suite::%s::Architectures" % (suite)))
+                    architectures = filter(utils.real_arch, get_suite_architectures(suite))
                     for architecture in architectures:
                         packages = Cnf["Dir::Root"] + "dists/" + Cnf["Suite::%s::CodeName" % (suite)] + '/' + component + '/binary-' + architecture + '/Packages'
                         print 'Processing '+packages+'...'
index d40ad0c0aeb49cd6a95e1ad10d0d70181f056514..8f757a36fbeaafb2e49a1685d46806dceb9e5e9f 100755 (executable)
@@ -135,7 +135,7 @@ def do_suite():
         projectB.query("INSERT INTO suite (suite_name, version, origin, "
                        "description) VALUES ('%s', %s, %s, %s)"
                        % (suite.lower(), version, origin, description))
-        for architecture in Cnf.ValueList("Suite::%s::Architectures" % (suite)):
+        for architecture in get_suite_architectures(suite):
             architecture_id = database.get_architecture_id (architecture)
             if architecture_id < 0:
                 utils.fubar("architecture '%s' not found in architecture"
index e754e77d812bee137102643f55d1bd2bc34e8e21..3f05de3aa5ee18fd984930be60710831ab8df074 100755 (executable)
@@ -296,7 +296,7 @@ def write_filelists(packages, dislocated_files):
             else:
                 binary_types = [ "deb" ]
             if not Options["Architecture"]:
-                architectures = Cnf.ValueList("Suite::%s::Architectures" % (suite))
+                architectures = get_suite_architectures(suite)
             else:
                 architectures = utils.split_args(Options["Architectures"])
             for arch in [ i.lower() for i in architectures ]:
index c72641a2236b71f43ee0cf6867f18710e1af3f98..7858fd0edf22c4a2cc51224a2df6050cbc68c384 100755 (executable)
@@ -386,7 +386,7 @@ def generate_advisory(template):
                                        ver, suite)
         adv += "%s\n%s\n\n" % (suite_header, "-"*len(suite_header))
 
-        arches = Cnf.ValueList("Suite::%s::Architectures" % suite)
+        arches = get_suite_architectures(suite)
         if "source" in arches:
             arches.remove("source")
         if "all" in arches:
index 1ec04563088e5ca1dff0550ed4dfced906c68b5d..4c87a17a80a10f55a082325e6e113f71ed73da37 100755 (executable)
@@ -289,7 +289,7 @@ def check_distributions():
             (source, dest) = args[1:3]
             if changes["distribution"].has_key(source):
                 for arch in changes["architecture"].keys():
-                    if arch not in Cnf.ValueList("Suite::%s::Architectures" % (source)):
+                    if arch not in get_suite_architectures(source):
                         reject("Mapping %s to %s for unreleased architecture %s." % (source, dest, arch),"")
                         del changes["distribution"][source]
                         changes["distribution"][dest] = 1
@@ -451,7 +451,7 @@ def check_files():
             default_suite = Cnf.get("Dinstall::DefaultSuite", "Unstable")
             architecture = control.Find("Architecture")
             upload_suite = changes["distribution"].keys()[0]
-            if architecture not in Cnf.ValueList("Suite::%s::Architectures" % (default_suite)) and architecture not in Cnf.ValueList("Suite::%s::Architectures" % (upload_suite)):
+            if architecture not in get_suite_architectures(default_suite) and architecture not in get_suite_architectures(upload_suite):
                 reject("Unknown architecture '%s'." % (architecture))
 
             # Ensure the architecture of the .deb is one of the ones
index 005653e536727858f859b2aef4a26ab9a23d9a04..6a76eb78364a6615a32ea3bf30f48555e29e1351 100755 (executable)
--- a/dak/rm.py
+++ b/dak/rm.py
@@ -100,7 +100,7 @@ def reverse_depends_check(removals, suites, arches=None):
     if arches:
         all_arches = set(arches)
     else:
-        all_arches = set(Cnf.ValueList("Suite::%s::Architectures" % suites[0]))
+        all_arches = set(get_suite_architectures(suites[0]))
     all_arches -= set(["source", "all"])
     for architecture in all_arches:
         deps = {}
index 105bf6c9f64aec6347a728f8acb5bf8c9ecf49b0..d8bf457fa28c0ae325fb0aa60ea2f8d41e11adfd 100755 (executable)
@@ -179,7 +179,7 @@ SELECT suite, count(suite) FROM src_associations GROUP BY suite;""")
     for suite in suite_list:
         suite_id = suite_ids[suite]
         suite_arches[suite_id] = {}
-        for arch in Cnf.ValueList("Suite::%s::Architectures" % (suite)):
+        for arch in get_suite_architectures(suite):
             suite_arches[suite_id][arch] = ""
         suite_id_list.append(suite_id)
     output_list = [ output_format(i) for i in suite_list ]
index 1882ad8b774d66ca4e5ab083287cc955ff3490fc..3fbd2a504992bae6b9555af6a4bb56812aa7acfb 100755 (executable)
@@ -3,7 +3,8 @@
 """ DB access functions
 @group readonly: get_suite_id, get_section_id, get_priority_id, get_override_type_id,
                  get_architecture_id, get_archive_id, get_component_id, get_location_id,
-                 get_source_id, get_suite_version, get_files_id, get_maintainer, get_suites
+                 get_source_id, get_suite_version, get_files_id, get_maintainer, get_suites,
+                 get_suite_architectures
 @group read/write: get_or_set*, set_files_id
 
 @contact: Debian FTP Master <ftpmaster@debian.org>
@@ -409,6 +410,33 @@ def get_suite_version(source, suite):
 
     return version
 
+def get_suite_architectures(suite):
+    """
+    Returns list of architectures for C{suite}.
+
+    @type suite: string, int
+    @param suite: the suite name or the suite_id
+
+    @rtype: list
+    @return: the list of architectures for I{suite}
+    """
+
+    suite_id = None
+    if type(suite) == str:
+        suite_id = get_suite_id(suite)
+    elif type(suite) == int:
+        suite_id = suite
+    else:
+        return None
+
+    sql = """ SELECT a.arch_string FROM suite_architectures sa
+              JOIN architecture a ON (a.id = sa.architecture)
+              WHERE suite='%s' """ % (suite_id)
+
+    q = projectB.query(sql)
+    return map(lambda x: x[0], q.getresult())
+
+
 ################################################################################
 
 def get_or_set_maintainer_id (maintainer):