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>
"""
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)
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)
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
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
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))
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+'...'
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"
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 ]:
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:
(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
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
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 = {}
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 ]
""" 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>
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):