Catch DownloadErrors in ubuntutools.archive users. (LP: #708862)

This commit is contained in:
Stefano Rivera 2011-01-31 19:01:10 +02:00
parent d80f8248b8
commit 8657394219
6 changed files with 40 additions and 17 deletions

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
ubuntu-dev-tools (0.115) UNRELEASED; urgency=low
* Catch DownloadErrors in ubuntutools.archive users. (LP: #708862)
-- Stefano Rivera <stefanor@ubuntu.com> Mon, 31 Jan 2011 18:54:28 +0200
ubuntu-dev-tools (0.114) unstable; urgency=low ubuntu-dev-tools (0.114) unstable; urgency=low
[ Stefano Rivera ] [ Stefano Rivera ]

4
debian/copyright vendored
View File

@ -110,7 +110,7 @@ Copyright: 2010, Benjamin Drung <bdrung@ubuntu.com>
2008, Jonathan Patrick Davies <jpds@ubuntu.com> 2008, Jonathan Patrick Davies <jpds@ubuntu.com>
2008-2010, Martin Pitt <martin.pitt@canonical.com> 2008-2010, Martin Pitt <martin.pitt@canonical.com>
2009, Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> 2009, Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com>
2010, Stefano Rivera <stefanor@ubuntu.com> 2010-2011, Stefano Rivera <stefanor@ubuntu.com>
License: GPL-3 License: GPL-3
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -156,7 +156,7 @@ Copyright: 2007-2010, Canonical Ltd.
2009-2010, Michael Bienia <geser@ubuntu.com> 2009-2010, Michael Bienia <geser@ubuntu.com>
2009, Nathan Handler <nhandler@ubuntu.com> 2009, Nathan Handler <nhandler@ubuntu.com>
2007-2008, Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> 2007-2008, Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com>
2010, Stefano Rivera <stefanor@ubuntu.com> 2010-2011, Stefano Rivera <stefanor@ubuntu.com>
License: GPL-3+ License: GPL-3+
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -83,7 +83,7 @@ def main():
try: try:
newpkg.pull() newpkg.pull()
except DownloadError, e: except DownloadError, e:
Logger.error(str(e)) Logger.error('Failed to download: %s', str(e))
sys.exit(1) sys.exit(1)
newpkg.unpack() newpkg.unpack()
@ -100,7 +100,7 @@ def main():
try: try:
oldpkg.pull() oldpkg.pull()
except DownloadError, e: except DownloadError, e:
Logger.error(str(e)) Logger.error('Failed to download: %s', str(e))
sys.exit(1) sys.exit(1)
oldpkg.unpack() oldpkg.unpack()
print 'file://' + oldpkg.debdiff(newpkg, diffstat=True) print 'file://' + oldpkg.debdiff(newpkg, diffstat=True)

View File

@ -19,7 +19,7 @@
import optparse import optparse
import sys import sys
from ubuntutools.archive import DebianSourcePackage, rmadison from ubuntutools.archive import DebianSourcePackage, DownloadError, rmadison
from ubuntutools.config import UDTConfig from ubuntutools.config import UDTConfig
from ubuntutools.logger import Logger from ubuntutools.logger import Logger
@ -70,7 +70,11 @@ def main():
component=line['component'], component=line['component'],
mirrors=[options.debian_mirror, mirrors=[options.debian_mirror,
options.debsec_mirror]) options.debsec_mirror])
srcpkg.pull() try:
srcpkg.pull()
except DownloadError, e:
Logger.error('Failed to download: %s', str(e))
sys.exit(1)
if not options.download_only: if not options.download_only:
srcpkg.unpack() srcpkg.unpack()

View File

