aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/simplerpm.py
diff options
context:
space:
mode:
Diffstat (limited to 'RepSys/simplerpm.py')
-rw-r--r--RepSys/simplerpm.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/RepSys/simplerpm.py b/RepSys/simplerpm.py
new file mode 100644
index 0000000..d448c5f
--- /dev/null
+++ b/RepSys/simplerpm.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