scratch this patchset, I accidentally run regression-tests on wrong branch,
all tests fail due to bad path
sorry for the inconvenience
Best regards,
Jiri Prochazka
LNST Developer
|
www.lnst-project.org
+420 532 294 633 | jprochaz(a)redhat.com
Red Hat Czech | Purkyňova 71/99, 612 00 Brno
2015-08-27 18:42 GMT+02:00 Jiri Prochazka <jprochaz(a)redhat.com>:
This function computes hash from all .py files in "lnst/"
directory and
from files "lnst-ctl" and "lnst-slave".
This function will be used for computing version of LNST
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Common/Utils.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/lnst/Common/Utils.py b/lnst/Common/Utils.py
index 22d2925..ce67c92 100644
--- a/lnst/Common/Utils.py
+++ b/lnst/Common/Utils.py
@@ -290,3 +290,33 @@ def is_installed(program):
return True
except subprocess.CalledProcessError:
return False
+
+def get_version_hash():
+ """
+ Returns MD5 hash computed from all .py files in lnst/ directory
+ and files lnst-ctl and lnst-slave
+ """
+ file_list = []
+ file_sum = ""
+
+ for root, _, files in os.walk("./lnst/"):
+ for f in files:
+ if f.endswith(".py"):
+ file_list.append(os.path.join(root, f))
+
+ file_list.sort()
+
+ for f in file_list:
+ with open(f, 'r') as fin:
+ file_sum += fin.read()
+ fin.close()
+
+ for f in ["./lnst-ctl", "./lnst-slave"]:
+ with open(f, 'r') as fin:
+ file_sum += fin.read()
+ fin.close()
+
+ md5 = hashlib.md5()
+ md5.update(file_sum)
+
+ return md5.hexdigest()
--
2.4.3