From a375f8e52082d9d2e8c97b88759516b5789fed5b Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 27 Nov 2024 09:54:34 +0100 Subject: [PATCH] Replace the pkgrel variable with the release number of the build system The PKGBUILD file must contain one of the following placeholders: pkgrel=@RELEASE@ pkgrel=@RELEASE1@ pkgrel=@RELEASE2@ Assuming the $RELEASE variable supplied by the build system contains the value "123.456" (default .), the corresponding placeholder is replaced as follows: pkgrel=123.456 pkgrel=123 pkgrel=456 @RELEASE1@ and @RELEASE2@ have been implemented in case someone wants to use a stricter variant with only one number. Then you have the choice between or For the use of obs-service-set_version an adjustment is necessary there. I will link the corresponding pull-request here later. --- build-recipe-arch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build-recipe-arch b/build-recipe-arch index fa6a1528..2bf40417 100644 --- a/build-recipe-arch +++ b/build-recipe-arch @@ -41,6 +41,20 @@ recipe_setup_arch() { } recipe_prepare_arch() { + echo "Replacing the pkgrel variable..." + ARCH_RELEASE=`grep -Eo '^[0-9]+(\.[0-9]+){0,1}' <<< "$RELEASE"` + [ -z "$ARCH_RELEASE" ] && ARCH_RELEASE=1 + ARCH_RELEASE1=`cut -d. -f1 <<< "$ARCH_RELEASE"` + ARCH_RELEASE2=`cut -d. -f2 <<< "$ARCH_RELEASE"` + chroot $BUILD_ROOT su -c /bin/sh <&1" ">/dev/null" ; then cleanup_and_exit 1 "failed to prepare sources"