summaryrefslogtreecommitdiffstats
path: root/scripts
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 /scripts
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 'scripts')
-rwxr-xr-xscripts/rpm-createsolvedb.py64
1 files changed, 0 insertions, 64 deletions
diff --git a/scripts/rpm-createsolvedb.py b/scripts/rpm-createsolvedb.py
deleted file mode 100755
index a5b61bade7..0000000000
--- a/scripts/rpm-createsolvedb.py
+++ /dev/null
@@ -1,64 +0,0 @@
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