From 385f43220419a38c3641482ecefe35189c1db030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Steinbei=C3=9F?= Date: Sat, 2 Jan 2021 22:50:18 +0100 Subject: helpers: Add 'xfce-build describe' command This command prints the versions of the components built within this container, which are located in the /git folder. --- helpers/xfce-build | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/helpers/xfce-build b/helpers/xfce-build index 30298c5..7fd49bf 100755 --- a/helpers/xfce-build +++ b/helpers/xfce-build @@ -4,6 +4,8 @@ # Possible arguments: # - the version of the xfce-build container (if you want to build with a special version) # - 'pull' to simply update the container and exit +# - 'version' as second positional argument after an actual version (e.g. xfce-build latest version) +# to print all git versions built in the container by build_libs.sh CONTAINER="xfce/xfce-build" VERSION="latest" @@ -15,19 +17,27 @@ docker_pull () { docker pull xfce/xfce-build:$VERSION } +docker_run () { + # Run the build in the docker container + docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) --volume $VOLUME:/tmp --env CFLAGS="${CFLAGS}" --env CONTAINER=$CONTAINER --env VERSION=$VERSION $CONTAINER:$VERSION /bin/bash -c "${BUILD_CMD}" +} + +# Parse the commandline arguments if [ -z "$1" ]; then VERSION="latest" elif [[ "$1" == "pull" ]]; then docker_pull exit 0 -else - VERSION=$1 +elif [[ "$1" == "describe" ]]; then + if [[ ! -z "$2" ]]; then + VERSION="$2" + fi + BUILD_CMD='printf "\e[1m$CONTAINER:$VERSION contains:\e[0m\n";cat /git/xfce_build_version_info.txt' + docker_run + exit 0 fi -# Make sure we're running the latest version +# Run the local build docker_pull - -# Run the build in the docker container -docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) --volume $VOLUME:/tmp --env CFLAGS="${CFLAGS}" $CONTAINER:$VERSION /bin/bash -c "${BUILD_CMD}" - +docker_run printf "\n---\nBuilt using container $CONTAINER:$VERSION on $VOLUME\n" -- cgit v1.2.1