diff options
| author | Robert Yang <liezhi.yang@windriver.com> | 2012-08-01 17:14:53 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-01 23:11:17 +0100 |
| commit | 148e19e880f0c132f7679bd8779377fa4e1e6778 (patch) | |
| tree | cb6c9f92cecd1ed0e67dedeb019b51e4456c2504 /meta | |
| parent | fd6251ef548da7dbca354754cc0b666b2ccd0c45 (diff) | |
| download | poky-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')
| -rw-r--r-- | meta/classes/rootfs_rpm.bbclass | 2 | ||||
| -rwxr-xr-x | meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py | 64 | ||||
| -rw-r--r-- | meta/recipes-support/createrepo/createrepo_0.4.11.bb | 4 |
3 files changed, 68 insertions, 2 deletions
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass index c9258dfe39..a03e9f379d 100644 --- a/meta/classes/rootfs_rpm.bbclass +++ b/meta/classes/rootfs_rpm.bbclass | |||
| @@ -17,7 +17,7 @@ do_rootfs[depends] += "rpmresolve-native:do_populate_sysroot" | |||
| 17 | do_rootfs[depends] += "opkg-native:do_populate_sysroot" | 17 | do_rootfs[depends] += "opkg-native:do_populate_sysroot" |
| 18 | 18 | ||
| 19 | # Creating the repo info in do_rootfs | 19 | # Creating the repo info in do_rootfs |
| 20 | #do_rootfs[depends] += "createrepo-native:do_populate_sysroot" | 20 | do_rootfs[depends] += "createrepo-native:do_populate_sysroot" |
| 21 | 21 | ||
| 22 | do_rootfs[recrdeptask] += "do_package_write_rpm" | 22 | do_rootfs[recrdeptask] += "do_package_write_rpm" |
| 23 | 23 | ||
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 | |||
| 14 | import sys, os | ||
| 15 | import hashlib | ||
| 16 | import stat | ||
| 17 | import subprocess | ||
| 18 | |||
| 19 | if len(sys.argv) < 1: | ||
| 20 | print("Error, rpm command not specified") | ||
| 21 | sys.exit(1) | ||
| 22 | |||
| 23 | if len(sys.argv) < 2: | ||
| 24 | print("Error, no paths specified") | ||
| 25 | sys.exit(1) | ||
| 26 | |||
| 27 | paths = sys.argv[2:] | ||
| 28 | |||
| 29 | for 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 | ||
| 7 | RDEPENDS_${PN}_virtclass-native += "libxml2-native rpm-native" | 7 | RDEPENDS_${PN}_virtclass-native += "libxml2-native rpm-native" |
| 8 | 8 | ||
| 9 | PR = "r4" | 9 | PR = "r5" |
| 10 | 10 | ||
| 11 | SRC_URI= "http://createrepo.baseurl.org/download/${BP}.tar.gz \ | 11 | SRC_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 | ||
| 17 | SRC_URI[md5sum] = "3e9ccf4abcffe3f49af078c83611eda2" | 18 | SRC_URI[md5sum] = "3e9ccf4abcffe3f49af078c83611eda2" |
| @@ -21,4 +22,5 @@ BBCLASSEXTEND = "native" | |||
| 21 | 22 | ||
| 22 | do_install () { | 23 | do_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 | } |
