aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStevan Radakovic <stevan.radakovic@linaro.org>2012-08-21 10:08:34 +0200
committerStevan Radakovic <stevan.radakovic@linaro.org>2012-08-21 10:08:34 +0200
commitdf7e1f5094d12d0648affeaf9c7dbcf9801619c3 (patch)
tree04bb21571fd1f5aa089c7ed44a5c4d2d6d90b4fc /scripts
parent3869e35dc8f1a088626dd6269332101c270db460 (diff)
Add validation script to discover non protected dirs.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/validation.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/validation.py b/scripts/validation.py
new file mode 100644
index 0000000..7a544b4
--- /dev/null
+++ b/scripts/validation.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# Print the list of build directories with no license protection.
+
+import sys
+import os
+
+
+class Validation():
+
+ LICENSE_FILE_LIST = [
+ "EULA.txt",
+ "OPEN-EULA.txt",
+ "BUILD-INFO.txt",
+ ]
+
+ def __init__(self):
+ pass
+
+ @classmethod
+ def find_non_protected_dirs(cls, rootdir):
+
+ non_handled_dirs = []
+
+ for root, subFolders, files in os.walk(rootdir):
+
+ for dir in subFolders:
+ dir_path = os.path.join(root, dir)
+ has_build = False
+ for fname in os.listdir(dir_path):
+ if os.path.isfile(os.path.join(dir_path, fname)):
+ if "gz" in os.path.splitext(fname)[1] or \
+ "bz2" in os.path.splitext(fname)[1]:
+ has_build = True
+ break
+ if has_build:
+ if not cls.has_license_handling(dir_path):
+ non_handled_dirs.append(dir_path)
+
+ return non_handled_dirs
+
+ @classmethod
+ def has_license_handling(cls, dir_path):
+ for fname in os.listdir(dir_path):
+ if os.path.isfile(os.path.join(dir_path, fname)):
+ for mode in cls.LICENSE_FILE_LIST:
+ if mode in fname:
+ return True
+ return False
+
+if __name__ == '__main__':
+
+ result_dirs = Validation.find_non_protected_dirs(sys.argv[1])
+ for dir in result_dirs:
+ print dir