Added -k / --key parameter to pass the signing key oif the sponsor to syncpackage

This commit is contained in:
Fabrice Coutadeur 2010-05-23 13:33:08 +02:00
parent 1d5ba328d0
commit 90110bfeac

View File

@ -50,7 +50,7 @@ def LogCall(command):
logging.info("Running %s", " ".join(command))
return command
def get_source(package, version, section, dist, uploader, bug):
def get_source(package, version, section, dist, uploader, bug, key):
if os.path.isdir("/tmpfs"):
workdir = "/tmpfs/ack-sync"
else:
@ -64,6 +64,8 @@ def get_source(package, version, section, dist, uploader, bug):
cmd += ["-c", section]
if uploader is not None:
cmd += ["-u", uploader]
if key is not None:
cmd += ["-k", key]
subprocess.check_call(cmd)
dsc_file = package + "_" + strip_epoch(version) + ".dsc"
@ -107,7 +109,7 @@ def test_install(dist, dsc_file):
except subprocess.CalledProcessError:
print >> sys.stderr, "E: %s failed to install. Please check log" % (changes_file)
def main(bug_numbers, package, version, section, update, uploader, verbose=False, silent=False):
def main(bug_numbers, package, version, section, update, uploader, key, verbose=False, silent=False):
launchpad = get_launchpad("ubuntu-dev-tools")
# TODO: use release-info (once available)
dist = launchpad.distributions["ubuntu"].current_series.name
@ -137,7 +139,7 @@ def main(bug_numbers, package, version, section, update, uploader, verbose=False
version = get_version(bug.title)
print "package:", package
print "version:", version
dsc_file = get_source(package, version, section, dist, uploader, bug_number)
dsc_file = get_source(package, version, section, dist, uploader, bug_number, key)
build_source(dist, dsc_file)
@ -188,6 +190,7 @@ def usage():
-e, specify uploader
-h, --help displays this help
-k, --key key used to sign the package (in case of sponsoring)
-l, --lvm lvm root dev directory, used for sbuild and piuparts
default is /dev/vg
-p, --package=<package> set the package
@ -201,9 +204,9 @@ def usage():
if __name__ == '__main__':
try:
long_opts = ["help", "lvm=", "package=", "section=", "silent", "update",
long_opts = ["help", "key=", "lvm=", "package=", "section=", "silent", "update",
"verbose", "version=", "with-sbuild", "with-piuparts"]
opts, args = getopt.gnu_getopt(sys.argv[1:], "e:hp:PsSuvV:", long_opts)
opts, args = getopt.gnu_getopt(sys.argv[1:], "e:hk:p:PsSuvV:", long_opts)
except getopt.GetoptError, e:
# will print something like "option -a not recognized"
print >> sys.stderr, str(e)
@ -219,6 +222,7 @@ if __name__ == '__main__':
version = None
piuparts = False
lvm = "/dev/vg"
key = None
for o, a in opts:
if o in ("-h", "--help"):
@ -226,6 +230,8 @@ if __name__ == '__main__':
sys.exit()
elif o in ("-e"):
uploader = a
elif o in ("-k", "--key"):
key = a
elif o in ("-l", "--lvm"):
lvm = a
elif o in ("-p", "--package"):
@ -262,4 +268,4 @@ if __name__ == '__main__':
sys.exit(COMMAND_LINE_SYNTAX_ERROR)
bug_numbers.append(number)
main(bug_numbers, package, version, section, update, uploader, verbose, silent)
main(bug_numbers, package, version, section, update, uploader, key, verbose, silent)