From 3ac5739e383efd2ac642a9546487778c20d05e37 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 12 Nov 2024 15:13:51 +0300 Subject: [PATCH] guix: "Invert" `guix-start`/`guix-check` cmd-line argument behaviour, defaults to `pwd` --- .github/workflows/guix-build.yml | 2 +- contrib/containers/guix/scripts/guix-check | 6 +----- contrib/containers/guix/scripts/guix-start | 13 ++++++------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/guix-build.yml b/.github/workflows/guix-build.yml index 49d18bc292..1ad6101e3a 100644 --- a/.github/workflows/guix-build.yml +++ b/.github/workflows/guix-build.yml @@ -114,7 +114,7 @@ jobs: -v ${{ github.workspace }}/.cache:/home/ubuntu/.cache \ -w /src/dash \ ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-guix-builder:${{ needs.build-image.outputs.image-tag }} && \ - docker exec guix-daemon bash -c 'HOSTS=${{ matrix.build_target }} /usr/local/bin/guix-start' + docker exec guix-daemon bash -c 'HOSTS=${{ matrix.build_target }} /usr/local/bin/guix-start /src/dash' - name: Ensure build passes run: | diff --git a/contrib/containers/guix/scripts/guix-check b/contrib/containers/guix/scripts/guix-check index 7111f63c5b..e294beb8f6 100755 --- a/contrib/containers/guix/scripts/guix-check +++ b/contrib/containers/guix/scripts/guix-check @@ -2,11 +2,7 @@ set -eo pipefail -if [[ -n "${1}" ]]; then - WORKSPACE_PATH="$1" -else - WORKSPACE_PATH="/src/dash" -fi +WORKSPACE_PATH="${1:-$(pwd)}" if [[ ! -d "$WORKSPACE_PATH" ]]; then echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!" diff --git a/contrib/containers/guix/scripts/guix-start b/contrib/containers/guix/scripts/guix-start index df8f559deb..ac2b4cbe57 100755 --- a/contrib/containers/guix/scripts/guix-start +++ b/contrib/containers/guix/scripts/guix-start @@ -2,11 +2,7 @@ set -eo pipefail -if [[ -n "${1}" ]]; then - WORKSPACE_PATH="$1" -else - WORKSPACE_PATH="/src/dash" -fi +WORKSPACE_PATH="${1:-$(pwd)}" if [[ ! -d "$WORKSPACE_PATH" ]]; then echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!" @@ -25,8 +21,11 @@ if [[ ! -d "${SDK_PATH}/${XCODE_ARCHIVE}" ]]; then curl -L https://bitcoincore.org/depends-sources/sdks/${XCODE_ARCHIVE}.tar.gz | tar -xz -C "${SDK_PATH}" fi -# Avoid adding duplicate safe.directory option -git config --global --fixed-value --get safe.directory "${WORKSPACE_PATH}" || git config --global --add safe.directory "${WORKSPACE_PATH}" +# Add safe.directory option only when WORKSPACE_PATH was specified via cmd-line arguments (happens in CI) +if [[ -n "${1}" ]]; then + # Avoid adding duplicates + git config --global --fixed-value --get safe.directory "${WORKSPACE_PATH}" || git config --global --add safe.directory "${WORKSPACE_PATH}" +fi cd "${WORKSPACE_PATH}" git status >> /dev/null