mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 13:32:33 +02:00
guix: Add more sanity checks to guix-build.sh
This commit is contained in:
parent
57f9533146
commit
d27ff8b86a
@ -6,6 +6,20 @@ set -e -o pipefail
|
|||||||
## Sanity Checks ##
|
## Sanity Checks ##
|
||||||
###################
|
###################
|
||||||
|
|
||||||
|
################
|
||||||
|
# Check 1: Make sure that we can invoke required tools
|
||||||
|
################
|
||||||
|
for cmd in git make guix cat mkdir; do
|
||||||
|
if ! command -v "$cmd" > /dev/null 2>&1; then
|
||||||
|
echo "ERR: This script requires that '$cmd' is installed and available in your \$PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
################
|
||||||
|
# Check 2: Make sure GUIX_BUILD_OPTIONS is empty
|
||||||
|
################
|
||||||
|
#
|
||||||
# GUIX_BUILD_OPTIONS is an environment variable recognized by guix commands that
|
# GUIX_BUILD_OPTIONS is an environment variable recognized by guix commands that
|
||||||
# can perform builds. This seems like what we want instead of
|
# can perform builds. This seems like what we want instead of
|
||||||
# ADDITIONAL_GUIX_COMMON_FLAGS, but the value of GUIX_BUILD_OPTIONS is actually
|
# ADDITIONAL_GUIX_COMMON_FLAGS, but the value of GUIX_BUILD_OPTIONS is actually
|
||||||
@ -30,6 +44,26 @@ EOF
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
################
|
||||||
|
# Check 3: Make sure that we're not in a dirty worktree
|
||||||
|
################
|
||||||
|
if ! git diff-index --quiet HEAD -- && [ -z "$FORCE_DIRTY_WORKTREE" ]; then
|
||||||
|
cat << EOF
|
||||||
|
ERR: The current git worktree is dirty, which may lead to broken builds.
|
||||||
|
|
||||||
|
Aborting...
|
||||||
|
|
||||||
|
Hint: To make your git worktree clean, You may want to:
|
||||||
|
1. Commit your changes,
|
||||||
|
2. Stash your changes, or
|
||||||
|
3. Set the 'FORCE_DIRTY_WORKTREE' environment variable if you insist on
|
||||||
|
using a dirty worktree
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
GIT_COMMIT=$(git rev-parse --short=12 HEAD)
|
||||||
|
fi
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# Setup #
|
# Setup #
|
||||||
#########
|
#########
|
||||||
|
Loading…
Reference in New Issue
Block a user