summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-06-12 01:06:48 +0000
committerJeremy Katz <katzj@redhat.com>2003-06-12 01:06:48 +0000
commit3eaede5dcc6b0e5addf1269119ada194fd2d6852 (patch)
tree575141a54749bc86f117001fc6d92ae05c8281b2 /scripts
parenta68ee1010047ba6324865c1f0460ce078cf3da11 (diff)
downloadanaconda-3eaede5dcc6b0e5addf1269119ada194fd2d6852.tar.gz
anaconda-3eaede5dcc6b0e5addf1269119ada194fd2d6852.tar.xz
anaconda-3eaede5dcc6b0e5addf1269119ada194fd2d6852.zip
merge splittree changes from taroon that unbreak splitting. wonder howbefore-taroon-merge-2
these didn't get gotten before :/
Diffstat (limited to 'scripts')
-rw-r--r--scripts/splittree.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/splittree.py b/scripts/splittree.py
index 3a9fa3baa..a39c06833 100644
--- a/scripts/splittree.py
+++ b/scripts/splittree.py
@@ -24,8 +24,22 @@ import string
import getopt
import time
import types
-
-
+import rpm
+
+global _ts
+_ts = None
+
+# returns n-v-r.a from file filename
+def nvra(pkgfile):
+ global _ts
+ if _ts is None:
+ _ts = rpm.TransactionSet()
+ _ts.setVSFlags(-1)
+ fd = os.open(pkgfile, os.O_RDONLY)
+ h = _ts.hdrFromFdno(fd)
+ os.close(fd)
+ return "%s-%s-%s.%s" %(h['name'], h['version'], h['release'], h['arch'])
+
class Timber:
"""Split trees like no other"""
@@ -231,10 +245,10 @@ and RPMs. Set to 1 to turn on."""
rpmlist = os.listdir("%s/RedHat/RPMS" % self.dist_dir)
rpmlist.sort()
- # create the packages dictionary in this format: n-v-r:['n-v-r.arch.rpm']
+ # create the packages dictionary in this format: n-v-r.a:['n-v-r.arch.rpm']
for filename in rpmlist:
filesize = os.path.getsize("%s/RedHat/RPMS/%s" % (self.dist_dir, filename))
- pkg_nvr = string.join(string.split(filename, ".")[:-2], ".")
+ pkg_nvr = nvra("%s/RedHat/RPMS/%s" %(self.dist_dir, filename))
if packages.has_key(pkg_nvr):
# append in case we have multiple packages with the