Bazel: add codeql specific packaging library

This encapsulate arch specific logic, local installation and separation
of zip files into generic and arch-specific parts as required by the
internal build.
This commit is contained in:
Paolo Tranquilli
2024-05-06 11:54:56 +02:00
parent 8ae607cdce
commit 60cf77be7e
8 changed files with 361 additions and 134 deletions

View File

@@ -0,0 +1,25 @@
import argparse
import pathlib
import shutil
import subprocess
from python.runfiles import runfiles
runfiles = runfiles.Create()
if not runfiles:
raise Exception("Installer should be run with `bazel run`")
parser = argparse.ArgumentParser()
parser.add_argument("--destdir", type=pathlib.Path, required=True)
parser.add_argument("--script", required=True)
parser.add_argument("--build-file", required=True)
opts = parser.parse_args()
script = runfiles.Rlocation(opts.script)
build_file = runfiles.Rlocation(opts.build_file)
destdir = pathlib.Path(build_file).parent / opts.destdir
if destdir.exists():
shutil.rmtree(destdir)
destdir.mkdir(parents=True)
subprocess.run([script, "--destdir", destdir], check=True)