From 1048901abb45b89abfd1fb571e980400d029ba95 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Sun, 19 Sep 2010 22:09:26 +0200 Subject: [PATCH] syncpackage: Print error message if the download fails (LP: #639899). --- debian/changelog | 6 ++++-- syncpackage | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 99c9013..675ef67 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,7 +11,9 @@ ubuntu-dev-tools (0.102) UNRELEASED; urgency=low * suspicious-source: whitelist font source formats. Thanks to Nicolas Spalinger for the patch (LP: #365147). * Update the man page of suspicious-source to match the rewrite. - * syncpackage: Don't upload orig tarball if not needed. + * syncpackage: + - Don't upload orig tarball if not needed. + - Print error message if the download fails (LP: #639899). * update-maintainer: Don't change the Maintainer field if the email is set to a @lists.ubuntu.com address. * sponsor-patch: New script to download a patch from a Launchpad bug, patch @@ -35,7 +37,7 @@ ubuntu-dev-tools (0.102) UNRELEASED; urgency=low * Fix NAME section of lp-set-dup(1). * lp-list-bugs: New tool. - -- Benjamin Drung Fri, 17 Sep 2010 04:42:53 +0200 + -- Benjamin Drung Sun, 19 Sep 2010 22:07:52 +0200 ubuntu-dev-tools (0.101) unstable; urgency=low diff --git a/syncpackage b/syncpackage index 2f5ba16..48b27c6 100755 --- a/syncpackage +++ b/syncpackage @@ -73,7 +73,12 @@ class File(object): if not file_exists: if verbose: print '%s: I: Downloading %s...' % (script_name, self.url) - urllib.urlretrieve(self.url, self.name) + try: + urllib.urlretrieve(self.url, self.name) + except IOError as e: + print >> sys.stderr, "%s: Error: Failed to download %s [Errno %i]: %s." % \ + (script_name, self.name, e.errno, e.strerror) + sys.exit(1) class Version(debian.debian_support.Version): @@ -178,7 +183,12 @@ def sync_dsc(script_name, dscurl, debian_dist, release, name, email, bugs, keyid if os.path.exists(os.path.join(basepath, dscname)): dscfile = dscurl else: - urllib.urlretrieve(dscurl, dscname) + try: + urllib.urlretrieve(dscurl, dscname) + except IOError as e: + print >> sys.stderr, "%s: Error: Failed to download %s [Errno %i]: %s." % \ + (script_name, dscname, e.errno, e.strerror) + sys.exit(1) dscfile = debian.deb822.Dsc(file(dscname)) if "Version" not in dscfile: print >> sys.stderr, "%s: Error: No Version field found in the dsc file. Please check %s!" % \