Skip to content

Commit

Permalink
generate-changes-list: import run_x helper
Browse files Browse the repository at this point in the history
  • Loading branch information
zeha committed Dec 19, 2024
1 parent 4efe0e9 commit 06d9f75
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions build-driver/generate-changes-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ def warn(self, message: str):
sys.stdout.write(f"W: {message}\n")


def run_x(args, check: bool = True, **kwargs):
# str-ify Paths, not necessary, but for readability in logs.
args = [arg if isinstance(arg, str) else str(arg) for arg in args]
args_str = '" "'.join(args)
print(f'D: Running "{args_str}"', flush=True)
return subprocess.run(args, check=check, **kwargs)


def parse_package_list(s: str) -> dict:
package_dict = {}
for line in s.split("\n"):
Expand Down Expand Up @@ -167,7 +175,7 @@ def fetch_grml_package_repo(git_repo_workspace: Path, package: str, git_url: str
gitpath = git_repo_workspace / f"{package}.git"
if not gitpath.exists():
env = dict(os.environ) | {"GIT_TERMINAL_PROMPT": "0"}
subprocess.run(
run_x(
["git", "clone", "--bare", "--single-branch", git_url, gitpath],
cwd=git_repo_workspace,
env=env,
Expand All @@ -176,8 +184,8 @@ def fetch_grml_package_repo(git_repo_workspace: Path, package: str, git_url: str
raise Exception("Repository not found")

# update repo
subprocess.run(["git", "remote", "set-url", "origin", git_url], cwd=gitpath)
subprocess.run(["git", "remote", "update", "--prune"], cwd=gitpath).check_returncode()
run_x(["git", "remote", "set-url", "origin", git_url], cwd=gitpath)
run_x(["git", "remote", "update", "--prune"], cwd=gitpath).check_returncode()
return gitpath


Expand Down

0 comments on commit 06d9f75

Please sign in to comment.