mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1792627: Use mach vendor-based updating for irregexp r=iain
Differential Revision: https://phabricator.services.mozilla.com/D158289
This commit is contained in:
parent
8223234122
commit
6c0ad1d35d
@ -1,2 +0,0 @@
|
||||
Imported using import-irregexp.py from:
|
||||
https://github.com/v8/v8/tree/adb5e163ac6356bf2e39891de6a46e0e49709836/src/regexp
|
26
js/src/irregexp/LICENSE.v8
Normal file
26
js/src/irregexp/LICENSE.v8
Normal file
@ -0,0 +1,26 @@
|
||||
Copyright 2006-2011, the V8 project authors. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
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.
|
@ -27,21 +27,11 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def get_hash(path):
|
||||
# Get the hash for the current git revision
|
||||
cwd = os.getcwd()
|
||||
os.chdir(path)
|
||||
command = ["git", "rev-parse", "HEAD"]
|
||||
result = subprocess.check_output(command, encoding="utf-8")
|
||||
os.chdir(cwd)
|
||||
return result.rstrip()
|
||||
|
||||
|
||||
def copy_and_update_includes(src_path, dst_path):
|
||||
# List of header files that need to include the shim header
|
||||
need_shim = [
|
||||
@ -113,12 +103,6 @@ def import_from(srcdir, dstdir):
|
||||
continue
|
||||
copy_and_update_includes(file, dstdir / "imported" / file.name)
|
||||
|
||||
# Update IRREGEXP_VERSION file
|
||||
hash = get_hash(srcdir)
|
||||
version_file = open(str(dstdir / "IRREGEXP_VERSION"), "w")
|
||||
version_file.write("Imported using import-irregexp.py from:\n")
|
||||
version_file.write("https://github.com/v8/v8/tree/%s/src/regexp\n" % hash)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
@ -131,21 +115,42 @@ if __name__ == "__main__":
|
||||
raise RuntimeError("%s must be run from %s" % (sys.argv[0], expected_path))
|
||||
|
||||
parser = argparse.ArgumentParser(description="Import irregexp from v8")
|
||||
parser.add_argument("-p", "--path", help="path to v8/src/regexp")
|
||||
parser.add_argument("-p", "--path", help="path to v8/src/regexp", required=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.path:
|
||||
src_path = Path(args.path)
|
||||
provided_path = "the command-line"
|
||||
elif "TASK_ID" in os.environ:
|
||||
src_path = Path("/builds/worker/v8/")
|
||||
subprocess.run("git pull origin master", shell=True, cwd=src_path)
|
||||
|
||||
if not (src_path / "regexp.h").exists():
|
||||
print("Usage:\n import-irregexp.py --path <path/to/v8/src/regexp>")
|
||||
sys.exit(1)
|
||||
import_from(src_path, current_path)
|
||||
sys.exit(0)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
src_path = Path("/builds/worker/v8/src/regexp")
|
||||
provided_path = "the hardcoded path in the taskcluster image"
|
||||
elif "V8_GIT" in os.environ:
|
||||
src_path = Path(os.environ["V8_GIT"])
|
||||
provided_path = "the V8_GIT environment variable"
|
||||
else:
|
||||
tempdir = tempfile.TemporaryDirectory()
|
||||
v8_git = "https://github.com/v8/v8.git"
|
||||
clone = "git clone --depth 1 %s %s" % (v8_git, tempdir)
|
||||
clone = "git clone --depth 1 %s %s" % (v8_git, tempdir.name)
|
||||
os.system(clone)
|
||||
src_path = Path(tempdir) / "src/regexp"
|
||||
import_from(src_path, current_path)
|
||||
src_path = Path(tempdir.name) / "src/regexp"
|
||||
provided_path = "the temporary git checkout"
|
||||
|
||||
if not (src_path / "regexp.h").exists():
|
||||
print("Could not find regexp.h in the path provided from", provided_path)
|
||||
print("Usage:\n import-irregexp.py [--path <path/to/v8/src/regexp>]")
|
||||
sys.exit(1)
|
||||
|
||||
if "MACH_VENDOR" not in os.environ:
|
||||
print(
|
||||
"Running this script outside ./mach vendor is not recommended - ",
|
||||
"You will need to update moz.yaml manually",
|
||||
)
|
||||
print("We recommend instead `./mach vendor js/src/irregexp/moz.yaml`")
|
||||
response = input("Type Y to continue... ")
|
||||
if response.lower() != "y":
|
||||
sys.exit(1)
|
||||
|
||||
import_from(src_path, current_path)
|
||||
|
27
js/src/irregexp/moz.yaml
Normal file
27
js/src/irregexp/moz.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
schema: 1
|
||||
|
||||
bugzilla:
|
||||
product: Core
|
||||
component: "JavaScript Engine"
|
||||
|
||||
origin:
|
||||
name: irregexp
|
||||
description: A fast regular expression engine from V8
|
||||
url: https://v8.dev
|
||||
|
||||
release: adb5e163ac6356bf2e39891de6a46e0e49709836
|
||||
revision: adb5e163ac6356bf2e39891de6a46e0e49709836
|
||||
|
||||
license: BSD-3-Clause
|
||||
license-file: LICENSE.v8
|
||||
|
||||
vendoring:
|
||||
url: https://chromium.googlesource.com/v8/v8.git
|
||||
source-hosting: googlesource
|
||||
vendor-directory: js/src/irregexp/
|
||||
skip-vendoring-steps: ['fetch', 'move-contents']
|
||||
|
||||
update-actions:
|
||||
- action: run-script
|
||||
script: 'import-irregexp.py'
|
||||
cwd: '{yaml_dir}'
|
@ -601,6 +601,8 @@ class VendorManifest(MozbuildObject):
|
||||
if "GECKO_PATH" not in os.environ
|
||||
else {}
|
||||
)
|
||||
# We also add a signal to scripts that they are running under mach vendor
|
||||
extra_env["MACH_VENDOR"] = "1"
|
||||
self.run_process(
|
||||
args=[command] + args,
|
||||
cwd=run_dir,
|
||||
|
Loading…
Reference in New Issue
Block a user