aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@alpinelinux.org>2020-01-11 17:49:45 +0100
committerCarlo Landmeter <clandmeter@alpinelinux.org>2020-01-17 10:57:36 +0100
commit08211018f3604ac016bf37ce6eb3ea83a394ced7 (patch)
tree64d9a3892f3ae9eabffe3f9019556dcf81ad2c3e
parent314f30b4c9176699e5c0cb97060b79340bd7a713 (diff)
downloaddocker-abuild-08211018f3604ac016bf37ce6eb3ea83a394ced7.tar.bz2
docker-abuild-08211018f3604ac016bf37ce6eb3ea83a394ced7.tar.xz
make distfiles named volume/bind configuable:
- set to true to enable named volume - set to absolute path to enable bind mount
-rw-r--r--dabuild.conf5
-rwxr-xr-xdabuild.in12
2 files changed, 13 insertions, 4 deletions
diff --git a/dabuild.conf b/dabuild.conf
index 227bb92..1d7cd37 100644
--- a/dabuild.conf
+++ b/dabuild.conf
@@ -17,6 +17,11 @@
# acting as caches.
# DABUILD_CLEAN=false
+# Use a bind mount or a named volume to store distfiles.
+# to enable as a named volume set it to true
+# to enable as a bind mount set it to an absolute path
+# DABUILD_DISTFILES=false
+
# Output debug messages to stdout.
# DABUILD_DEBUG=false
diff --git a/dabuild.in b/dabuild.in
index eb39b39..6839e8d 100755
--- a/dabuild.in
+++ b/dabuild.in
@@ -81,10 +81,6 @@ fi
ABUILD_VOLUMES="-v ${PWD%/aports/*}/aports:/home/builder/aports \
-v ${ABUILD_PACKAGES}:/home/builder/packages"
-if [ -w "/var/cache/distfiles" ]; then
- ABUILD_VOLUMES="$ABUILD_VOLUMES -v /var/cache/distfiles:/var/cache/distfiles"
-fi
-
# pass over gitconfig for abuild-keygen
if [ -f "$HOME/.gitconfig" ]; then
ABUILD_VOLUMES="$ABUILD_VOLUMES -v $HOME/.gitconfig:/home/builder/.gitconfig"
@@ -106,6 +102,14 @@ if [ "$DABUILD_CCACHE" = "true" ]; then
DABUILD_ENV="$DABUILD_ENV -e DABUILD_CCACHE=true"
fi
+# use a bind or named volume for distfiles.
+DABUILD_DISTFILES=${DABUILD_DISTFILES:-false}
+case $DABUILD_DISTFILES in
+ */*) ABUILD_VOLUMES="$ABUILD_VOLUMES -v $DABUILD_DISTFILES:/var/cache/distfiles";;
+ true) setup_named_volume distfiles "/var/cache/distfiles" true;;
+ *) ;;
+esac
+
setup_named_volume config "/home/builder/.abuild" true
ABUILD_RM="--rm"