Only update AUR git package on release if PKGBUILD has changed

This commit is contained in:
timvisee 2019-03-26 14:06:26 +01:00
parent e6118122d5
commit a5f3086dcf
No known key found for this signature in database
GPG key ID: B8DB720BC383E172

View file

@ -290,6 +290,10 @@ package-aur:
- sed "s/^sha256sums=.*\$/sha256sums=('$SHA_SOURCE')/" -i ffsend/PKGBUILD
- sed "s/^sha256sums=.*\$/sha256sums=('$SHA_BIN')/" -i ffsend-bin/PKGBUILD
# Get SHA hash for local and remote file w/o version, update if it has changed
- 'PKGBUILD_STRIP_LOCAL=$(cat ffsend-git/PKGBUILD | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)'
- 'PKGBUILD_STRIP_REMOTE=$(curl -sSL "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ffsend-git" | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)'
# Install dependencies
- echo "Installing required build packages..."
- pacman -Syu --noconfirm sudo base-devel binutils openssh rust cargo cmake git openssl
@ -305,11 +309,16 @@ package-aur:
- echo "Making main source package..."
- sudo -u nobody makepkg -c
- sudo -u nobody makepkg --printsrcinfo > .SRCINFO
# TODO: only do this if the file has changed?
- cd ../ffsend-git
- echo "Making git source package..."
- sudo -u nobody makepkg -c
- sudo -u nobody makepkg --printsrcinfo > .SRCINFO
# Make git package if different than the remote
- |
if [ ! "$PKGBUILD_STRIP_LOCAL" == "$PKGBUILD_STRIP_REMOTE" ]; then
cd ../ffsend-git
echo "Making git source package..."
sudo -u nobody makepkg -c
sudo -u nobody makepkg --printsrcinfo > .SRCINFO
else
echo "Not making git source package, it has not changed"
fi
- cd ..
# Set up SSH for publishing
@ -345,13 +354,18 @@ package-aur:
- cd ..
# Publish git package: clone AUR repo, commit update and push
# TODO: only push here if things have changed!
- git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend-git
- cd aur-ffsend-git
- cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./
- git add PKGBUILD .SRCINFO
- git commit -m "Update PKGBUILD for release v$VERSION"
- git push
- cd ..
# Only publish it if it is different than the remote
- |
if [ ! "$PKGBUILD_STRIP_LOCAL" == "$PKGBUILD_STRIP_REMOTE" ]; then
git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend-git
cd aur-ffsend-git
cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./
git add PKGBUILD .SRCINFO
git commit -m "Update PKGBUILD for release v$VERSION"
git push
cd ..
else
echo "Not pushing git package, it has not changed"
fi
# TODO: add job to test ffsend{-git} AUR packages