pull-debian-source: Handle -p-u and -security suites.

This commit is contained in:
Stefano Rivera 2011-03-08 23:31:54 +02:00
parent fd49a767bb
commit 280d8c1172
3 changed files with 28 additions and 3 deletions

1
debian/changelog vendored
View File

@ -10,6 +10,7 @@ ubuntu-dev-tools (0.120) UNRELEASED; urgency=low
the latest version in a release. the latest version in a release.
* pull-{lp,debian}-source, pull-debian-debdiff: Catch KeyboardInterrupt. * pull-{lp,debian}-source, pull-debian-debdiff: Catch KeyboardInterrupt.
(LP: #713845) (LP: #713845)
* pull-debian-source: Handle -p-u and -security suites.
[ Julian Taylor ] [ Julian Taylor ]
* add support for cowbuilder and cowbuilder-dist in builder.py * add support for cowbuilder and cowbuilder-dist in builder.py

View File

@ -24,6 +24,27 @@ from ubuntutools.config import UDTConfig
from ubuntutools.distro_info import DebianDistroInfo from ubuntutools.distro_info import DebianDistroInfo
from ubuntutools.logger import Logger 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(): def main():
usage = 'Usage: %prog <package> [release|version]' usage = 'Usage: %prog <package> [release|version]'
parser = optparse.OptionParser(usage) parser = optparse.OptionParser(usage)
@ -59,9 +80,8 @@ def main():
version = args[1] if len(args) > 1 else 'unstable' version = args[1] if len(args) > 1 else 'unstable'
component = None component = None
debian_info = DebianDistroInfo() suite = is_suite(version)
if debian_info.codename(version, default=version) in debian_info.all: if suite is not None:
suite = debian_info.codename(version, default=version)
line = list(rmadison('debian', package, suite, 'source')) line = list(rmadison('debian', package, suite, 'source'))
if not line: if not line:
Logger.error('Unable to find %s in Debian suite "%s".', package, Logger.error('Unable to find %s in Debian suite "%s".', package,

View File

@ -520,6 +520,10 @@ def rmadison(url, package, suite=None, arch=None):
stderr=subprocess.PIPE, close_fds=True) stderr=subprocess.PIPE, close_fds=True)
output = process.communicate()[0] output = process.communicate()[0]
assert process.wait() == 0 assert process.wait() == 0
# rmadison uses some shorthand
suite = suite.replace('-proposed-updates', '-p-u')
for line in output.strip().splitlines(): for line in output.strip().splitlines():
pkg, ver, dist, archs = [x.strip() for x in line.split('|')] pkg, ver, dist, archs = [x.strip() for x in line.split('|')]
comp = 'main' comp = 'main'