Title: [197027] trunk
Revision
197027
Author
youenn.fab...@crf.canon.fr
Date
2016-02-24 04:14:30 -0800 (Wed, 24 Feb 2016)

Log Message

W3C importer should generate all web-platform-tests submodules descriptions
https://bugs.webkit.org/show_bug.cgi?id=154587

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* resources/TestRepositories: Reactivated submodules description generation.
* resources/web-platform-tests-modules.json: Updated according modified scripts.

Tools:

Updated submodules description format (removing submodule name as it is the last string of the path really).
Added git subroutines.

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.origin_url):
(Git):
(Git.init_submodules):
(Git.submodules_status):
(Git.deinit_submodules):
* Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
(WebPlatformTestServer._install_modules): Updated to submodule name removal.
* Scripts/webkitpy/w3c/test_downloader.py:
(TestDownloader._git_submodules_description): Updated to cope with recursive submodules (use of submodule init/deinit).
* Scripts/webkitpy/w3c/test_importer_unittest.py:
(TestImporterTest.test_submodules_generation): Reactivated partially this test.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (197026 => 197027)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-24 12:14:30 UTC (rev 197027)
@@ -1,3 +1,13 @@
+2016-02-24  Youenn Fablet  <youenn.fab...@crf.canon.fr>
+
+        W3C importer should generate all web-platform-tests submodules descriptions
+        https://bugs.webkit.org/show_bug.cgi?id=154587
+
+        Reviewed by Darin Adler.
+
+        * resources/TestRepositories: Reactivated submodules description generation.
+        * resources/web-platform-tests-modules.json: Updated according modified scripts.
+
 2016-02-23  Chris Dumez  <cdu...@apple.com>
 
         [Reflected] IDL attributes of integer types should use HTML rules for parsing integers

Modified: trunk/LayoutTests/imported/w3c/resources/TestRepositories (197026 => 197027)


--- trunk/LayoutTests/imported/w3c/resources/TestRepositories	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/LayoutTests/imported/w3c/resources/TestRepositories	2016-02-24 12:14:30 UTC (rev 197027)
@@ -30,6 +30,6 @@
             "config.default.json",
             "serve.py"
         ],
-        "import_options": []
+        "import_options": ["generate_git_submodules_description"]
     }
 ]

Modified: trunk/LayoutTests/imported/w3c/resources/web-platform-tests-modules.json (197026 => 197027)


--- trunk/LayoutTests/imported/w3c/resources/web-platform-tests-modules.json	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/LayoutTests/imported/w3c/resources/web-platform-tests-modules.json	2016-02-24 12:14:30 UTC (rev 197027)
@@ -1,58 +1,77 @@
 [
     {
-        "name": "resources", 
         "path": [
-            "."
+            "resources"
         ], 
-        "url": "https://github.com/w3c/testharness.js/archive/698441212391d5177b2f1806d97c7fd15cc46715.tar.gz",
+        "url": "https://github.com/w3c/testharness.js/archive/698441212391d5177b2f1806d97c7fd15cc46715.tar.gz", 
         "url_subpath": "testharness.js-698441212391d5177b2f1806d97c7fd15cc46715"
     }, 
     {
-        "name": "webidl2",
         "path": [
-            "resources"
-        ],
-        "url": "https://github.com/darobin/webidl2.js/archive/bd216bcd5596d60734450adc938155deab1e1a80.tar.gz",
+            "resources", 
+            "webidl2"
+        ], 
+        "url": "https://github.com/darobin/webidl2.js/archive/bd216bcd5596d60734450adc938155deab1e1a80.tar.gz", 
         "url_subpath": "webidl2.js-bd216bcd5596d60734450adc938155deab1e1a80"
-    },
+    }, 
     {
-        "name": "tools", 
         "path": [
-            "."
+            "resources", 
+            "webidl2", 
+            "test", 
+            "widlproc"
         ], 
+        "url": "https://github.com/dontcallmedom/widlproc/archive/4ef8dde69c0ba3d0167bccfa2775eea7f0d6c7fe.tar.gz", 
+        "url_subpath": "widlproc-4ef8dde69c0ba3d0167bccfa2775eea7f0d6c7fe"
+    }, 
+    {
+        "path": [
+            "tools"
+        ], 
         "url": "https://github.com/w3c/wpt-tools/archive/80bc792988aff1422f43b9e1d5909673eca960a2.tar.gz", 
         "url_subpath": "wpt-tools-80bc792988aff1422f43b9e1d5909673eca960a2"
-    },
+    }, 
     {
-        "name": "html5lib", 
         "path": [
-            "tools"
+            "tools", 
+            "html5lib"
         ], 
         "url": "https://github.com/html5lib/html5lib-python/archive/7cce65bbaa78411f98b8b37eeefc9db03c580097.tar.gz", 
         "url_subpath": "html5lib-python-7cce65bbaa78411f98b8b37eeefc9db03c580097"
     }, 
     {
-        "name": "pywebsocket", 
         "path": [
-            "tools"
+            "tools", 
+            "html5lib", 
+            "html5lib", 
+            "tests", 
+            "testdata"
         ], 
+        "url": "https://github.com/html5lib/html5lib-tests/archive/a9badff0cd2fe337170769d42ca2df5e96d30f97.tar.gz", 
+        "url_subpath": "html5lib-tests-a9badff0cd2fe337170769d42ca2df5e96d30f97"
+    }, 
+    {
+        "path": [
+            "tools", 
+            "pywebsocket"
+        ], 
         "url": "https://github.com/w3c/pywebsocket/archive/8c285d9015121e8c1c40be852439fc03b4a18112.tar.gz", 
         "url_subpath": "pywebsocket-8c285d9015121e8c1c40be852439fc03b4a18112"
     }, 
     {
-        "name": "six", 
         "path": [
-            "tools"
+            "tools", 
+            "six"
         ], 
         "url": "https://github.com/jgraham/six/archive/3b6173c833d217ab0186c355804f5925cbcfca47.tar.gz", 
         "url_subpath": "six-3b6173c833d217ab0186c355804f5925cbcfca47"
-    },
+    }, 
     {
-        "name": "wptserve", 
         "path": [
-            "tools"
+            "tools", 
+            "wptserve"
         ], 
         "url": "https://github.com/w3c/wptserve/archive/b12d799c0be4fab1055df9a1e4dd5e45646b46ea.tar.gz", 
         "url_subpath": "wptserve-b12d799c0be4fab1055df9a1e4dd5e45646b46ea"
     }
