diff options
author | Xander Neben <alexander.neben@mongodb.com> | 2023-05-03 21:58:30 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-03 23:23:01 +0000 |
commit | 90d04d2027cb7148a4dac3f67f21ced957583d59 (patch) | |
tree | d2ec365e63fb8f9cfc08daa532ef72acd13854ab /buildscripts | |
parent | aed68b23fdcf10abdf242e4351c140705026f626 (diff) | |
download | mongo-90d04d2027cb7148a4dac3f67f21ced957583d59.tar.gz |
SERVER-76812 Added eslint for arm64
Diffstat (limited to 'buildscripts')
-rwxr-xr-x | buildscripts/eslint.py | 21 | ||||
-rw-r--r-- | buildscripts/eslint/README.md | 18 |
2 files changed, 28 insertions, 11 deletions
diff --git a/buildscripts/eslint.py b/buildscripts/eslint.py index 58019284d9c..6e74eac8e1b 100755 --- a/buildscripts/eslint.py +++ b/buildscripts/eslint.py @@ -19,6 +19,7 @@ import sys import tarfile import tempfile import threading +import platform from typing import Optional import urllib.error import urllib.parse @@ -50,14 +51,17 @@ ESLINT_VERSION = "8.28.0" # Name of ESLint as a binary. ESLINT_PROGNAME = "eslint" +# Arch of running system +ARCH = platform.machine() if platform.machine() != "aarch64" else "arm64" + # URL location of our provided ESLint binaries. ESLINT_HTTP_LINUX_CACHE = "https://s3.amazonaws.com/boxes.10gen.com/build/eslint-" + \ - ESLINT_VERSION + "-linux.tar.gz" + ESLINT_VERSION + "-linux-" + ARCH + ".tar.gz" ESLINT_HTTP_DARWIN_CACHE = "https://s3.amazonaws.com/boxes.10gen.com/build/eslint-" + \ ESLINT_VERSION + "-darwin.tar.gz" # Path in the tarball to the ESLint binary. -ESLINT_SOURCE_TAR_BASE = string.Template(ESLINT_PROGNAME + "-$platform-$arch") +ESLINT_SOURCE_TAR_BASE = string.Template(ESLINT_PROGNAME + "-$operating_system-$arch") LOGGER = structlog.get_logger(__name__) @@ -76,15 +80,15 @@ def extract_eslint(tar_path, target_file): tarfp.close() -def get_eslint_from_cache(dest_file, platform, arch): +def get_eslint_from_cache(dest_file, operating_system, arch): """Get ESLint binary from mongodb's cache.""" # Get URL - if platform == "Linux": + if operating_system == "Linux": url = ESLINT_HTTP_LINUX_CACHE - elif platform == "Darwin": + elif operating_system == "Darwin": url = ESLINT_HTTP_DARWIN_CACHE else: - raise ValueError('ESLint is not available as a binary for ' + platform) + raise ValueError('ESLint is not available as a binary for ' + operating_system) dest_dir = tempfile.gettempdir() temp_tar_file = os.path.join(dest_dir, "temp.tar.gz") @@ -94,7 +98,8 @@ def get_eslint_from_cache(dest_file, platform, arch): urllib.request.urlretrieve(url, temp_tar_file) print("Extracting ESLint %s to %s" % (ESLINT_VERSION, dest_file)) - eslint_distfile = ESLINT_SOURCE_TAR_BASE.substitute(platform=platform, arch=arch) + eslint_distfile = ESLINT_SOURCE_TAR_BASE.substitute(operating_system=operating_system, + arch=arch) extract_eslint(temp_tar_file, eslint_distfile) shutil.move(eslint_distfile, dest_file) @@ -108,7 +113,7 @@ class ESLint(object): # Initialize ESLint configuration information if sys.platform.startswith("linux"): - self.arch = "x86_64" + self.arch = ARCH self.tar_path = None elif sys.platform == "darwin": self.arch = "x86_64" diff --git a/buildscripts/eslint/README.md b/buildscripts/eslint/README.md index ea0d7fc3ae7..bba2f46862d 100644 --- a/buildscripts/eslint/README.md +++ b/buildscripts/eslint/README.md @@ -21,10 +21,12 @@ "pkg": { "scripts": [ "conf/**/*", "lib/**/*", "messages/**/*" ], "targets": [ "linux-x64", "macos-x64" ] + # "targets": [ "linux-arm" ] }, ``` 6. Run pkg command to make ESLint executables. ``` + npm install pkg . ``` 7. Check that executables are working. @@ -38,6 +40,10 @@ ``` eslint-macos --help ``` + or (if you are on arm) + ``` + eslint --help + ``` (*) If executable fails to find some .js files there are [extra steps](#extra-steps) required to be done before step 6. @@ -48,19 +54,25 @@ Rename produced files. ``` mv eslint-linux eslint-Linux-x86_64 mv eslint-macos eslint-Darwin-x86_64 +# arm +# mv eslint eslint-Linux-arm64 ``` -Archive files. +Archive files. (No leading v in version e.g. 8.28.0 NOT v8.28.0) ``` -tar -czvf eslint-${version}-linux.tar.gz eslint-Linux-x86_64 +tar -czvf eslint-${version}-linux-x86_64.tar.gz eslint-Linux-x86_64 tar -czvf eslint-${version}-darwin.tar.gz eslint-Darwin-x86_64 +# arm +# tar -czvf eslint-${version}-linux-arm64.tar.gz eslint-Linux-arm64 ``` ### Upload archives to `boxes.10gen.com` Archives should be available by the following links: ``` -https://s3.amazonaws.com/boxes.10gen.com/build/eslint-${version}-linux.tar.gz +https://s3.amazonaws.com/boxes.10gen.com/build/eslint-${version}-linux-x86_64.tar.gz https://s3.amazonaws.com/boxes.10gen.com/build/eslint-${version}-darwin.tar.gz +# arm +# https://s3.amazonaws.com/boxes.10gen.com/build/eslint-${version}-linux-arm64.tar.gz ``` Build team has an access to do that. You can create a build ticket in Jira for them to do it |