mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-23 08:51:08 +00:00
Better handle errors when going to LP
This commit is contained in:
parent
ce044d17df
commit
728bb807d5
5
debian/changelog
vendored
5
debian/changelog
vendored
@ -13,7 +13,10 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low
|
||||
* common.py:
|
||||
- Add functions mkdir and readlist.
|
||||
|
||||
-- Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> Tue, 12 Aug 2008 20:09:42 +0200
|
||||
[ Iain Lane ]
|
||||
* pull-lp-source: Better handle errors when going to LP
|
||||
|
||||
-- Iain Lane <iain@orangesquash.org.uk> Wed, 13 Aug 2008 10:56:12 +0100
|
||||
|
||||
ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low
|
||||
|
||||
|
@ -48,7 +48,7 @@ class BackportFromLP:
|
||||
links = re.findall('a href=\"(.*\.dsc)\"', contents)
|
||||
|
||||
if len(links) == 1 and \
|
||||
subprocess.call(['dget', '-x', 'http://launchpad.net%s' % links[0]]) == 0:
|
||||
subprocess.call(['dget', '-xu', 'http://launchpad.net%s' % links[0]]) == 0:
|
||||
print '\nSuccess!'
|
||||
else:
|
||||
raise ValueError, '\nFailed to fetch and extract the source. ' +\
|
||||
@ -84,15 +84,38 @@ if __name__ == '__main__':
|
||||
sys.exit(1)
|
||||
|
||||
# Check package exists.
|
||||
try:
|
||||
|
||||
sourcePage = urllib2.urlopen("https://launchpad.net/ubuntu/%s/+source/%s" % \
|
||||
(release, package)).read()
|
||||
m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, \
|
||||
package.replace('+', '\+')), sourcePage)
|
||||
|
||||
if not m:
|
||||
print >> sys.stderr, "The '%s' package does not appear to exist in " \
|
||||
"the '%s' release." % (package, release)
|
||||
sys.exit(1)
|
||||
|
||||
except urllib2.HTTPError, e: # Raised on 404
|
||||
|
||||
if e.code == 404:
|
||||
|
||||
print >> sys.stderr, "The '%s' package does not appear to exist in " \
|
||||
"the '%s' release." % (package, release)
|
||||
|
||||
else: # Other code, probably LP malfunction
|
||||
|
||||
print >> sys.stderr, "Error when checking Launchpad for package: %s " % e
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
except urllib2.URLError, e: # Other error (NXDOMAIN, ...)
|
||||
|
||||
(_, reason) = e.reason
|
||||
|
||||
print >> sys.stderr, "Error when checking Launchpad for package: %s " % reason
|
||||
sys.exit(1)
|
||||
|
||||
# All good - start downloading...
|
||||
try:
|
||||
print 'Attempting to get %s from release %s...' % \
|
||||
|
Loading…
x
Reference in New Issue
Block a user