Skip to content

Commit e4233e7

Browse files
committed
refactor: update type hints and improve docker run user permissions
1 parent e74ab5d commit e4233e7

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

building/linux/build-packages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ for distro in Fedora openSUSE; do
8989
# Move to ../bin/${distro}
9090
mkdir -p ${OUTDIR} # Ensure output dir exists
9191
cp ${TOP}/rpm-${distro_lower}/RPMS/x86_64/udsactor${kind}*.rpm ${OUTDIR}/
92-
rpm --addsign ${OUTDIR}/udsactor${kind}*.rpm
92+
# rpm --addsign ${OUTDIR}/udsactor${kind}*.rpm
9393
done
9494
done
9595

building/linux/rustbuilder.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import sys
88
import subprocess
99
import pathlib
10-
import typing
1110
import argparse
1211

1312
# === Type aliases ===
@@ -20,7 +19,7 @@ def get_target_path(crate_path: PathLike, debug: bool) -> pathlib.Path:
2019
return crate_path / "target" / ("debug" if debug else "release")
2120

2221

23-
def get_builders() -> typing.List[str]:
22+
def get_builders() -> list[str]:
2423
"""Get the list of available builders (distros)."""
2524
builders_dir = pathlib.Path("builders")
2625
return [d.name for d in builders_dir.iterdir() if d.is_dir()]
@@ -79,10 +78,26 @@ def docker_image_exists(image: str) -> bool:
7978
return result.returncode == 0
8079

8180

82-
def docker_run(crate_path: pathlib.Path, image: str, command: typing.List[str]) -> None:
81+
def docker_run(crate_path: pathlib.Path, image: str, command: list[str]) -> None:
8382
"""Run a command inside Docker."""
83+
uid = os.getuid()
84+
gid = os.getgid()
85+
8486
subprocess.run(
85-
["docker", "run", "--rm", "-v", f"{crate_path}:/crate", "-w", "/crate", image] + command, check=True
87+
[
88+
"docker",
89+
"run",
90+
"--rm",
91+
"--user",
92+
f"{uid}:{gid}",
93+
"-v",
94+
f"{crate_path}:/crate",
95+
"-w",
96+
"/crate",
97+
image,
98+
]
99+
+ command,
100+
check=True,
86101
)
87102

88103

0 commit comments

Comments
 (0)