From 48a38a8a5d27b1affca9dabad9c2c96ac94913da Mon Sep 17 00:00:00 2001 From: Aurel Canciu Date: Fri, 4 Dec 2020 20:44:40 +0200 Subject: [PATCH] Fix GoReleaser AUR publish concurrent exec issue Signed-off-by: Aurel Canciu --- .github/aur/flux-bin/publish.sh | 17 +++++++++-------- .github/aur/flux-go/publish.sh | 15 ++++++++------- .github/aur/flux-scm/publish.sh | 15 ++++++++------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/aur/flux-bin/publish.sh b/.github/aur/flux-bin/publish.sh index a14dfefa..aec0ef34 100755 --- a/.github/aur/flux-bin/publish.sh +++ b/.github/aur/flux-bin/publish.sh @@ -16,11 +16,12 @@ export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChec eval $(ssh-agent -s) ssh-add <(echo "$AUR_BOT_SSH_PRIVATE_KEY") -rm -rf .pkg -git clone aur@aur.archlinux.org:$PKGNAME .pkg 2>&1 +GITDIR=$(mktemp -d aur-$PKGNAME-XXX) +trap "rm -f $GITDIR" EXIT +git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1 -CURRENT_PKGVER=$(cat .pkg/.SRCINFO | grep pkgver | awk '{ print $3 }') -CURRENT_PKGREL=$(cat .pkg/.SRCINFO | grep pkgrel | awk '{ print $3 }') +CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }') +CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }') export PKGVER=${VERSION/-/} @@ -32,12 +33,12 @@ 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_0.4.2_linux_amd64.tar.gz | awk '{ print $1 }') +export SHA256SUM_AMD64=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_amd64.tar.gz | awk '{ print $1 }') -envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < .SRCINFO.template > .pkg/.SRCINFO -envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < PKGBUILD.template > .pkg/PKGBUILD +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 -cd .pkg +cd $GITDIR git config user.name "fluxcdbot" git config user.email "fluxcdbot@users.noreply.github.com" git add -A diff --git a/.github/aur/flux-go/publish.sh b/.github/aur/flux-go/publish.sh index 71ec8b2c..21402246 100755 --- a/.github/aur/flux-go/publish.sh +++ b/.github/aur/flux-go/publish.sh @@ -16,11 +16,12 @@ export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChec eval $(ssh-agent -s) ssh-add <(echo "$AUR_BOT_SSH_PRIVATE_KEY") -rm -rf .pkg -git clone aur@aur.archlinux.org:$PKGNAME .pkg 2>&1 +GITDIR=$(mktemp -d aur-$PKGNAME-XXX) +trap "rm -f $GITDIR" EXIT +git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1 -CURRENT_PKGVER=$(cat .pkg/.SRCINFO | grep pkgver | awk '{ print $3 }') -CURRENT_PKGREL=$(cat .pkg/.SRCINFO | grep pkgrel | awk '{ print $3 }') +CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }') +CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }') export PKGVER=${VERSION/-/} @@ -32,10 +33,10 @@ fi export SHA256SUM=$(curl -sL https://github.com/fluxcd/flux2/archive/v$PKGVER.tar.gz | sha256sum | awk '{ print $1 }') -envsubst '$PKGVER $PKGREL $SHA256SUM' < .SRCINFO.template > .pkg/.SRCINFO -envsubst '$PKGVER $PKGREL $SHA256SUM' < PKGBUILD.template > .pkg/PKGBUILD +envsubst '$PKGVER $PKGREL $SHA256SUM' < .SRCINFO.template > $GITDIR/.SRCINFO +envsubst '$PKGVER $PKGREL $SHA256SUM' < PKGBUILD.template > $GITDIR/PKGBUILD -cd .pkg +cd $GITDIR git config user.name "fluxcdbot" git config user.email "fluxcdbot@users.noreply.github.com" git add -A diff --git a/.github/aur/flux-scm/publish.sh b/.github/aur/flux-scm/publish.sh index c0e86c78..915f88b4 100755 --- a/.github/aur/flux-scm/publish.sh +++ b/.github/aur/flux-scm/publish.sh @@ -16,11 +16,12 @@ export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChec eval $(ssh-agent -s) ssh-add <(echo "$AUR_BOT_SSH_PRIVATE_KEY") -rm -rf .pkg -git clone aur@aur.archlinux.org:$PKGNAME .pkg 2>&1 +GITDIR=$(mktemp -d aur-$PKGNAME-XXX) +trap "rm -f $GITDIR" EXIT +git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1 -CURRENT_PKGVER=$(cat .pkg/.SRCINFO | grep pkgver | awk '{ print $3 }') -CURRENT_PKGREL=$(cat .pkg/.SRCINFO | grep pkgrel | awk '{ print $3 }') +CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }') +CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }') export PKGVER=${VERSION/-/} @@ -30,10 +31,10 @@ else export PKGREL=1 fi -envsubst '$PKGVER $PKGREL' < .SRCINFO.template > .pkg/.SRCINFO -envsubst '$PKGVER $PKGREL' < PKGBUILD.template > .pkg/PKGBUILD +envsubst '$PKGVER $PKGREL' < .SRCINFO.template > $GITDIR/.SRCINFO +envsubst '$PKGVER $PKGREL' < PKGBUILD.template > $GITDIR/PKGBUILD -cd .pkg +cd $GITDIR git config user.name "fluxcdbot" git config user.email "fluxcdbot@users.noreply.github.com" git add -A