diff --git a/backportpackage b/backportpackage index 5c981de..e349f49 100755 --- a/backportpackage +++ b/backportpackage @@ -28,7 +28,7 @@ import tempfile from launchpadlib.launchpad import Launchpad import lsb_release -from ubuntutools.archive import UbuntuSourcePackage +from ubuntutools.archive import UbuntuSourcePackage, DownloadError from ubuntutools.config import UDTConfig, ubu_email from ubuntutools.builder import get_builder from ubuntutools.logger import Logger @@ -298,6 +298,8 @@ def main(args): opts.update, opts.upload, opts.prompt) + except DownloadError, e: + error(str(e)) finally: if not opts.workdir: shutil.rmtree(workdir) diff --git a/pull-debian-debdiff b/pull-debian-debdiff index 6483a1f..053f5c5 100755 --- a/pull-debian-debdiff +++ b/pull-debian-debdiff @@ -25,7 +25,7 @@ import sys import debian.debian_support import debian.changelog -from ubuntutools.archive import DebianSourcePackage +from ubuntutools.archive import DebianSourcePackage, DownloadError from ubuntutools.config import UDTConfig from ubuntutools.logger import Logger @@ -81,9 +81,12 @@ def main(): Logger.normal('Downloading %s %s', package, version) - #TODO: Proper snapshot and security support newpkg = DebianSourcePackage(package, version, mirrors=mirrors) - newpkg.pull() + try: + newpkg.pull() + except DownloadError, e: + Logger.error(str(e)) + sys.exit(1) newpkg.unpack() if opts.fetch_only: @@ -96,7 +99,11 @@ def main(): Logger.normal('Downloading %s %s', package, oldversion) oldpkg = DebianSourcePackage(package, oldversion, mirrors=mirrors) - oldpkg.pull() + try: + oldpkg.pull() + except DownloadError, e: + Logger.error(str(e)) + sys.exit(1) oldpkg.unpack() cmd = ['debdiff', oldpkg.dsc_name, newpkg.dsc_name] diff --git a/syncpackage b/syncpackage index 9c040d5..23bf7bf 100755 --- a/syncpackage +++ b/syncpackage @@ -269,7 +269,12 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror): version = Version(version) if version is None or component is None: - debian_srcpkg = getDebianSrcPkg(package, dist) + try: + debian_srcpkg = getDebianSrcPkg(package, dist) + except (udtexceptions.PackageNotFoundException, + udtexceptions.SeriesNotFoundException), e: + Logger.error(str(e)) + sys.exit(1) if version is None: version = Version(debian_srcpkg.getVersion()) try: @@ -277,6 +282,9 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror): ubuntu_version = Version(ubuntu_srcpkg.getVersion()) except udtexceptions.PackageNotFoundException: ubuntu_version = Version('~') + except udtexceptions.SeriesNotFoundException, e: + Logger.error(str(e)) + sys.exit(1) if ubuntu_version >= version: # The LP importer is maybe out of date debian_srcpkg = requestsync_mail_getDebianSrcPkg(package, dist) diff --git a/ubuntutools/archive.py b/ubuntutools/archive.py index b3822da..e144557 100644 --- a/ubuntutools/archive.py +++ b/ubuntutools/archive.py @@ -389,7 +389,9 @@ class DebianSourcePackage(SourcePackage): import simplejson as json except ImportError: Logger.error("Please install python-simplejson.") - sys.exit(1) + raise DownloadError("Unable to dowload from " + "snapshot.debian.org without " + "python-simplejson") try: srcfiles = json.load(urllib2.urlopen(