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
This commit is contained in:
James Graham 2017-06-05 16:39:45 +01:00
Родитель 1f73453256
Коммит 1043e6ecc4
2 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -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():

Просмотреть файл

@ -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