diff --git a/debian/changelog b/debian/changelog index 0b8ea68..caacbef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,7 @@ ubuntu-dev-tools (0.120) UNRELEASED; urgency=low the latest version in a release. * pull-{lp,debian}-source, pull-debian-debdiff: Catch KeyboardInterrupt. (LP: #713845) + * pull-debian-source: Handle -p-u and -security suites. [ Julian Taylor ] * add support for cowbuilder and cowbuilder-dist in builder.py diff --git a/pull-debian-source b/pull-debian-source index b4e4314..df52d03 100755 --- a/pull-debian-source +++ b/pull-debian-source @@ -24,6 +24,27 @@ from ubuntutools.config import UDTConfig from ubuntutools.distro_info import DebianDistroInfo from ubuntutools.logger import Logger +def is_suite(version): + """If version could be considered to be a Debian suite, return the + canonical suite name. Otherwise None + """ + debian_info = DebianDistroInfo() + debian_releases = debian_info.all + ['experimental'] + + if '-' in version: + release, pocket = version.split('-', 1) + release = debian_info.codename(release, default=release) + if release in debian_releases: + if pocket in ('proposed-updates', 'p-u'): + return (release + '-proposed-updates') + elif pocket == 'security': + return (release + '-security') + else: + release = debian_info.codename(version, default=version) + if release in debian_releases: + return release + return None + def main(): usage = 'Usage: %prog [release|version]' parser = optparse.OptionParser(usage) @@ -59,9 +80,8 @@ def main(): version = args[1] if len(args) > 1 else 'unstable' component = None - debian_info = DebianDistroInfo() - if debian_info.codename(version, default=version) in debian_info.all: - suite = debian_info.codename(version, default=version) + suite = is_suite(version) + if suite is not None: line = list(rmadison('debian', package, suite, 'source')) if not line: Logger.error('Unable to find %s in Debian suite "%s".', package, diff --git a/ubuntutools/archive.py b/ubuntutools/archive.py index 6b95b21..47ad0fb 100644 --- a/ubuntutools/archive.py +++ b/ubuntutools/archive.py @@ -520,6 +520,10 @@ def rmadison(url, package, suite=None, arch=None): stderr=subprocess.PIPE, close_fds=True) output = process.communicate()[0] assert process.wait() == 0 + + # rmadison uses some shorthand + suite = suite.replace('-proposed-updates', '-p-u') + for line in output.strip().splitlines(): pkg, ver, dist, archs = [x.strip() for x in line.split('|')] comp = 'main'