mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-16 12:51:08 +00:00
Improve error handling
This commit is contained in:
parent
d9a9b4cab4
commit
3ef8324ff7
@ -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)
|
||||
|
@ -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]
|
||||
|
10
syncpackage
10
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)
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user