aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/rpm.py
diff options
context:
space:
mode:
Diffstat (limited to 'RepSys/rpm.py')
-rw-r--r--RepSys/rpm.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/RepSys/rpm.py b/RepSys/rpm.py
new file mode 100644
index 0000000..d448c5f
--- /dev/null
+++ b/RepSys/rpm.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+from RepSys.util import execcmd
+
+class SRPM:
+ def __init__(self, filename):
+ self.filename = filename
+ self._getinfo()
+
+ def _getinfo(self):
+ cmdstr = "rpm -qp --qf '%%{name} %%{epoch} %%{release} %%{version}' %s"
+ status, output = execcmd(cmdstr % self.filename)
+ self.name, self.epoch, self.release, self.version = output.split()
+ if self.epoch == "(none)":
+ self.epoch = None
+
+ def unpack(self, topdir):
+ execcmd("rpm -i --define '_topdir %s' %s" % (topdir, self.filename))
+
+# vim:et:ts=4:sw=4