Commit 0c5cd4e2 authored by Carlo Landmeter's avatar Carlo Landmeter

add editorconfig support and follow alpine coding style

parent 9a099c23
; 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
......@@ -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 "$@"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment