aboutsummaryrefslogtreecommitdiff
path: root/whatmaps
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-09-19 16:37:59 +0200
committerGuido Günther <agx@sigxcpu.org>2010-09-19 16:37:59 +0200
commit66c60694bedfde816bdcd955be4303c4c5230943 (patch)
tree4172ae617c8aec585eacd821c10e0a867d30c46d /whatmaps
parentc6bbc371aca336e3df2368149fd8a34b6a7d3ede (diff)
Strip version from rpm packages
Diffstat (limited to 'whatmaps')
-rwxr-xr-xwhatmaps7
1 files changed, 6 insertions, 1 deletions
diff --git a/whatmaps b/whatmaps
index f7a62a0..fc6c703 100755
--- a/whatmaps
+++ b/whatmaps
@@ -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