-]
+]
\ No newline at end of file

Modified: trunk/Tools/ChangeLog (197026 => 197027)


--- trunk/Tools/ChangeLog	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/Tools/ChangeLog	2016-02-24 12:14:30 UTC (rev 197027)
@@ -1,3 +1,26 @@
+2016-02-24  Youenn Fablet  <youenn.fab...@crf.canon.fr>
+
+        W3C importer should generate all web-platform-tests submodules descriptions
+        https://bugs.webkit.org/show_bug.cgi?id=154587
+
+        Reviewed by Darin Adler.
+
+        Updated submodules description format (removing submodule name as it is the last string of the path really).
+        Added git subroutines.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.origin_url):
+        (Git):
+        (Git.init_submodules):
+        (Git.submodules_status):
+        (Git.deinit_submodules):
+        * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
+        (WebPlatformTestServer._install_modules): Updated to submodule name removal.
+        * Scripts/webkitpy/w3c/test_downloader.py:
+        (TestDownloader._git_submodules_description): Updated to cope with recursive submodules (use of submodule init/deinit).
+        * Scripts/webkitpy/w3c/test_importer_unittest.py:
+        (TestImporterTest.test_submodules_generation): Reactivated partially this test.
+
 2016-02-23  Dan Bernstein  <m...@apple.com>
 
         [Xcode] Linker errors display mangled names, but no longer should

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (197026 => 197027)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2016-02-24 12:14:30 UTC (rev 197027)
@@ -480,6 +480,18 @@
         return self._run_git(['svn', 'blame', path])
 
     # Git-specific methods:
+    def origin_url(self):
+        return self._run_git(['config', '--get', 'remote.origin.url']).strip()
+
+    def init_submodules(self):
+        return self._run_git(['submodule', 'update', '--init', '--recursive'])
+
+    def submodules_status(self):
+        return self._run_git(['submodule', 'status', '--recursive'])
+
+    def deinit_submodules(self):
+        return self._run_git(['submodule', 'deinit', '-f', '.'])
+
     def _branch_ref_exists(self, branch_ref):
         return self._run_git(['show-ref', '--quiet', '--verify', branch_ref], return_exit_code=True) == 0
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py (197026 => 197027)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py	2016-02-24 12:14:30 UTC (rev 197027)
@@ -85,7 +85,9 @@
             return
         modules = json.loads(self._filesystem.read_text_file(modules_file_path))
         for module in modules:
-            AutoInstaller(target_dir=self._filesystem.join(self._doc_root, self._filesystem.sep.join(module["path"]))).install(url="" url_subpath=module["url_subpath"], target_name=module["name"])
+            path = module["path"]
+            name = path.pop()
+            AutoInstaller(target_dir=self._filesystem.join(self._doc_root, self._filesystem.sep.join(path))).install(url="" url_subpath=module["url_subpath"], target_name=name)
 
     def _copy_webkit_test_files(self):
         _log.debug('Copying WebKit resources files')

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_downloader.py (197026 => 197027)


