summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2016-08-17 14:31:25 -0500
committerPatrick Williams <patrick@stwcx.xyz>2016-08-22 16:43:26 +0000
commit60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch)
treeecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py
parente18c61205e0234b03697129c20cc69c9b3940efc (diff)
downloadblackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.gz
blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.zip
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to hold all of the layers that we import with git-subtree. Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py')
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py b/import-layers/yocto-poky/meta/recipes-support/createrepo/createrepo/rpm-createsolvedb.py
new file mode 100755
index 000000000..a5b61bade
--- /dev/null
+++ b/import-layers/yocto-poky/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")
+
OpenPOWER on IntegriCloud