From 52c7cca3fc80ccd852631604060cdc78dc6add78 Mon Sep 17 00:00:00 2001 From: Aurel Canciu Date: Thu, 6 Apr 2023 22:59:14 +0200 Subject: [PATCH] Fix publishing pre-release versions to AUR Fixes #3767 Signed-off-by: Aurel Canciu --- .github/aur/flux-bin/.SRCINFO.template | 8 ++++---- .github/aur/flux-bin/PKGBUILD.template | 11 ++++++----- .github/aur/flux-bin/publish.sh | 11 ++++++----- .github/aur/flux-go/.SRCINFO.template | 2 +- .github/aur/flux-go/PKGBUILD.template | 13 +++++++------ .github/aur/flux-go/publish.sh | 7 ++++--- .github/aur/flux-scm/PKGBUILD.template | 2 +- .github/aur/flux-scm/publish.sh | 1 + 8 files changed, 30 insertions(+), 25 deletions(-) diff --git a/.github/aur/flux-bin/.SRCINFO.template b/.github/aur/flux-bin/.SRCINFO.template index 10aafed7..b75d3e62 100644 --- a/.github/aur/flux-bin/.SRCINFO.template +++ b/.github/aur/flux-bin/.SRCINFO.template @@ -10,13 +10,13 @@ pkgbase = flux-bin license = APACHE optdepends = bash-completion: auto-completion for flux in Bash optdepends = zsh-completions: auto-completion for flux in ZSH - source_x86_64 = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_amd64.tar.gz + source_x86_64 = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_amd64.tar.gz sha256sums_x86_64 = ${SHA256SUM_AMD64} - source_armv6h = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_arm.tar.gz + source_armv6h = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm.tar.gz sha256sums_armv6h = ${SHA256SUM_ARM} - source_armv7h = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_arm.tar.gz + source_armv7h = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm.tar.gz sha256sums_armv7h = ${SHA256SUM_ARM} - source_aarch64 = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_arm64.tar.gz + source_aarch64 = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm64.tar.gz sha256sums_aarch64 = ${SHA256SUM_ARM64} pkgname = flux-bin diff --git a/.github/aur/flux-bin/PKGBUILD.template b/.github/aur/flux-bin/PKGBUILD.template index df4272d7..c390bd51 100644 --- a/.github/aur/flux-bin/PKGBUILD.template +++ b/.github/aur/flux-bin/PKGBUILD.template @@ -4,6 +4,8 @@ pkgname=flux-bin pkgver=${PKGVER} pkgrel=${PKGREL} +_srcname=flux +_srcver=${VERSION} pkgdesc="Open and extensible continuous delivery solution for Kubernetes" url="https://fluxcd.io/" arch=("x86_64" "armv6h" "armv7h" "aarch64") @@ -11,16 +13,16 @@ license=("APACHE") optdepends=('bash-completion: auto-completion for flux in Bash' 'zsh-completions: auto-completion for flux in ZSH') source_x86_64=( - "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_amd64.tar.gz" + "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_amd64.tar.gz" ) source_armv6h=( - "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm.tar.gz" + "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm.tar.gz" ) source_armv7h=( - "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm.tar.gz" + "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm.tar.gz" ) source_aarch64=( - "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm64.tar.gz" + "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm64.tar.gz" ) sha256sums_x86_64=( ${SHA256SUM_AMD64} @@ -34,7 +36,6 @@ sha256sums_armv7h=( sha256sums_aarch64=( ${SHA256SUM_ARM64} ) -_srcname=flux package() { install -Dm755 ${_srcname} "${pkgdir}/usr/bin/${_srcname}" diff --git a/.github/aur/flux-bin/publish.sh b/.github/aur/flux-bin/publish.sh index 0e6097c1..00feb89a 100755 --- a/.github/aur/flux-bin/publish.sh +++ b/.github/aur/flux-bin/publish.sh @@ -28,6 +28,7 @@ git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1 CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }') CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }') +# Transform pre-release to AUR compatible version format export PKGVER=${VERSION/-/} if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then @@ -36,12 +37,12 @@ else export PKGREL=1 fi -export SHA256SUM_ARM=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_arm.tar.gz | awk '{ print $1 }') -export SHA256SUM_ARM64=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_arm64.tar.gz | awk '{ print $1 }') -export SHA256SUM_AMD64=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_amd64.tar.gz | awk '{ print $1 }') +export SHA256SUM_ARM=$(sha256sum ${ROOT}/dist/flux_${VERSION}_linux_arm.tar.gz | awk '{ print $1 }') +export SHA256SUM_ARM64=$(sha256sum ${ROOT}/dist/flux_${VERSION}_linux_arm64.tar.gz | awk '{ print $1 }') +export SHA256SUM_AMD64=$(sha256sum ${ROOT}/dist/flux_${VERSION}_linux_amd64.tar.gz | awk '{ print $1 }') -envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < .SRCINFO.template > $GITDIR/.SRCINFO -envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < PKGBUILD.template > $GITDIR/PKGBUILD +envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < .SRCINFO.template > $GITDIR/.SRCINFO +envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < PKGBUILD.template > $GITDIR/PKGBUILD cd $GITDIR git config user.name "fluxcdbot" diff --git a/.github/aur/flux-go/.SRCINFO.template b/.github/aur/flux-go/.SRCINFO.template index 9f7aaf8b..d41a9e34 100644 --- a/.github/aur/flux-go/.SRCINFO.template +++ b/.github/aur/flux-go/.SRCINFO.template @@ -13,6 +13,6 @@ pkgbase = flux-go provides = flux-bin conflicts = flux-bin replaces = flux-cli - source = flux-go-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/archive/v${PKGVER}.tar.gz + source = flux-go-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/archive/v${VERSION}.tar.gz pkgname = flux-go diff --git a/.github/aur/flux-go/PKGBUILD.template b/.github/aur/flux-go/PKGBUILD.template index 225320da..146e3847 100644 --- a/.github/aur/flux-go/PKGBUILD.template +++ b/.github/aur/flux-go/PKGBUILD.template @@ -4,6 +4,8 @@ pkgname=flux-go pkgver=${PKGVER} pkgrel=${PKGREL} +_srcname=flux +_srcver=${VERSION} pkgdesc="Open and extensible continuous delivery solution for Kubernetes" url="https://fluxcd.io/" arch=("x86_64" "armv6h" "armv7h" "aarch64") @@ -16,26 +18,25 @@ makedepends=('go>=1.17', 'kustomize>=3.0') optdepends=('bash-completion: auto-completion for flux in Bash', 'zsh-completions: auto-completion for flux in ZSH') source=( - "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/archive/v${pkgver}.tar.gz" + "${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/archive/v${_srcver}.tar.gz" ) sha256sums=( ${SHA256SUM} ) -_srcname=flux build() { - cd "flux2-${pkgver}" + cd "flux2-${_srcver}" export CGO_LDFLAGS="$LDFLAGS" export CGO_CFLAGS="$CFLAGS" export CGO_CXXFLAGS="$CXXFLAGS" export CGO_CPPFLAGS="$CPPFLAGS" export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" make cmd/flux/.manifests.done - go build -ldflags "-linkmode=external -X main.VERSION=${pkgver}" -o ${_srcname} ./cmd/flux + go build -ldflags "-linkmode=external -X main.VERSION=${_srcver}" -o ${_srcname} ./cmd/flux } check() { - cd "flux2-${pkgver}" + cd "flux2-${_srcver}" case $CARCH in aarch64) export ENVTEST_ARCH=arm64 @@ -48,7 +49,7 @@ check() { } package() { - cd "flux2-${pkgver}" + cd "flux2-${_srcver}" install -Dm755 ${_srcname} "${pkgdir}/usr/bin/${_srcname}" install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" diff --git a/.github/aur/flux-go/publish.sh b/.github/aur/flux-go/publish.sh index bea591dd..fba19071 100755 --- a/.github/aur/flux-go/publish.sh +++ b/.github/aur/flux-go/publish.sh @@ -28,6 +28,7 @@ git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1 CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }') CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }') +# Transform pre-release to AUR compatible version format export PKGVER=${VERSION/-/} if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then @@ -36,10 +37,10 @@ else export PKGREL=1 fi -export SHA256SUM=$(curl -sL https://github.com/fluxcd/flux2/archive/v$PKGVER.tar.gz | sha256sum | awk '{ print $1 }') +export SHA256SUM=$(curl -sL https://github.com/fluxcd/flux2/archive/v${VERSION}.tar.gz | sha256sum | awk '{ print $1 }') -envsubst '$PKGVER $PKGREL $SHA256SUM' < .SRCINFO.template > $GITDIR/.SRCINFO -envsubst '$PKGVER $PKGREL $SHA256SUM' < PKGBUILD.template > $GITDIR/PKGBUILD +envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM' < .SRCINFO.template > $GITDIR/.SRCINFO +envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM' < PKGBUILD.template > $GITDIR/PKGBUILD cd $GITDIR git config user.name "fluxcdbot" diff --git a/.github/aur/flux-scm/PKGBUILD.template b/.github/aur/flux-scm/PKGBUILD.template index 9593cf83..b4c264c0 100644 --- a/.github/aur/flux-scm/PKGBUILD.template +++ b/.github/aur/flux-scm/PKGBUILD.template @@ -4,6 +4,7 @@ pkgname=flux-scm pkgver=${PKGVER} pkgrel=${PKGREL} +_srcname=flux pkgdesc="Open and extensible continuous delivery solution for Kubernetes" url="https://fluxcd.io/" arch=("x86_64" "armv6h" "armv7h" "aarch64") @@ -18,7 +19,6 @@ source=( "git+https://github.com/fluxcd/flux2.git" ) md5sums=('SKIP') -_srcname=flux pkgver() { cd "flux2" diff --git a/.github/aur/flux-scm/publish.sh b/.github/aur/flux-scm/publish.sh index 0b743c29..ac704308 100755 --- a/.github/aur/flux-scm/publish.sh +++ b/.github/aur/flux-scm/publish.sh @@ -28,6 +28,7 @@ git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1 CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }') CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }') +# Transform pre-release to AUR compatible version format export PKGVER=${VERSION/-/} if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then