diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rpm-createsolvedb.py | 64 |
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 | |||
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 | |||