mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-20 21:31:35 +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
|
from launchpadlib.launchpad import Launchpad
|
||||||
import lsb_release
|
import lsb_release
|
||||||
|
|
||||||
from ubuntutools.archive import UbuntuSourcePackage
|
from ubuntutools.archive import UbuntuSourcePackage, DownloadError
|
||||||
from ubuntutools.config import UDTConfig, ubu_email
|
from ubuntutools.config import UDTConfig, ubu_email
|
||||||
from ubuntutools.builder import get_builder
|
from ubuntutools.builder import get_builder
|
||||||
from ubuntutools.logger import Logger
|
from ubuntutools.logger import Logger
|
||||||
@ -298,6 +298,8 @@ def main(args):
|
|||||||
opts.update,
|
opts.update,
|
||||||
opts.upload,
|
opts.upload,
|
||||||
opts.prompt)
|
opts.prompt)
|
||||||
|
except DownloadError, e:
|
||||||
|
error(str(e))
|
||||||
finally:
|
finally:
|
||||||
if not opts.workdir:
|
if not opts.workdir:
|
||||||
shutil.rmtree(workdir)
|
shutil.rmtree(workdir)
|
||||||
|
@ -25,7 +25,7 @@ import sys
|
|||||||
import debian.debian_support
|
import debian.debian_support
|
||||||
import debian.changelog
|
import debian.changelog
|
||||||
|
|
||||||
from ubuntutools.archive import DebianSourcePackage
|
from ubuntutools.archive import DebianSourcePackage, DownloadError
|
||||||
from ubuntutools.config import UDTConfig
|
from ubuntutools.config import UDTConfig
|
||||||
from ubuntutools.logger import Logger
|
from ubuntutools.logger import Logger
|
||||||
|
|
||||||
@ -81,9 +81,12 @@ def main():
|
|||||||
|
|
||||||
Logger.normal('Downloading %s %s', package, version)
|
Logger.normal('Downloading %s %s', package, version)
|
||||||
|
|
||||||
#TODO: Proper snapshot and security support
|
|
||||||
newpkg = DebianSourcePackage(package, version, mirrors=mirrors)
|
newpkg = DebianSourcePackage(package, version, mirrors=mirrors)
|
||||||
|
try:
|
||||||
newpkg.pull()
|
newpkg.pull()
|
||||||
|
except DownloadError, e:
|
||||||
|
Logger.error(str(e))
|
||||||
|
sys.exit(1)
|
||||||
newpkg.unpack()
|
newpkg.unpack()
|
||||||
|
|
||||||
if opts.fetch_only:
|
if opts.fetch_only:
|
||||||
@ -96,7 +99,11 @@ def main():
|
|||||||
Logger.normal('Downloading %s %s', package, oldversion)
|
Logger.normal('Downloading %s %s', package, oldversion)
|
||||||
|
|
||||||
oldpkg = DebianSourcePackage(package, oldversion, mirrors=mirrors)
|
oldpkg = DebianSourcePackage(package, oldversion, mirrors=mirrors)
|
||||||
|
try:
|
||||||
oldpkg.pull()
|
oldpkg.pull()
|
||||||
|
except DownloadError, e:
|
||||||
|
Logger.error(str(e))
|
||||||
|
sys.exit(1)
|
||||||
oldpkg.unpack()
|
oldpkg.unpack()
|
||||||
|
|
||||||
cmd = ['debdiff', oldpkg.dsc_name, newpkg.dsc_name]
|
cmd = ['debdiff', oldpkg.dsc_name, newpkg.dsc_name]
|
||||||
|
@ -269,7 +269,12 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror):
|
|||||||
version = Version(version)
|
version = Version(version)
|
||||||
|
|
||||||
if version is None or component is None:
|
if version is None or component is None:
|
||||||
|
try:
|
||||||
debian_srcpkg = getDebianSrcPkg(package, dist)
|
debian_srcpkg = getDebianSrcPkg(package, dist)
|
||||||
|
except (udtexceptions.PackageNotFoundException,
|
||||||
|
udtexceptions.SeriesNotFoundException), e:
|
||||||
|
Logger.error(str(e))
|
||||||
|
sys.exit(1)
|
||||||
if version is None:
|
if version is None:
|
||||||
version = Version(debian_srcpkg.getVersion())
|
version = Version(debian_srcpkg.getVersion())
|
||||||
try:
|
try:
|
||||||
@ -277,6 +282,9 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror):
|
|||||||
ubuntu_version = Version(ubuntu_srcpkg.getVersion())
|
ubuntu_version = Version(ubuntu_srcpkg.getVersion())
|
||||||
except udtexceptions.PackageNotFoundException:
|
except udtexceptions.PackageNotFoundException:
|
||||||
ubuntu_version = Version('~')
|
ubuntu_version = Version('~')
|
||||||
|
except udtexceptions.SeriesNotFoundException, e:
|
||||||
|
Logger.error(str(e))
|
||||||
|
sys.exit(1)
|
||||||
if ubuntu_version >= version:
|
if ubuntu_version >= version:
|
||||||
# The LP importer is maybe out of date
|
# The LP importer is maybe out of date
|
||||||
debian_srcpkg = requestsync_mail_getDebianSrcPkg(package, dist)
|
debian_srcpkg = requestsync_mail_getDebianSrcPkg(package, dist)
|
||||||
|
@ -389,7 +389,9 @@ class DebianSourcePackage(SourcePackage):
|
|||||||
import simplejson as json
|
import simplejson as json
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Logger.error("Please install python-simplejson.")
|
Logger.error("Please install python-simplejson.")
|
||||||
sys.exit(1)
|
raise DownloadError("Unable to dowload from "
|
||||||
|
"snapshot.debian.org without "
|
||||||
|
"python-simplejson")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
srcfiles = json.load(urllib2.urlopen(
|
srcfiles = json.load(urllib2.urlopen(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user