Bug 1369109 - Add --rebuild option to mach wpt-manifest-update, r=maja_zf
authorJames Graham <james@hoppipolla.co.uk>
Mon, 05 Jun 2017 16:39:45 +0100
changeset 411149 779cf4deec412fb33de2ce3765a595d02ba25002
parent 411148 b30457bfb195fd7abb1cb938cc4ca151112f6c5b
child 411150 8b399dd247e88710771137267070c66c7579800a
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf
bugs1369109
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369109 - Add --rebuild option to mach wpt-manifest-update, r=maja_zf This is required for cases where files have not changed but the manifest logic has changed. MozReview-Commit-ID: E46HtouILS2
testing/web-platform/mach_commands.py
testing/web-platform/manifestupdate.py
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -294,22 +294,22 @@ testing/web-platform/tests for tests tha
             wpt_kwargs = vars(p.parse_args(["--manifest-update", path]))
             context.commands.dispatch("web-platform-tests", context, **wpt_kwargs)
 
         if proc:
             proc.wait()
 
 
 class WPTManifestUpdater(MozbuildObject):
-    def run_update(self, check_clean=False, **kwargs):
+    def run_update(self, check_clean=False, rebuild=False, **kwargs):
         import manifestupdate
         from wptrunner import wptlogging
         logger = wptlogging.setup(kwargs, {"mach": sys.stdout})
         wpt_dir = os.path.abspath(os.path.join(self.topsrcdir, 'testing', 'web-platform'))
-        manifestupdate.update(logger, wpt_dir, check_clean)
+        manifestupdate.update(logger, wpt_dir, check_clean, rebuild)
 
 
 def create_parser_wpt():
     from wptrunner import wptcommandline
     return wptcommandline.create_parser(["firefox", "chrome", "edge", "servo"])
 
 def create_parser_update():
     from update import updatecommandline
--- a/testing/web-platform/manifestupdate.py
+++ b/testing/web-platform/manifestupdate.py
@@ -13,44 +13,49 @@ def do_delayed_imports(wpt_dir):
     global manifest
     sys.path.insert(0, os.path.join(wpt_dir, "tools", "manifest"))
     import manifest
 
 def create_parser():
     p = argparse.ArgumentParser()
     p.add_argument("--check-clean", action="store_true",
                    help="Check that updating the manifest doesn't lead to any changes")
+    p.add_argument("--rebuild", action="store_true",
+                   help="Rebuild the manifest from scratch")
     commandline.add_logging_group(p)
 
     return p
 
 
-def update(logger, wpt_dir, check_clean=True):
+def update(logger, wpt_dir, check_clean=True, rebuild=False):
     localpaths = imp.load_source("localpaths",
                                  os.path.join(wpt_dir, "tests", "tools", "localpaths.py"))
     kwargs = {"config": os.path.join(wpt_dir, "wptrunner.ini"),
               "tests_root": None,
               "metadata_root": None}
 
     set_from_config(kwargs)
     config = kwargs["config"]
     test_paths = get_test_paths(config)
 
     do_delayed_imports(wpt_dir)
 
     if check_clean:
         return _check_clean(logger, test_paths)
 
-    return _update(logger, test_paths)
+    return _update(logger, test_paths, rebuild)
 
 
-def _update(logger, test_paths):
+def _update(logger, test_paths, rebuild):
     for url_base, paths in test_paths.iteritems():
         manifest_path = os.path.join(paths["metadata_path"], "MANIFEST.json")
-        m = manifest.manifest.load(paths["tests_path"], manifest_path)
+        if rebuild:
+            m = manifest.manifest.Manifest(url_base)
+        else:
+            m = manifest.manifest.load(paths["tests_path"], manifest_path)
         manifest.update.update(paths["tests_path"], m, working_copy=True)
         manifest.manifest.write(m, manifest_path)
     return 0
 
 
 def _check_clean(logger, test_paths):
     manifests_by_path = {}
     rv = 0