syncpackage: Don't crash if environment variables aren't set (LP: #665202).

This commit is contained in:
Benjamin Drung 2010-10-30 19:17:30 +02:00
parent b5b099424f
commit 61303da466
2 changed files with 26 additions and 3 deletions

5
debian/changelog vendored
View File

@ -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 <stefanor@ubuntu.com> Wed, 27 Oct 2010 23:20:06 +0200
[ Benjamin Drung ]
* syncpackage: Don't crash if environment variables aren't set (LP: #665202).
-- Benjamin Drung <skipper@deep-thought> Sat, 30 Oct 2010 19:12:08 +0200
ubuntu-dev-tools (0.104) experimental; urgency=low

View File

@ -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