You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/03/04 05:55:24 UTC

[1/2] trafficserver-qa git commit: Use MD5 hash to ID an environment

Repository: trafficserver-qa
Updated Branches:
  refs/heads/master 02f9b070f -> c04800889


Use MD5 hash to ID an environment


Project: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/commit/127fb83b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/tree/127fb83b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/diff/127fb83b

Branch: refs/heads/master
Commit: 127fb83b0f96f451049547da1a99d3c2c2180397
Parents: 02f9b07
Author: James Peach <jp...@apache.org>
Authored: Tue Mar 3 20:52:23 2015 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Mar 3 20:54:49 2015 -0800

----------------------------------------------------------------------
 tsqa/environment.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver-qa/blob/127fb83b/tsqa/environment.py
----------------------------------------------------------------------
diff --git a/tsqa/environment.py b/tsqa/environment.py
index 4c0c96e..4a01e01 100644
--- a/tsqa/environment.py
+++ b/tsqa/environment.py
@@ -23,6 +23,7 @@ import tsqa.utils
 import sys
 import time
 import multiprocessing
+import hashlib
 
 import tsqa.configs
 import tsqa.utils
@@ -116,13 +117,12 @@ class EnvironmentFactory(object):
         Take list of dicts and make a nice tuple list to use as a key
         take that and then hash it
         '''
-        key = []
+        hval = hashlib.md5()
         for arg in args:
-            sub_key = []
             for k in sorted(arg):
-                sub_key.append((k, arg[k]))
-            key.append(tuple(sub_key))
-        return str(hash(tuple(key)))  # return a string since JSON doesn't like ints as keys
+                hval.update(k)
+                hval.update(str(arg[k]))
+        return hval.hexdigest()
 
     def get_environment(self, configure=None, env=None):
         '''


[2/2] trafficserver-qa git commit: Add the config to the environment index for debugging

Posted by jp...@apache.org.
Add the config to the environment index for debugging


Project: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/commit/c0480088
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/tree/c0480088
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/diff/c0480088

Branch: refs/heads/master
Commit: c04800889b24435d2e5d07d9894fa33381d97cdd
Parents: 127fb83
Author: James Peach <jp...@apache.org>
Authored: Tue Mar 3 20:53:02 2015 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Mar 3 20:54:54 2015 -0800

----------------------------------------------------------------------
 tsqa/environment.py | 7 +++++--
 tsqa/utils.py       | 7 ++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver-qa/blob/c0480088/tsqa/environment.py
----------------------------------------------------------------------
diff --git a/tsqa/environment.py b/tsqa/environment.py
index 4a01e01..d170814 100644
--- a/tsqa/environment.py
+++ b/tsqa/environment.py
@@ -179,13 +179,16 @@ class EnvironmentFactory(object):
 
                 shutil.rmtree(builddir)  # delete builddir, not useful after install
                 # stash the env
-                self.environment_stash[key] = installdir
+                self.environment_stash[key] = {
+                        'path': installdir,
+                        'configuration': args
+                }
             except Exception as e:
                 EnvironmentFactory.negative_cache[key] = e
                 raise
 
         # create a layout
-        layout = Layout(self.environment_stash[key])
+        layout = Layout(self.environment_stash[key]['path'])
 
         # return an environment cloned from that layout
         ret = Environment()

http://git-wip-us.apache.org/repos/asf/trafficserver-qa/blob/c0480088/tsqa/utils.py
----------------------------------------------------------------------
diff --git a/tsqa/utils.py b/tsqa/utils.py
index 81efdb0..3224a4d 100644
--- a/tsqa/utils.py
+++ b/tsqa/utils.py
@@ -188,15 +188,16 @@ class BuildCache(MutableMapping):
         try:
             with open(self.cache_map_file) as fh:
                 cache = json.load(fh)
-        except IOError:
+        except IOError, ValueError:
+            # Just bail if the file is not there, is empty, or does not parse.
             return
 
         changed = False  # whether we changed the cache file, and need to write it out
         # verify that all of those directories exist, clean them out if they don't
         for source_hash, env_map in cache.items():
             # if the directory doesn't exist
-            for key, path in env_map.items():
-                if not os.path.isdir(path):
+            for key, entry in env_map.items():
+                if not os.path.isdir(entry['path']):
                     del cache[source_hash][key]
                     changed = True
             # if the source_hash level key is now empty