ubuntutools/requestsync/mail.py: rmadison() returns now the most recent source

line (Closes: #560758)
This commit is contained in:
Michael Bienia 2009-12-20 15:43:57 +01:00
parent a6002f06e0
commit 0a3d905cf4
2 changed files with 16 additions and 8 deletions

4
debian/changelog vendored
View File

@ -11,8 +11,10 @@ ubuntu-dev-tools (0.86) UNRELEASED; urgency=low
[ Michael Bienia ]
* ubuntutools/requestsync/common.py: convert the changelog into a unicode
string (lp: #498349)
* ubuntutools/requestsync/mail.py: rmadison() returns now the most recent
source line (Closes: #560758)
-- Michael Bienia <geser@ubuntu.com> Sun, 20 Dec 2009 14:08:31 +0100
-- Michael Bienia <geser@ubuntu.com> Sun, 20 Dec 2009 15:40:40 +0100
ubuntu-dev-tools (0.85) lucid; urgency=low

View File

@ -24,6 +24,7 @@ import sys
import subprocess
import smtplib
import socket
from debian_bundle.changelog import Version
from .common import raw_input_exit_on_ctrlc
from ..lp.udtexceptions import PackageNotFoundException
@ -63,13 +64,18 @@ def rmadison(distro, package, release):
rmadison_out = rmadison_cmd.communicate()[0]
assert (rmadison_cmd.returncode == 0)
# Work-around for a bug in Debians madison.php script not returning
# only the source line
for line in rmadison_out.splitlines():
if line.find('source') > 0:
return map(lambda x: x.strip(), line.split('|'))
return None
# Return the most recent source line
lines = rmadison_out.splitlines()
if not lines:
# no output
return None
lines = [map(lambda x: x.strip(), line.split('|')) for line in lines]
lines = [line for line in lines if line[3].find('source') != -1]
if lines:
return max(lines, key = lambda x: Version(x[1]))
else:
# no source line
return None
def getSrcPkg(distro, name, release):
out = rmadison(distro, name, release)