Skip to content

Commit

Permalink
Rearrange megazord archive to allow multiple targets for the same OS
Browse files Browse the repository at this point in the history
e.g. `aarch64-unknown-linux-gnu/libnimbus_experimenter.so` can now co-exist alongside `x86-unknown-linux-gnu/libnimbus_experimenter.so`.

The detect script has changed to identify the correct name and path of the shared object.
  • Loading branch information
jhugman committed Oct 11, 2023
1 parent 73890de commit c18ff08
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions taskcluster/scripts/server-megazord-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ def main():
if _target_matches_host(target):
_run_python_tests(megazord, dist_dir)

_prepare_artifact(megazord, target, filename, dist_dir)

if str(out_dir) != str(PATH_NOT_SPECIFIED):
os.makedirs(out_dir, exist_ok=True)
_prepare_artifact(megazord, target, filename, dist_dir, out_dir)
_create_artifact(megazord, target, dist_dir, out_dir)
finally:
if not DEBUG:
temp_dir.cleanup()
Expand Down Expand Up @@ -78,7 +80,7 @@ def _build_shared_library(megazord, target, dist_dir):
elif "aarch64" in target:
env["CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER"] = "aarch64-linux-musl-gcc"

if target == "i686-pc-windows-gnu":
if target == "x86_64-pc-windows-gnu":
env["RUSTFLAGS"] = env.get("RUSTFLAGS", "") + " -C panic=abort"
elif target == 'aarch64-unknown-linux-gnu':
env["CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER"] = 'aarch64-linux-gnu-gcc'
Expand Down Expand Up @@ -160,8 +162,7 @@ def _python_tests(megazord):
def _dirs(prefix, list):
return [f'{prefix}/{f}' for f in list if os.path.isdir(f'{prefix}/{f}')]

def _prepare_artifact(megazord, target, filename, dist_dir, out_dir):
archive = out_dir / f'{megazord}-{target}.zip'
def _prepare_artifact(megazord, target, filename, dist_dir):
for f in _python_sources(megazord):
shutil.copytree(f, dist_dir)

Expand All @@ -176,6 +177,8 @@ def _prepare_artifact(megazord, target, filename, dist_dir, out_dir):
os.makedirs(scripts_dir, exist_ok=True)
shutil.copy(TARGET_DETECTOR_SCRIPT, scripts_dir)

def _create_artifact(megazord, target, dist_dir, out_dir):
archive = out_dir / f'{megazord}-{target}.zip'
subprocess.check_call([
'zip', archive,
'-r', '.',
Expand Down

0 comments on commit c18ff08

Please sign in to comment.