X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fgenerate_releases.py;h=7f5a9963fc83e27d729a74190c4367a24c4a3d43;hb=e8ef4a21ceff20319cde5002cb562ae05d7622c9;hp=a3ed5a4f0b7ecf9742eab71f24239868a62a9ac9;hpb=f5dc3160a134c8d1e059d94cf51321b8626cc5e1;p=dak.git diff --git a/dak/generate_releases.py b/dak/generate_releases.py index a3ed5a4f..7f5a9963 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -79,7 +79,7 @@ def get_result(arg): if arg: results.append(arg) -def sign_release_dir(dirname): +def sign_release_dir(suite, dirname): cnf = Config() if cnf.has_key("Dinstall::SigningKeyring"): @@ -88,7 +88,6 @@ def sign_release_dir(dirname): keyring += " --keyring \"%s\"" % cnf["Dinstall::SigningPubKeyring"] arguments = "--no-options --batch --no-tty --armour" - signkeyids = cnf.signingkeyids.split() relname = os.path.join(dirname, 'Release') @@ -100,17 +99,20 @@ def sign_release_dir(dirname): if os.path.exists(inlinedest): os.unlink(inlinedest) - for keyid in signkeyids: - if keyid != "": - defkeyid = "--default-key %s" % keyid - else: - defkeyid = "" + # We can only use one key for inline signing so use the first one in + # the array for consistency + firstkey = True + + for keyid in suite.signingkeys: + defkeyid = "--default-key %s" % keyid os.system("gpg %s %s %s --detach-sign <%s >>%s" % (keyring, defkeyid, arguments, relname, dest)) - os.system("gpg %s %s %s --clearsign <%s >>%s" % - (keyring, defkeyid, arguments, relname, inlinedest)) + if firstkey: + os.system("gpg %s %s %s --clearsign <%s >>%s" % + (keyring, defkeyid, arguments, relname, inlinedest)) + firstkey = False class ReleaseWriter(object): def __init__(self, suite): @@ -152,7 +154,7 @@ class ReleaseWriter(object): suite_suffix = "%s" % (cnf.Find("Dinstall::SuiteSuffix")) outfile = os.path.join(cnf["Dir::Root"], 'dists', "%s/%s" % (suite.suite_name, suite_suffix), "Release") - out = open(outfile, "w") + out = open(outfile + ".new", "w") for key, dbfield in attribs: if getattr(suite, dbfield) is not None: @@ -182,7 +184,7 @@ class ReleaseWriter(object): out.write("Description: %s\n" % suite.description) for comp in components: - for dirpath, dirnames, filenames in os.walk("%sdists/%s/%s" % (cnf["Dir::Root"], suite.suite_name, comp), topdown=True): + for dirpath, dirnames, filenames in os.walk("%sdists/%s/%s%s" % (cnf["Dir::Root"], suite.suite_name, suite_suffix, comp), topdown=True): if not re_gensubrelease.match(dirpath): continue @@ -278,8 +280,9 @@ class ReleaseWriter(object): out.write(" %s %8d %s\n" % (fileinfo[filename][h], fileinfo[filename]['len'], filename)) out.close() + os.rename(outfile + '.new', outfile) - sign_release_dir(os.path.dirname(outfile)) + sign_release_dir(suite, os.path.dirname(outfile)) os.chdir(oldcwd)