summaryrefslogtreecommitdiff
path: root/meta/recipes-support
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-08-01 17:14:53 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-01 23:03:06 +0100
commit72d673bef385e756bd858f9eca7fe419efaceb39 (patch)
tree7abdc2f582f04b83dc0ac205cc7b6d5f41e18b33 /meta/recipes-support
parent674d65c94478a1ff33ef9d9c1e49f677091301f4 (diff)
downloadopenembedded-core-72d673bef385e756bd858f9eca7fe419efaceb39.tar.gz
openembedded-core-72d673bef385e756bd858f9eca7fe419efaceb39.tar.bz2
openembedded-core-72d673bef385e756bd858f9eca7fe419efaceb39.zip
createrepo 0.4.11: add rpm-createsolvedb.py
Move scripts/rpm-createsolvedb.py to meta/recipes-support/createrepo/createrepo/ since we should wrap it to use the native python. [YOCTO #2822] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support')
-rwxr-xr-xmeta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py64
-rw-r--r--meta/recipes-support/createrepo/createrepo_0.4.11.bb4
2 files changed, 67 insertions, 1 deletions
diff --git a/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py b/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py
new file mode 100755
index 0000000000..a5b61bade7
--- /dev/null
+++ b/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+#
+# This script generates a solution database for a directory containing rpm packages
+# but tries to be efficient about this, only doing so when the packages have changed
+# in some way.
+#
+# It is assumed something already went through and removed all the solvedb.done stamp files
+# in advance.
+#
+# First argument - the rpm binary to use
+# Subsequent arguments - paths to process solution databases for
+#
+
+import sys, os
+import hashlib
+import stat
+import subprocess
+
+if len(sys.argv) < 1:
+ print("Error, rpm command not specified")
+ sys.exit(1)
+
+if len(sys.argv) < 2:
+ print("Error, no paths specified")
+ sys.exit(1)
+
+paths = sys.argv[2:]
+
+for path in paths:
+ if os.path.exists(path + "/solvedb.done"):
+ continue
+ data = ""
+ manifest = []
+ for root, dirs, files in os.walk(path):
+ for file in files:
+ f = os.path.join(root, file)
+ if f.startswith(path + "/" + "solvedb"):
+ continue
+ data = data + str(os.stat(f)[stat.ST_MTIME])
+ manifest.append(f)
+ checksum = hashlib.md5(data).hexdigest()
+
+ if os.path.exists(path + "/solvedb.checksum") and open(path + "/solvedb.checksum", "r").read() == checksum:
+ open(path + "/solvedb.done", "w")
+ continue
+
+ if os.path.exists(path + "/solvedb"):
+ subprocess.call("rm -rf %s" % (path + "/solvedb"), shell=True)
+ os.mkdir(path + "/solvedb")
+ m = open(path + "/solvedb/manifest", "w")
+ m.write("# Dynamically generated solve manifest\n")
+ for f in manifest:
+ m.write(f + "\n")
+ m.close()
+
+ cmd = sys.argv[1] + ' -i --replacepkgs --replacefiles --oldpackage -D "_dbpath ' + path + '/solvedb" --justdb \
+ --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
+ --ignoresize --nosignature --nodigest -D "__dbi_txn create nofsync" \
+ ' + path + '/solvedb/manifest'
+ subprocess.call(cmd, shell=True)
+
+ open(path + "/solvedb.checksum", "w").write(checksum)
+ open(path + "/solvedb.done", "w")
+
diff --git a/meta/recipes-support/createrepo/createrepo_0.4.11.bb b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
index 7a4d05968e..dcddcf8331 100644
--- a/meta/recipes-support/createrepo/createrepo_0.4.11.bb
+++ b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
@@ -6,12 +6,13 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760"
RDEPENDS_${PN}_virtclass-native += "libxml2-native rpm-native"
-PR = "r4"
+PR = "r5"
SRC_URI= "http://createrepo.baseurl.org/download/${BP}.tar.gz \
file://fix-native-install.patch \
file://python-scripts-should-use-interpreter-from-env.patch \
file://createrepo-rpm549.patch \
+ file://rpm-createsolvedb.py \
"
SRC_URI[md5sum] = "3e9ccf4abcffe3f49af078c83611eda2"
@@ -21,4 +22,5 @@ BBCLASSEXTEND = "native"
do_install () {
oe_runmake -e 'DESTDIR=${D}' install
+ install -m 0755 ${WORKDIR}/rpm-createsolvedb.py ${D}${bindir}/
}