aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@alpinelinux.org>2020-01-14 10:20:15 +0100
committerCarlo Landmeter <clandmeter@alpinelinux.org>2020-01-17 10:57:36 +0100
commit0c5cd4e259f07f2618f5acf98bbea1e2025a899b (patch)
tree51f8b5f1ac57a81d79c65a6942bf7a01a35c2517
parent9a099c23581b669ca3c958803e497b27f47352b0 (diff)
downloaddocker-abuild-0c5cd4e259f07f2618f5acf98bbea1e2025a899b.tar.bz2
docker-abuild-0c5cd4e259f07f2618f5acf98bbea1e2025a899b.tar.xz
add editorconfig support and follow alpine coding style
-rw-r--r--.editorconfig12
-rwxr-xr-xdabuild.in58
2 files changed, 41 insertions, 29 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..5665f37
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+; Editorconfig See http://editorconfig.org for details.
+
+# Top-most EditorConfig file.
+root = true
+
+[*]
+charset = utf-8
+indent_style = tab
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+; max_line_length = 80
diff --git a/dabuild.in b/dabuild.in
index de5e849..3e389c5 100755
--- a/dabuild.in
+++ b/dabuild.in
@@ -26,48 +26,46 @@ fi
DABUILD_ENV=
die () {
- printf >&2 "%s\n" "$@"
+ printf >&2 "%s\\n" "$@"
exit 1
}
## debug
if [ "$DABUILD_DEBUG" = "true" ]; then
- set -x
- PS4='$LINENO: '
- DABUILD_ENV="$DABUILD_ENV -e DABUILD_DEBUG=true"
+ set -x
+ PS4='$LINENO: '
+ DABUILD_ENV="$DABUILD_ENV -e DABUILD_DEBUG=true"
fi
## check running from within an `aports` tree
if [ "${PWD%*/aports/*}" = "$PWD" ]; then
- die "Error: expecting to be run from within an aports tree!" \
- "Could not find '/aports/' in the current path: $PWD"
- exit 1
+ die "Error: expecting to be run from within an aports tree!" \
+ "Could not find '/aports/' in the current path: $PWD"
fi
case "$DABUILD_ARCH" in
- x86|x86_64|aarch64|armhf|armv7);;
- armv8l|arm) DABUILD_ARCH=armv7;;
- * ) die "Unsupported arch \"$DABUILD_ARCH\" detected." \
- "Expected one of: x86|x86_64|aarch64|armhf|armv7" \
- "You may force it setting DABUILD_ARCH=\"xxx\" in invocation";;
+ x86|x86_64|aarch64|armhf|armv7);;
+ armv8l|arm) DABUILD_ARCH=armv7;;
+ *) die "Unsupported arch \"$DABUILD_ARCH\" detected." \
+ "Expected one of: x86|x86_64|aarch64|armhf|armv7" \
+ "You may force it setting DABUILD_ARCH=\"xxx\" in invocation";;
esac
## allow setting of `docker` command by env variable
case "$DABUILD_DOCKER" in
- podman|docker ) ;;
- * ) die "Unsupported docker CLI replacement \"$DABUILD_DOCKER\" detected." \
- "Expected one of: docker|podman"
- ;;
+ podman|docker) ;;
+ *) die "Unsupported docker CLI replacement \"$DABUILD_DOCKER\" detected." \
+ "Expected one of: docker|podman";;
esac
_DOCKER=$DABUILD_DOCKER
## use branch to figure out most appropriate alpine version
if [ ! "$DABUILD_VERSION" ]; then
- APORTS_BRANCH=$(git symbolic-ref --short -q HEAD)
- case $APORTS_BRANCH in
- *-stable) DABUILD_VERSION=${APORTS_BRANCH%-stable};;
- *) DABUILD_VERSION=edge;;
- esac
+ APORTS_BRANCH=$(git symbolic-ref --short -q HEAD)
+ case $APORTS_BRANCH in
+ *-stable) DABUILD_VERSION=${APORTS_BRANCH%-stable};;
+ *) DABUILD_VERSION=edge;;
+ esac
fi
# set packages dir based on alpine release
@@ -75,11 +73,12 @@ DABUILD_PACKAGES="$DABUILD_PACKAGES/$DABUILD_VERSION"
## setup volumes; use named volumes as cache if desired
ABUILD_VOLUMES="-v ${PWD%/aports/*}/aports:/home/builder/aports \
- -v ${DABUILD_PACKAGES}:/home/builder/packages"
+ -v ${DABUILD_PACKAGES}:/home/builder/packages"
# pass over gitconfig for abuild-keygen
if [ -f "$HOME/.gitconfig" ]; then
- ABUILD_VOLUMES="$ABUILD_VOLUMES -v $HOME/.gitconfig:/home/builder/.gitconfig"
+ ABUILD_VOLUMES="$ABUILD_VOLUMES \
+ -v $HOME/.gitconfig:/home/builder/.gitconfig"
fi
setup_named_volume() {
@@ -100,7 +99,8 @@ fi
# use a bind or named volume for distfiles.
case $DABUILD_DISTFILES in
- */*) ABUILD_VOLUMES="$ABUILD_VOLUMES -v $DABUILD_DISTFILES:/var/cache/distfiles";;
+ */*) ABUILD_VOLUMES="$ABUILD_VOLUMES \
+ -v $DABUILD_DISTFILES:/var/cache/distfiles";;
true) setup_named_volume distfiles "/var/cache/distfiles" true;;
*) ;;
esac
@@ -113,8 +113,8 @@ fi
## go!
$_DOCKER run --tty --interactive \
- $ABUILD_VOLUMES \
- $DABUILD_ENV \
- $DABUILD_ARGS \
- --workdir /home/builder/aports/${PWD#*/aports/} \
- %%ABUILD_IMAGE%%:$DABUILD_VERSION-$DABUILD_ARCH "$@"
+ $ABUILD_VOLUMES \
+ $DABUILD_ENV \
+ $DABUILD_ARGS \
+ --workdir /home/builder/aports/"${PWD#*/aports/}" \
+ %%ABUILD_IMAGE%%:$DABUILD_VERSION-$DABUILD_ARCH "$@"