Merge "Handle rpm name versions correctly."

This commit is contained in:
Jenkins 2013-07-01 00:47:21 +00:00 committed by Gerrit Code Review
commit 3929d1b939

View File

@ -609,12 +609,17 @@ class YumDependencyHandler(base.DependencyHandler):
return [] return []
cmdline = self.py2rpm_start_cmdline() + ["--convert"] + python_names cmdline = self.py2rpm_start_cmdline() + ["--convert"] + python_names
rpm_names = [] rpm_names = []
for name in sh.execute(cmdline)[0].splitlines(): for line in sh.execute(cmdline)[0].splitlines():
# name is "Requires: rpm-name" # format is "Requires: rpm-name <=> X"
try: if not line.startswith("Requires:"):
rpm_names.append(name.split(":", 1)[1].strip()) continue
except IndexError: line = line[len("Requires:"):].strip()
pass positions = [line.find(">"), line.find("<"), line.find("=")]
positions = sorted([p for p in positions if p != -1])
if positions:
line = line[0:positions[0]].strip()
if line and line not in rpm_names:
rpm_names.append(line)
return rpm_names return rpm_names
def _all_rpm_names(self): def _all_rpm_names(self):