From 61303da46685d40048b989921351f02c994939d6 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Sat, 30 Oct 2010 19:17:30 +0200 Subject: [PATCH] syncpackage: Don't crash if environment variables aren't set (LP: #665202). --- debian/changelog | 5 ++++- syncpackage | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 75d279a..874c155 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,7 +29,10 @@ ubuntu-dev-tools (0.105) UNRELEASED; urgency=low * pbuilder-dist: Explicitly use debian keyring when working with a Debian chroot, working around #599695 - -- Stefano Rivera Wed, 27 Oct 2010 23:20:06 +0200 + [ Benjamin Drung ] + * syncpackage: Don't crash if environment variables aren't set (LP: #665202). + + -- Benjamin Drung Sat, 30 Oct 2010 19:12:08 +0200 ubuntu-dev-tools (0.104) experimental; urgency=low diff --git a/syncpackage b/syncpackage index fd5c34c..c83ad78 100755 --- a/syncpackage +++ b/syncpackage @@ -422,11 +422,11 @@ if __name__ == "__main__": parser.add_option("-n", "--uploader-name", dest="uploader_name", help="Use UPLOADER_NAME as the name of the maintainer " "for this upload instead of evaluating DEBFULLNAME.", - default=os.environ["DEBFULLNAME"]) + default=None) parser.add_option("-e", "--uploader-email", dest="uploader_email", help="Use UPLOADER_EMAIL as email address of the " "maintainer for this upload instead of evaluating " - "DEBEMAIL.", default=os.environ["DEBEMAIL"]) + "DEBEMAIL.", default=None) parser.add_option("-k", "--key", dest="keyid", default=None, help="Specify the key ID to be used for signing.") parser.add_option('--dont-sign', dest='keyid', action='store_false', @@ -453,6 +453,26 @@ if __name__ == "__main__": % (script_name, ", ".join(invalid_bug_numbers)) sys.exit(1) + if options.uploader_name is None: + if "DEBFULLNAME" in os.environ: + options.uploader_name = ["DEBFULLNAME"] + else: + print >> sys.stderr, ("%s: Error: No uploader name specified. You " + "must pass the --uploader-name option or set " + "the DEBFULLNAME environment variable.") % \ + (script_name) + sys.exit(1) + + if options.uploader_email is None: + if "DEBEMAIL" in os.environ: + options.uploader_email = ["DEBEMAIL"] + else: + print >> sys.stderr, ("%s: Error: No uploader email address " + "specified. You must pass the " + "--uploader-email option or set the DEBEMAIL" + " environment variable.") % (script_name) + sys.exit(1) + Launchpad.login_anonymously() if options.release is None: options.release = Launchpad.distributions["ubuntu"].current_series.name