Skip to content

Commit 9115e84

Browse files
authored
Merge pull request #1763 from larsewi/autogen-v2
autogen: use run_and_print_on_failure function
2 parents c754038 + 2a9959c commit 9115e84

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

build-scripts/autogen

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ case "$PROJECT" in
3232
;;
3333
*)
3434
if [ -z "${PROJECT}" ]; then
35-
echo "Error: Expected environment variable PROJECT=[community|nova]"
35+
echo "$(basename "$0"): Error: Expected environment variable PROJECT=[community|nova]"
3636
else
37-
echo "Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
37+
echo "$(basename "$0"): Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
3838
fi
3939
echo "Usage: PROJECT=[community|nova] $0"
4040
exit 42;;
@@ -52,7 +52,7 @@ fi
5252
for proj in $projects
5353
do
5454
if [ ! -d "$BASEDIR/$proj" ]; then
55-
echo "Error: Expected to find the '$proj' repository in '$BASEDIR', but it's not there"
55+
echo "$(basename "$0"): Error: Expected to find the '$proj' repository in '$BASEDIR', but it's not there"
5656
exit 1
5757
fi
5858
done
@@ -61,19 +61,11 @@ done
6161
for proj in $projects
6262
do
6363
# autogen.sh is quite verbose, so only print the output in case of failure
64-
echo "Running autogen.sh for project $proj..."
65-
temp_output_file=$(mktemp)
66-
if (cd "$BASEDIR/$proj" && NO_CONFIGURE=1 ./autogen.sh) > "$temp_output_file" 2>&1; then
67-
rm -f "$temp_output_file"
68-
else
69-
exit_code=$? # Store exit code for later
70-
echo "Error: failed to run autogen.sh ---"
71-
echo "--- Start of Output ---"
72-
cat "$temp_output_file"
73-
rm -f "$temp_output_file"
74-
echo "--- End of Output (Exit code: $exit_code) ---"
75-
exit $exit_code
76-
fi
64+
echo "$(basename "$0"): Debug: Running autogen.sh for project $proj..."
65+
(
66+
cd "$BASEDIR/$proj"
67+
NO_CONFIGURE=1 run_and_print_on_failure ./autogen.sh
68+
)
7769
done
7870

7971
# Create revision files (containing the N first hex decimals from the last

build-scripts/compare-versions

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ case "$PROJECT" in
3232
;;
3333
*)
3434
if [ -z "${PROJECT}" ]; then
35-
echo "Error: Expected environment variable PROJECT=[community|nova]"
35+
echo "$(basename "$0"): Error: Expected environment variable PROJECT=[community|nova]"
3636
else
37-
echo "Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
37+
echo "$(basename "$0"): Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
3838
fi
3939
echo "Usage: PROJECT=[community|nova] $0"
4040
exit 42;;
@@ -59,7 +59,7 @@ for proj_i in $projects; do
5959
version_j=$(< "$BASEDIR/$proj_j/CFVERSION" tr ' ' '\n' \
6060
| sed -e 's/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
6161
if [ "$version_i" != "$version_j" ]; then
62-
echo "Detected version mismatch: $proj_i $version_i != $proj_j $version_j"
62+
echo "$(basename "$0"): Error: Detected version mismatch: $proj_i $version_i != $proj_j $version_j"
6363
exit 33
6464
fi
6565
done

build-scripts/revision-file

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ case "$PROJECT" in
3737
;;
3838
*)
3939
if [ -z "${PROJECT}" ]; then
40-
echo "Error: Expected environment variable PROJECT=[community|nova]"
40+
echo "$(basename "$0"): Error: Expected environment variable PROJECT=[community|nova]"
4141
else
42-
echo "Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
42+
echo "$(basename "$0"): Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
4343
fi
4444
echo "Usage: PROJECT=[community|nova] $0"
4545
exit 42;;
@@ -56,24 +56,24 @@ for _dir in $_dirs
5656
do
5757
if [ -d "$BASEDIR/$_dir" ]; then
5858
if [ ! -f "$BASEDIR/$_dir/revision" ]; then
59-
echo "Creating revision file in $_dir"
59+
echo "$(basename "$0"): Debug: Creating revision file in $_dir"
6060

6161
# Get the revision hash
6262
R=$(git -C "$BASEDIR/$_dir" log --abbrev=$CORE_ABBREV --pretty='format:%h' -1 -- .) || false
6363

6464
# Make sure there are no hash collisions
6565
if ! git -C "$BASEDIR/$_dir" show "$R" --oneline >/dev/null; then
66-
echo "abbreviated commit hash of $CORE_ABBREV is not unique. Consider increasing the value in the script $0."
66+
echo "$(basename "$0"): Error: abbreviated commit hash of $CORE_ABBREV is not unique. Consider increasing the value in the script $0."
6767
exit 1
6868
fi
6969

7070
# Create the revision file
7171
echo "$R" | tr -d '\n' > "$BASEDIR/$_dir/revision"
7272
else
73-
echo "Revision file already exists in $_dir"
73+
echo "$(basename "$0"): Debug: Revision file already exists in $_dir"
7474
fi
7575
else
76-
echo "Error: Expected to find the '$_dir' directory in '$BASEDIR', but it's not there"
76+
echo "$(basename "$0"): Error: Expected to find the '$_dir' directory in '$BASEDIR', but it's not there"
7777
exit 1
7878
fi
7979
done

0 commit comments

Comments
 (0)