From 1043e6ecc44d8bb48520dd287e2031c1b21adb66 Mon Sep 17 00:00:00 2001 From: James Graham Date: Mon, 5 Jun 2017 16:39:45 +0100 Subject: [PATCH] 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 --HG-- extra : rebase_source : f9d350018752f866052cf6a7a1ffd8f1d5f4ee39 --- testing/web-platform/mach_commands.py | 4 ++-- testing/web-platform/manifestupdate.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/testing/web-platform/mach_commands.py b/testing/web-platform/mach_commands.py index 3e61b3c13e87..fdc048feb7ef 100644 --- a/testing/web-platform/mach_commands.py +++ b/testing/web-platform/mach_commands.py @@ -299,12 +299,12 @@ testing/web-platform/tests for tests that may be shared 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(): diff --git a/testing/web-platform/manifestupdate.py b/testing/web-platform/manifestupdate.py index b1ddea94cc73..62791c594a82 100644 --- a/testing/web-platform/manifestupdate.py +++ b/testing/web-platform/manifestupdate.py @@ -18,12 +18,14 @@ 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"), @@ -39,13 +41,16 @@ def update(logger, wpt_dir, check_clean=True): 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