Title: [175798] trunk/Tools
Revision
175798
Author
[email protected]
Date
2014-11-09 22:11:47 -0800 (Sun, 09 Nov 2014)

Log Message

make-passwords-json.py should generarate everything needed for testing
https://bugs.webkit.org/show_bug.cgi?id=138503

Reviewed by Ryosuke Niwa.

* BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py:
Renamed from make-passwords-json.py to be able included from mastercfg_unittest.py.
Additionally generate auth.json, credentials.cfg and committers.cfg too.
(create_mock_slave_passwords_dict): Moved from mastercfg_unittest.py
* BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py:
(BuildBotConfigLoader._mock_open): Use make_passwords_json.create_mock_slave_passwords_dict() to avoid duplication.
(BuildBotConfigLoader._create_mock_passwords_dict): Deleted.

Modified Paths

Added Paths

Removed Paths

Diff

Deleted: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make-passwords-json.py (175797 => 175798)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make-passwords-json.py	2014-11-10 05:48:35 UTC (rev 175797)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make-passwords-json.py	2014-11-10 06:11:47 UTC (rev 175798)
@@ -1,12 +0,0 @@
-#!/usr/bin/python
-
-import json
-
-with open('config.json', 'r') as config_file:
-    config = json.load(config_file)
-    passwords = {}
-    for slave in config['slaves']:
-        passwords[slave['name']] = 'a'
-
-with open('passwords.json', 'w') as passwords_file:
-    passwords_file.write(json.dumps(passwords))

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py (0 => 175798)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py	2014-11-10 06:11:47 UTC (rev 175798)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2011 Apple Inc. All rights reserved.
+# Copyright (C) 2014 University of Szeged. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import json
+import md5
+
+
+def create_mock_slave_passwords_dict():
+    with open('config.json', 'r') as config_json:
+        config_dict = json.load(config_json)
+    return dict([(slave['name'], '1234') for slave in config_dict['slaves']])
+
+if __name__ == '__main__':
+    with open('passwords.json', 'w') as passwords_file:
+        passwords_file.write(json.dumps(create_mock_slave_passwords_dict(), indent=4, sort_keys=True))
+
+    with open('auth.json', 'w') as auth_json_file:
+        auth_json_file.write("""{
+    "trac_credentials": "credentials.cfg",
+    "webkit_committers": "committers.cfg"
+}""")
+
+    with open('credentials.cfg', 'w') as credentials_file:
+        credentials_file.write("[email protected]:Mac OS Forge:%s" % md5.new("[email protected]:Mac OS Forge:committerpassword").hexdigest())
+
+    with open('committers.cfg', 'w') as committers_file:
+        committers_file.write("""[groups]
+webkit = [email protected]
+""")
Property changes on: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py
___________________________________________________________________

Added: svn:executable

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py (175797 => 175798)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py	2014-11-10 05:48:35 UTC (rev 175797)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py	2014-11-10 06:11:47 UTC (rev 175798)
@@ -4,6 +4,8 @@
 import os
 import StringIO
 import unittest
+import make_passwords_json
+import json
 
 # Show DepricationWarnings come from buildbot - it isn't default with Python 2.7 or newer.
 # See https://bugs.webkit.org/show_bug.cgi?id=90161 for details.
@@ -20,13 +22,9 @@
         scripts_dir = os.path.join(webkit_tools_dir, 'Scripts')
         sys.path.append(scripts_dir)
 
-    def _create_mock_passwords_dict(self):
-        config_dict = json.load(open('config.json'))
-        return dict([(slave['name'], '1234') for slave in config_dict['slaves']])
-
     def _mock_open(self, filename):
         if filename == 'passwords.json':
-            return StringIO.StringIO(json.dumps(self._create_mock_passwords_dict()))
+            return StringIO.StringIO(json.dumps(make_passwords_json.create_mock_slave_passwords_dict()))
         return __builtins__.open(filename)
 
     def _add_dependant_modules_to_sys_modules(self):

Modified: trunk/Tools/ChangeLog (175797 => 175798)


--- trunk/Tools/ChangeLog	2014-11-10 05:48:35 UTC (rev 175797)
+++ trunk/Tools/ChangeLog	2014-11-10 06:11:47 UTC (rev 175798)
@@ -1,3 +1,18 @@
+2014-11-09  Csaba Osztrogonác  <[email protected]>
+
+        make-passwords-json.py should generarate everything needed for testing
+        https://bugs.webkit.org/show_bug.cgi?id=138503
+
+        Reviewed by Ryosuke Niwa.
+
+        * BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py:
+        Renamed from make-passwords-json.py to be able included from mastercfg_unittest.py.
+        Additionally generate auth.json, credentials.cfg and committers.cfg too.
+        (create_mock_slave_passwords_dict): Moved from mastercfg_unittest.py
+        * BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py:
+        (BuildBotConfigLoader._mock_open): Use make_passwords_json.create_mock_slave_passwords_dict() to avoid duplication.
+        (BuildBotConfigLoader._create_mock_passwords_dict): Deleted.
+
 2014-11-09  Carlos Garcia Campos  <[email protected]>
 
         [GTK] generate-gtkdoc should ignore invalid files
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to