@ -3,8 +3,8 @@
# pull-lp-source -- pull a source package from Launchpad # pull-lp-source -- pull a source package from Launchpad
# Basic usage: pull-lp-source <source package> [<release>] # Basic usage: pull-lp-source <source package> [<release>]
# #
# Copyright (C) 2008, Iain Lane <iain@orangesquash.org.uk>, # Copyright (C) 2008, Iain Lane <iain@orangesquash.org.uk>,
# 2010, Stefano Rivera <stefanor@ubuntu.com> # 2010-2011, Stefano Rivera <stefanor@ubuntu.com>
# #
# ################################################################## # ##################################################################
# #
@ -27,7 +27,7 @@ import os
import sys import sys
from optparse import OptionParser from optparse import OptionParser
from ubuntutools.archive import UbuntuSourcePackage from ubuntutools.archive import UbuntuSourcePackage, DownloadError
from ubuntutools.config import UDTConfig from ubuntutools.config import UDTConfig
from ubuntutools.logger import Logger from ubuntutools.logger import Logger
from ubuntutools.lp.lpapicache import Distribution, Launchpad from ubuntutools.lp.lpapicache import Distribution, Launchpad
@ -86,7 +86,11 @@ def main():
srcpkg = UbuntuSourcePackage(package, spph.getVersion(), srcpkg = UbuntuSourcePackage(package, spph.getVersion(),
component=spph.getComponent(), component=spph.getComponent(),
mirrors=[options.ubuntu_mirror]) mirrors=[options.ubuntu_mirror])
srcpkg.pull() try:
srcpkg.pull()
except DownloadError, e:
Logger.error('Failed to download: %s', str(e))
sys.exit(1)
if not options.download_only: if not options.download_only:
srcpkg.unpack() srcpkg.unpack()

View File

@ -2,8 +2,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (C) 2008-2010 Martin Pitt <martin.pitt@canonical.com>, # Copyright (C) 2008-2010 Martin Pitt <martin.pitt@canonical.com>,
# 2010 Benjamin Drung <bdrung@ubuntu.com>, # 2010 Benjamin Drung <bdrung@ubuntu.com>,
# 2010 Stefano Rivera <stefanor@ubuntu.com> # 2010-2011 Stefano Rivera <stefanor@ubuntu.com>
# #
# ################################################################## # ##################################################################
# #
@ -28,10 +28,11 @@ import shutil
import subprocess import subprocess
import sys import sys
from ubuntutools.archive import DebianSourcePackage, UbuntuSourcePackage from ubuntutools.archive import (DebianSourcePackage, UbuntuSourcePackage,
DownloadError)
from ubuntutools.config import UDTConfig, ubu_email from ubuntutools.config import UDTConfig, ubu_email
from ubuntutools.requestsync.mail import getDebianSrcPkg \ from ubuntutools.requestsync.mail import (getDebianSrcPkg
as requestsync_mail_getDebianSrcPkg as requestsync_mail_getDebianSrcPkg)
from ubuntutools.requestsync.lp import getDebianSrcPkg, getUbuntuSrcPkg from ubuntutools.requestsync.lp import getDebianSrcPkg, getUbuntuSrcPkg
from ubuntutools.logger import Logger from ubuntutools.logger import Logger
from ubuntutools.lp import udtexceptions from ubuntutools.lp import udtexceptions
@ -138,7 +139,11 @@ def sync_dsc(src_pkg, debian_dist, release, name, email, bugs, ubuntu_mirror,
'setting current version to %s', 'setting current version to %s',
ubuntu_ver.full_version, cur_ver.full_version) ubuntu_ver.full_version, cur_ver.full_version)
src_pkg.pull() try:
src_pkg.pull()
except DownloadError, e:
Logger.error('Failed to download: %s', str(e))
sys.exit(1)
src_pkg.unpack() src_pkg.unpack()
fakesync = not (need_orig or ubu_pkg.verify_orig()) fakesync = not (need_orig or ubu_pkg.verify_orig())
@ -147,7 +152,11 @@ def sync_dsc(src_pkg, debian_dist, release, name, email, bugs, ubuntu_mirror,
Logger.warn('The checksums of the Debian and Ubuntu packages mismatch. ' Logger.warn('The checksums of the Debian and Ubuntu packages mismatch. '
'A fake sync is required.') 'A fake sync is required.')
# Download Ubuntu files (override Debian source tarballs) # Download Ubuntu files (override Debian source tarballs)
ubu_pkg.pull() try:
ubu_pkg.pull()
except DownloadError, e:
Logger.error('Failed to download: %s', str(e))
sys.exit(1)
# change into package directory # change into package directory
directory = src_pkg.source + '-' + new_ver.upstream_version directory = src_pkg.source + '-' + new_ver.upstream_version