Skip to content

Commit a47cf71

Browse files
committed
build: add git folder to safe.directory to avoid error
To make sure the git describe command works, we need to add the current folder to safe.directory. Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
1 parent 1c52007 commit a47cf71

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

build-aux/release

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@
44
# SPDX-License-Identifier: GPL-2.0-or-later
55

66
import datetime
7+
import os
78
import subprocess
89

910

1011
def run(*args):
11-
return subprocess.check_output(args).decode().strip()
12+
out = None
13+
try:
14+
out = subprocess.check_output(args, stderr=subprocess.STDOUT).decode().strip()
15+
except subprocess.CalledProcessError as e:
16+
print(f"Error running command: {' '.join(args)}")
17+
print(f"Output: {e.output}")
18+
return out
1219

1320

1421
# Get a human readable name of this commit:
1522
# - build from tag: v2.4.5
1623
# - build without a tag: v2.4.5-3-gc238eff
24+
run("git", "config", "--global", "--add", "safe.directory", os.getcwd())
1725
commit_name = run("git", "describe", "--tags", "--match", "v[0-9]*")
1826

1927
if "-" in commit_name:

0 commit comments

Comments
 (0)