diff --git a/pull-lp-source b/pull-lp-source index d9b1ca3..222ebe1 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -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)