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