aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2022-09-27 12:17:56 +0200
committerosmith <osmith@sysmocom.de>2022-10-06 07:44:31 +0000
commit1816b47606e27ac5430ea66e65d0c55d9b8b1f68 (patch)
tree76b2e4c5be9b09d278b15a04f100d2d5bdcda286
parentb88200546a10bada933881688869a2589d94c3e8 (diff)
obs: run_in_docker_and_exit: no os.path.basename
Don't use os.path.basename on the script_path parameter passed to the function. A future patch will pass a script that is inside the data subdirectory to this function, therefore this is needed. Related: OS#2385 Change-Id: Ide78d976f9af445c4c8d8748bc274d7289064769
-rwxr-xr-xscripts/obs/build_srcpkg.py2
-rw-r--r--scripts/obs/lib/docker.py7
-rwxr-xr-xscripts/obs/update_obs_project.py2
3 files changed, 5 insertions, 6 deletions
diff --git a/scripts/obs/build_srcpkg.py b/scripts/obs/build_srcpkg.py
index 61d8d64..4c848b8 100755
--- a/scripts/obs/build_srcpkg.py
+++ b/scripts/obs/build_srcpkg.py
@@ -31,7 +31,7 @@ def main():
lib.set_cmds_verbose(args.verbose)
if args.docker:
- lib.docker.run_in_docker_and_exit(__file__)
+ lib.docker.run_in_docker_and_exit("build_srcpkg.py")
if not args.ignore_req:
lib.check_required_programs()
diff --git a/scripts/obs/lib/docker.py b/scripts/obs/lib/docker.py
index 0a1f748..0c5ec0f 100644
--- a/scripts/obs/lib/docker.py
+++ b/scripts/obs/lib/docker.py
@@ -40,7 +40,7 @@ def get_oscrc():
def run_in_docker_and_exit(script_path, add_oscrc=False,
image_type="build_srcpkg", distro=None):
"""
- :param script_path: what to run inside docker
+ :param script_path: what to run inside docker, relative to scripts/obs/
:param add_oscrc: put user's oscrc in docker (contains obs credentials!)
:param image_type: which Dockerfile to use (data/{image_type}.Dockerfile)
:param distro: which Linux distribution to use, e.g. "debian:11"
@@ -75,9 +75,8 @@ def run_in_docker_and_exit(script_path, add_oscrc=False,
if oscrc:
cmd += ["-v", f"{oscrc}:/home/user/.oscrc"]
- script_path = f"/obs/{os.path.basename(script_path)}"
- cmd += [image_name, script_path] + sys.argv[1:]
+ cmd += [image_name, f"/obs/{script_path}"] + sys.argv[1:]
- print(f"docker: running: {os.path.basename(script_path)} inside docker")
+ print(f"docker: running: {script_path} inside docker")
ret = subprocess.run(cmd)
exit(ret.returncode)
diff --git a/scripts/obs/update_obs_project.py b/scripts/obs/update_obs_project.py
index 58e5888..43748e9 100755
--- a/scripts/obs/update_obs_project.py
+++ b/scripts/obs/update_obs_project.py
@@ -202,7 +202,7 @@ def main():
lib.set_cmds_verbose(args.verbose)
if args.docker:
- lib.docker.run_in_docker_and_exit(__file__, True)
+ lib.docker.run_in_docker_and_exit("update_obs_project.py", True)
lib.osc.check_proj(proj)
lib.osc.check_oscrc()