From 86e940a9aee5c51aa0d090b34d5a4f4714ef255a Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Fri, 24 Dec 2010 12:16:34 +0200 Subject: [PATCH] pull-lp-source: Support -d (LP: #681699) --- debian/changelog | 3 ++- pull-lp-source | 35 ++++++++++++++++++----------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1787bc9..2ba9918 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,6 +26,7 @@ ubuntu-dev-tools (0.109) UNRELEASED; urgency=low * edit-patch: Don't let cat error through if debian/source/format doesn't exist. * pull-debian-debdiff: Rewrite in Python, and use snapshot.debian.org. + * pull-lp-source: Support -d (LP: #681699) [ Michael Bienia ] * ubuntutools/lp/lpapicache.py: Allow easier selection of 'staging' as LP @@ -47,7 +48,7 @@ ubuntu-dev-tools (0.109) UNRELEASED; urgency=low * add "add-patch" that provides the non-interactive version of edit-patch - -- Stefano Rivera Fri, 24 Dec 2010 02:57:36 +0200 + -- Stefano Rivera Fri, 24 Dec 2010 12:16:10 +0200 ubuntu-dev-tools (0.108) experimental; urgency=low diff --git a/pull-lp-source b/pull-lp-source index 222ebe1..e2a6201 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -44,6 +44,10 @@ if not os.path.exists("/usr/bin/dget"): if __name__ == '__main__': usage = "Usage: %prog [release]" optParser = OptionParser(usage) + optParser.add_option('-d', '--download-only', + dest='download_only', default=False, + action='store_true', + help="Do not extract the source package") optParser.add_option('-m', '--mirror', metavar='UBUNTU_MIRROR', dest='ubuntu_mirror', help='Preferred Ubuntu mirror ' @@ -85,27 +89,24 @@ if __name__ == '__main__': Logger.error(e) sys.exit(1) + urls = [] if options.ubuntu_mirror: - url = dsc_url(options.ubuntu_mirror, spph.getComponent(), package, - spph.getVersion()) - cmd = ('dget', '-xu', url) + urls.append(dsc_url(options.ubuntu_mirror, spph.getComponent(), + package, spph.getVersion())) + dsc_url = [url for url in spph.sourceFileUrls() if url.endswith('.dsc')] + assert dsc_url, 'No .dsc file found' + urls.append(urllib.unquote(dsc_url[0])) + + Logger.normal('Fetching the source for %s from %s (%s)...', + package, release.capitalize(), pocket) + for url in urls: + cmd = ('dget', '-u' + 'd' if options.download_only else 'x', url) Logger.command(cmd) r = subprocess.call(cmd) if r == 0: Logger.normal("Success!") sys.exit(0) - dsc_url = [url for url in spph.sourceFileUrls() if url.endswith('.dsc')] - assert dsc_url, 'No .dsc file found' - - 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: - Logger.error('Failed to fetch and extrace the source. ' - 'Please check the output for the error.') - sys.exit(1) + Logger.error('Failed to fetch and extrace the source. ' + 'Please check the output for the error.') + sys.exit(1)