mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-22 07:41:08 +00:00
Tidy pull-lp-source, use Logger
This commit is contained in:
parent
0d51908f40
commit
9033bf7ee7
@ -68,18 +68,21 @@ if __name__ == '__main__':
|
||||
if len(args) >= 2: # Custom distribution specified.
|
||||
release = str(args[1]).lower()
|
||||
else:
|
||||
release = os.getenv('DIST') or Distribution('ubuntu').getDevelopmentSeries().name
|
||||
release = os.getenv('DIST') or (Distribution('ubuntu')
|
||||
.getDevelopmentSeries().name)
|
||||
|
||||
try:
|
||||
(release, pocket) = splitReleasePocket(release)
|
||||
except PocketDoesNotExistError, e:
|
||||
print 'E: %s' % e
|
||||
Logger.error(e)
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
spph = Distribution('ubuntu').getArchive().getSourcePackage(package, release, pocket)
|
||||
spph = Distribution('ubuntu').getArchive().getSourcePackage(package,
|
||||
release,
|
||||
pocket)
|
||||
except (SeriesNotFoundException, PackageNotFoundException), e:
|
||||
print 'E: %s' % e
|
||||
Logger.error(e)
|
||||
sys.exit(1)
|
||||
|
||||
if options.ubuntu_mirror:
|
||||
@ -95,11 +98,14 @@ if __name__ == '__main__':
|
||||
dsc_url = [url for url in spph.sourceFileUrls() if url.endswith('.dsc')]
|
||||
assert dsc_url, 'No .dsc file found'
|
||||
|
||||
# All good - start downloading...
|
||||
print 'Fetching the source for %s from %s (%s)...' % (
|
||||
package, release.capitalize(), pocket)
|
||||
if subprocess.call(['/usr/bin/dget', '-xu', urllib.unquote(dsc_url[0])]) == 0:
|
||||
print 'Success!'
|
||||
Logger.normal('Fetching the source for %s from %s (%s)...',
|
||||
package, release.capitalize(), pocket)
|
||||
cmd = ('dget', '-xu', urllib.unquote(dsc_url[0]))
|
||||
Logger.command(cmd)
|
||||
r = subprocess.call(cmd)
|
||||
if r == 0:
|
||||
Logger.normal('Success!')
|
||||
else:
|
||||
print 'Failed to fetch and extrace the source.', \
|
||||
'Please check the output for the error.'
|
||||
Logger.error('Failed to fetch and extrace the source. '
|
||||
'Please check the output for the error.')
|
||||
sys.exit(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user