--- trunk/Tools/Scripts/webkitpy/w3c/test_downloader.py	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_downloader.py	2016-02-24 12:14:30 UTC (rev 197027)
@@ -154,42 +154,31 @@
             elif self._filesystem.isdir(destination_path):
                 self._filesystem.rmtree(destination_path)
 
-    def _git_submodules_status(self, repository_directory):
-        return self.git(repository_directory)._run_git(['submodule', 'status'])
-
     def _git_submodules_description(self, test_repository):
+        directory = self._filesystem.join(self.repository_directory, test_repository['name'])
+
+        git = self.git(directory)
+        git.init_submodules()
+
         submodules = []
-        repository_directory = self._filesystem.join(self.repository_directory, test_repository['name'])
-        if self._filesystem.isfile(self._filesystem.join(repository_directory, '.gitmodules')):
+        submodules_status = [line.strip().split(' ') for line in git.submodules_status().splitlines()]
+        for status in submodules_status:
+            version = status[0]
+            path = status[1].split('/')
+
+            url = "" status[1])).origin_url()
+            if not url.startswith('https://github.com/'):
+                _log.warning('Submodule %s (%s) is not hosted on github' % (status[1], url))
+                _log.warning('Please ensure that generated URL points to an archive of the module or manually edit its value after the import')
+            url = ""  # to remove .git
+
             submodule = {}
-            for line in self._filesystem.read_text_file(self._filesystem.join(repository_directory, '.gitmodules')).splitlines():
-                line = line.strip()
-                if line.startswith('path = '):
-                    submodule['path'] = line[7:]
-                elif line.startswith('url = ''url'] = line[6:]
-                    if not submodule['url'].startswith('https://github.com/'):
-                        _log.warning('Submodule %s is not hosted on github' % submodule['path'])
-                        _log.warning('Please ensure that generated URL points to an archive of the module or manually edit its value after the import')
-                    submodules.append(submodule)
-                    submodule = {}
+            submodule['path'] = path
+            submodule['url'] = url + '/archive/' + version + '.tar.gz'
+            submodule['url_subpath'] = url.split('/').pop() + '-' + version
+            submodules.append(submodule)
 
-        submodules_status = [line[1:].split(' ') for line in self._git_submodules_status(repository_directory).splitlines()]
-        for submodule in submodules:
-            for status in submodules_status:
-                if submodule['path'] == status[1]:
-                    url = ""
-                    version = status[0]
-                    repository_name = url.split('/').pop()
-                    submodule['url'] = url + '/archive/' + version + '.tar.gz'
-                    submodule['url_subpath'] = repository_name + '-' + version
-            if '/' in submodule['path']:
-                steps = submodule['path'].split('/')
-                submodule['name'] = steps.pop()
-                submodule['path'] = steps
-            else:
-                submodule['name'] = submodule['path']
-                submodule['path'] = ['.']
+        git.deinit_submodules()
         return submodules
 
     def generate_git_submodules_description(self, test_repository, filepath):

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py (197026 => 197027)


--- trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py	2016-02-24 12:11:15 UTC (rev 197026)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py	2016-02-24 12:14:30 UTC (rev 197027)
@@ -63,7 +63,7 @@
         "revision": "dd553279c3",
         "paths_to_skip": [],
         "paths_to_import": [],
-        "import_options": []
+        "import_options": ["generate_git_submodules_description"]
     }
 ]
 ''' }
@@ -159,9 +159,9 @@
         fs = self.import_downloaded_tests(['--no-fetch', '--import-all', '-d', 'w3c'], FAKE_FILES)
 
         self.assertFalse(fs.exists('/mock-checkout/LayoutTests/w3c/resources/csswg-tests-modules.json'))
-        # Disabling git modules json tests since wpt uses a module of modules for its tools, which are not supported yet by the import script.
-        self.assertFalse(fs.exists('/mock-checkout/LayoutTests/w3c/resources/web-platform-tests-modules.json'))
-        # self.assertFalse('https://github.com/w3c/testharness.js/archive/db4d391a69877d4a1eaaf51d1725c99a5b8ed84.tar.gz' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/resources/web-platform-tests-modules.json'))
+        self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/resources/web-platform-tests-modules.json'))
+        # FIXME: Mock-up of git cannot use submodule command, hence the json file is empty, but still it should be created
+        #self.assertTrue('https://github.com/w3c/testharness.js/archive/db4d391a69877d4a1eaaf51d1725c99a5b8ed84.tar.gz' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/resources/web-platform-tests-modules.json'))
 
     def test_tests_directory(self):
         FAKE_FILES = {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to