diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-09-19 16:37:59 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2010-09-19 16:37:59 +0200 |
commit | 66c60694bedfde816bdcd955be4303c4c5230943 (patch) | |
tree | 4172ae617c8aec585eacd821c10e0a867d30c46d /whatmaps | |
parent | c6bbc371aca336e3df2368149fd8a34b6a7d3ede (diff) |
Strip version from rpm packages
Diffstat (limited to 'whatmaps')
-rwxr-xr-x | whatmaps | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -172,6 +172,7 @@ class DebianPkg(Pkg): class RedHatDistro(Distro): # Package contains file: rpm -q -f somefile "RPM based distribution""" + _pkg_re = re.compile(r'(?P<pkg>[\w\-\+]+)-(?P<ver>[\w\.]+)-(?P<rel>[\w\.]+)\.(?P<arch>.+)') @classmethod def pkg(klass, name): @@ -184,7 +185,11 @@ class RedHatDistro(Distro): output = find_file.communicate()[0] if find_file.returncode: return None - pkg = output.strip() + m = klass._pkg_re.match(output.strip()) + if m: + pkg = m.group('pkg') + else: + pkg = output.strip() return RpmPkg(pkg) @classmethod |