Skip to content
Snippets Groups Projects
Unverified Commit 500b0908 authored by Caleb Connolly's avatar Caleb Connolly :recycle:
Browse files

helpers: run: stop handling Arch in PathString (MR 2463)


This was always a hack, and it looks like there (hopefully) aren't any
placs where we still need to handle this.

Possibly expecting regressions... But then we have something to write a
test for.

Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
parent 41c8413f
No related branches found
No related tags found
1 merge request!2463Rework apk handling and always use apk.static
Pipeline #209486 failed
......@@ -3,7 +3,6 @@
import os
from pathlib import Path
import subprocess
from pmb.core.arch import Arch
import pmb.helpers.run_core
from collections.abc import Sequence
from typing import overload, Literal
......@@ -35,13 +34,8 @@ def user(
See pmb.helpers.run_core.core() for a detailed description of all other
arguments and the return value.
"""
cmd_parts = []
for c in cmd:
if isinstance(c, Arch):
c = str(c)
else:
c = os.fspath(c)
cmd_parts.append(c)
cmd_parts = [os.fspath(c) for c in cmd]
# Readable log message (without all the escaping)
msg = "% "
for key, value in env.items():
......
......@@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import fcntl
from pmb.core.context import get_context
from pmb.core.arch import Arch
from pmb.types import PathString, Env, RunOutputType
from pmb.helpers import logging
import os
......@@ -37,11 +36,7 @@ def flat_cmd(
cd /home/pmos;echo 'string with spaces'
"""
# Merge env and cmd into escaped list
escaped = []
for key, value in env.items():
if isinstance(value, Arch):
value = str(value)
escaped.append(key + "=" + shlex.quote(os.fspath(value)))
escaped = [f"{key}={shlex.quote(os.fspath(value))}" for key, value in env.items()]
for cmd in cmds:
for i in range(len(cmd)):
escaped.append(shlex.quote(os.fspath(cmd[i])))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment