summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/createrepo
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:11:17 +0100
commit148e19e880f0c132f7679bd8779377fa4e1e6778 (patch)
treecb6c9f92cecd1ed0e67dedeb019b51e4456c2504 /meta/recipes-support/createrepo
parentfd6251ef548da7dbca354754cc0b666b2ccd0c45 (diff)
downloadpoky-148e19e880f0c132f7679bd8779377fa4e1e6778.tar.gz
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] (From OE-Core rev: 72d673bef385e756bd858f9eca7fe419efaceb39) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/createrepo')
-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 @@
1#!/usr/bin/env python
2#
3# This script generates a solution database for a directory containing rpm packages
4# but tries to be efficient about this, only doing so when the packages have changed
5# in some way.
6#
7# It is assumed something already went through and removed all the solvedb.done stamp files
8# in advance.
9#
10# First argument - the rpm binary to use
11# Subsequent arguments - paths to process solution databases for
12#
13
14import sys, os
15import hashlib
16import stat
17import subprocess
18
19if len(sys.argv) < 1:
20 print("Error, rpm command not specified")
21 sys.exit(1)
22
23if len(sys.argv) < 2:
24 print("Error, no paths specified")
25 sys.exit(1)
26
27paths = sys.argv[2:]
28
29for path in paths:
30 if os.path.exists(path + "/solvedb.done"):
31 continue
32 data = ""
33 manifest = []
34 for root, dirs, files in os.walk(path):
35 for file in files:
36 f = os.path.join(root, file)
37 if f.startswith(path + "/" + "solvedb"):
38 continue
39 data = data + str(os.stat(f)[stat.ST_MTIME])
40 manifest.append(f)
41 checksum = hashlib.md5(data).hexdigest()
42
43 if os.path.exists(path + "/solvedb.checksum") and open(path + "/solvedb.checksum", "r").read() == checksum:
44 open(path + "/solvedb.done", "w")
45 continue
46
47 if os.path.exists(path + "/solvedb"):
48 subprocess.call("rm -rf %s" % (path + "/solvedb"), shell=True)
49 os.mkdir(path + "/solvedb")
50 m = open(path + "/solvedb/manifest", "w")
51 m.write("# Dynamically generated solve manifest\n")
52 for f in manifest:
53 m.write(f + "\n")
54 m.close()
55
56 cmd = sys.argv[1] + ' -i --replacepkgs --replacefiles --oldpackage -D "_dbpath ' + path + '/solvedb" --justdb \
57 --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
58 --ignoresize --nosignature --nodigest -D "__dbi_txn create nofsync" \
59 ' + path + '/solvedb/manifest'
60 subprocess.call(cmd, shell=True)
61
62 open(path + "/solvedb.checksum", "w").write(checksum)
63 open(path + "/solvedb.done", "w")
64
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"
6 6
7RDEPENDS_${PN}_virtclass-native += "libxml2-native rpm-native" 7RDEPENDS_${PN}_virtclass-native += "libxml2-native rpm-native"
8 8
9PR = "r4" 9PR = "r5"
10 10
11SRC_URI= "http://createrepo.baseurl.org/download/${BP}.tar.gz \ 11SRC_URI= "http://createrepo.baseurl.org/download/${BP}.tar.gz \
12 file://fix-native-install.patch \ 12 file://fix-native-install.patch \
13 file://python-scripts-should-use-interpreter-from-env.patch \ 13 file://python-scripts-should-use-interpreter-from-env.patch \
14 file://createrepo-rpm549.patch \ 14 file://createrepo-rpm549.patch \
15 file://rpm-createsolvedb.py \
15 " 16 "
16 17
17SRC_URI[md5sum] = "3e9ccf4abcffe3f49af078c83611eda2" 18SRC_URI[md5sum] = "3e9ccf4abcffe3f49af078c83611eda2"
@@ -21,4 +22,5 @@ BBCLASSEXTEND = "native"
21 22
22do_install () { 23do_install () {
23 oe_runmake -e 'DESTDIR=${D}' install 24 oe_runmake -e 'DESTDIR=${D}' install
25 install -m 0755 ${WORKDIR}/rpm-createsolvedb.py ${D}${bindir}/
24} 26}