osmith has uploaded this change for review.

View Change

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
---
M scripts/obs/build_srcpkg.py
M scripts/obs/lib/docker.py
M scripts/obs/update_obs_project.py
3 files changed, 5 insertions(+), 6 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/99/29599/1
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 @@
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 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 @@
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 @@
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()

To view, visit change 29599. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ide78d976f9af445c4c8d8748bc274d7289064769
Gerrit-Change-Number: 29599
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-MessageType: newchange