Skip to content

Commit

Permalink
Allow verbose output in ct-ng images.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Jul 4, 2022
1 parent 4c091de commit 330aa7e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions docker/Dockerfile.arm-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

ARG VERBOSE
COPY crosstool-ng.sh /
COPY crosstool-config/arm-unknown-linux-gnueabihf.config /
RUN /crosstool-ng.sh arm-unknown-linux-gnueabihf.config 5
Expand Down
17 changes: 13 additions & 4 deletions docker/crosstool-ng.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/bin/bash

set -x
set -euo pipefail
set -eo pipefail

# shellcheck disable=SC1091
. lib.sh

silence_stdout() {
if [[ "${VERBOSE}" == "1" ]]; then
"${@}"
else
"${@}" >/dev/null
fi
}

main() {
local config="${1}"
local nproc="${2}"
Expand Down Expand Up @@ -75,14 +83,15 @@ main() {
# work with any bash functions: must call a command.
timeout "${timeout}" \
su "${username}" -c \
"STOP=${step} CT_DEBUG_CT_SAVE_STEPS=1 ${crosstooldir}/bin/ct-ng build.${nproc} &> /dev/null"
"STOP=${step} CT_DEBUG_CT_SAVE_STEPS=1 ${crosstooldir}/bin/ct-ng build.${nproc}"
}

while download; [ $? -eq 124 ]; do
while silence_stdout download; [ $? -eq 124 ]; do
# Indicates a timeout, repeat the command.
sleep "${sleep}"
done
su "${username}" -c "CT_DEBUG_CT_SAVE_STEPS=1 ${crosstooldir}/bin/ct-ng build.${nproc} &> /dev/null"
silence_stdout su "${username}" \
-c "CT_DEBUG_CT_SAVE_STEPS=1 ${crosstooldir}/bin/ct-ng build.${nproc}"

popd

Expand Down
3 changes: 3 additions & 0 deletions xtask/src/build_docker_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ pub fn build_docker_image(
for arg in &build_arg {
docker_build.args(&["--build-arg", arg]);
}
if let Ok(env_verbose) = std::env::var("VERBOSE") {
docker_build.args(&["--build-arg", &format!("VERBOSE={env_verbose}")]);
}

docker_build.arg(".");

Expand Down

0 comments on commit 330aa7e

Please sign in to comment.