Canonicalise suites (use code-names) before passing them to rmadison.

This commit is contained in:
Stefano Rivera 2011-03-06 00:48:24 +02:00
parent 36b422605b
commit 989aecd253
3 changed files with 9 additions and 2 deletions

1
debian/changelog vendored
View File

@ -5,6 +5,7 @@ ubuntu-dev-tools (0.120) UNRELEASED; urgency=low
[ Stefano Rivera ] [ Stefano Rivera ]
* ubuntutools.archive: Filter rmadison results. (LP: #710579) * ubuntutools.archive: Filter rmadison results. (LP: #710579)
- Canonicalise suites (use code-names) before passing them to rmadison.
* pull-{lp,debian}-source: Download requested versions, as well as simply * pull-{lp,debian}-source: Download requested versions, as well as simply
the latest version in a release. the latest version in a release.

View File

@ -60,8 +60,8 @@ def main():
component = None component = None
debian_info = DebianDistroInfo() debian_info = DebianDistroInfo()
if version in debian_info.all or debian_info.codename(version) is not None: if debian_info.codename(version, default=version) in debian_info.all:
suite = version 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

@ -27,6 +27,7 @@ import smtplib
import socket import socket
from debian.changelog import Version from debian.changelog import Version
from ubuntutools.archive import rmadison, FakeSPPH from ubuntutools.archive import rmadison, FakeSPPH
from ubuntutools.distro_info import DebianDistroInfo
from ubuntutools.requestsync.common import raw_input_exit_on_ctrlc from ubuntutools.requestsync.common import raw_input_exit_on_ctrlc
from ubuntutools.lp.udtexceptions import PackageNotFoundException from ubuntutools.lp.udtexceptions import PackageNotFoundException
@ -39,6 +40,11 @@ __all__ = [
] ]
def getSrcPkg(distro, name, release): def getSrcPkg(distro, name, release):
if distro == 'debian':
# Canonicalise release:
debian_info = DebianDistroInfo()
release = debian_info.codename(release, default=release)
lines = list(rmadison(distro, name, suite=release, arch='source')) lines = list(rmadison(distro, name, suite=release, arch='source'))
if not lines: if not lines:
raise PackageNotFoundException("'%s' doesn't appear to exist " raise PackageNotFoundException("'%s' doesn't appear to exist "