diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-05-29 22:53:07 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-30 12:04:45 +0100 |
commit | d760fb97f52c705944a259be267e0ea8516074e3 (patch) | |
tree | 526b03c63a884a5e2c09abcf564aa47b2b358d6a /scripts/rpm-createsolvedb.py | |
parent | e40995e569289598a1d9d71e19734402f2b54718 (diff) | |
download | poky-d760fb97f52c705944a259be267e0ea8516074e3.tar.gz |
scripts: replace os.system with subprocess.call
Replace os.system with subprocess.call since the older function would
fail (more or less) silently if the executed program cannot be found
More info:
http://docs.python.org/library/subprocess.html#subprocess-replacements
[YOCTO #2454]
(From OE-Core rev: 57f843146ed62c04c23bc380dc8cb38aba264f1c)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/rpm-createsolvedb.py')
-rwxr-xr-x | scripts/rpm-createsolvedb.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/rpm-createsolvedb.py b/scripts/rpm-createsolvedb.py index 0d5f2198a9..a5b61bade7 100755 --- a/scripts/rpm-createsolvedb.py +++ b/scripts/rpm-createsolvedb.py | |||
@@ -14,6 +14,7 @@ | |||
14 | import sys, os | 14 | import sys, os |
15 | import hashlib | 15 | import hashlib |
16 | import stat | 16 | import stat |
17 | import subprocess | ||
17 | 18 | ||
18 | if len(sys.argv) < 1: | 19 | if len(sys.argv) < 1: |
19 | print("Error, rpm command not specified") | 20 | print("Error, rpm command not specified") |
@@ -44,7 +45,7 @@ for path in paths: | |||
44 | continue | 45 | continue |
45 | 46 | ||
46 | if os.path.exists(path + "/solvedb"): | 47 | if os.path.exists(path + "/solvedb"): |
47 | os.system("rm -rf %s" % (path + "/solvedb")) | 48 | subprocess.call("rm -rf %s" % (path + "/solvedb"), shell=True) |
48 | os.mkdir(path + "/solvedb") | 49 | os.mkdir(path + "/solvedb") |
49 | m = open(path + "/solvedb/manifest", "w") | 50 | m = open(path + "/solvedb/manifest", "w") |
50 | m.write("# Dynamically generated solve manifest\n") | 51 | m.write("# Dynamically generated solve manifest\n") |
@@ -56,7 +57,7 @@ for path in paths: | |||
56 | --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \ | 57 | --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \ |
57 | --ignoresize --nosignature --nodigest -D "__dbi_txn create nofsync" \ | 58 | --ignoresize --nosignature --nodigest -D "__dbi_txn create nofsync" \ |
58 | ' + path + '/solvedb/manifest' | 59 | ' + path + '/solvedb/manifest' |
59 | os.system(cmd) | 60 | subprocess.call(cmd, shell=True) |
60 | 61 | ||
61 | open(path + "/solvedb.checksum", "w").write(checksum) | 62 | open(path + "/solvedb.checksum", "w").write(checksum) |
62 | open(path + "/solvedb.done", "w") | 63 | open(path + "/solvedb.done", "w") |