mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
0c9597ce7d
867a5e172a
guix: Register garbage collector root for containers (Carl Dong)8f8b96fb54
guix: Update hint messages to mention guix-clean (Carl Dong)44f6d4f56b
guix: Record precious directories and add guix-clean (Carl Dong)84912d4b24
build: Remove spaces from variable-printing rules (Carl Dong) Pull request description: ``` guix: Record precious directories and add guix-clean Many users have reported problems that stem from having an unclean working tree. To that end, I've written a guix-clean script which should help reset the working tree while respecting user-specified precious directories. Precious directories, such as: - SOURCES_PATH - BASE_CACHE - SDK_PATH - OUTDIR Should be preserved when cleaning the working tree, and are thus recorded in ./contrib/guix/var/precious_dirs. The ./contrib/guix/guix-clean script is able to parse that file and make sure to avoid them when cleaning out the working tree. ``` ACKs for top commit: laanwj: ACK867a5e172a
Tree-SHA512: c498fad781ff5e6406639df2b91b687fc528273fdf266bcdba8f6eec3b3b37ecce544b6da0252f0b9c6717f9d88e844e4c7b72d1877bdbabfc6871ddd0172af5
66 lines
1.6 KiB
Bash
66 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
export LC_ALL=C
|
|
set -e -o pipefail
|
|
|
|
# shellcheck source=../../shell/realpath.bash
|
|
source contrib/shell/realpath.bash
|
|
|
|
# shellcheck source=../../shell/git-utils.bash
|
|
source contrib/shell/git-utils.bash
|
|
|
|
################
|
|
# Required non-builtin commands should be invocable
|
|
################
|
|
|
|
check_tools() {
|
|
for cmd in "$@"; 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_tools cat env readlink dirname basename git
|
|
|
|
################
|
|
# We should be at the top directory of the repository
|
|
################
|
|
|
|
same_dir() {
|
|
local resolved1 resolved2
|
|
resolved1="$(bash_realpath "${1}")"
|
|
resolved2="$(bash_realpath "${2}")"
|
|
[ "$resolved1" = "$resolved2" ]
|
|
}
|
|
|
|
if ! same_dir "${PWD}" "$(git_root)"; then
|
|
cat << EOF
|
|
ERR: This script must be invoked from the top level of the git repository
|
|
|
|
Hint: This may look something like:
|
|
env FOO=BAR ./contrib/guix/guix-<blah>
|
|
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
################
|
|
# Set common variables
|
|
################
|
|
|
|
VERSION="${VERSION:-$(git_head_version)}"
|
|
DISTNAME="${DISTNAME:-bitcoin-${VERSION}}"
|
|
|
|
version_base_prefix="${PWD}/guix-build-"
|
|
VERSION_BASE="${version_base_prefix}${VERSION}" # TOP
|
|
|
|
DISTSRC_BASE="${DISTSRC_BASE:-${VERSION_BASE}}"
|
|
|
|
OUTDIR_BASE="${OUTDIR_BASE:-${VERSION_BASE}/output}"
|
|
|
|
var_base_basename="var"
|
|
VAR_BASE="${VAR_BASE:-${VERSION_BASE}/${var_base_basename}}"
|
|
|
|
profiles_base_basename="profiles"
|
|
PROFILES_BASE="${PROFILES_BASE:-${VAR_BASE}/${profiles_base_basename}}"
|