aur/build.sh

73 lines
2.0 KiB
Bash
Raw Normal View History

2021-05-19 09:48:07 +02:00
#!/bin/bash
2022-07-02 10:47:43 +02:00
# shellcheck disable=SC3044,SC3009
2021-05-19 09:59:59 +02:00
2022-06-28 10:30:05 +02:00
. .util.sh
2022-06-28 10:30:05 +02:00
build() {
2022-06-28 10:30:05 +02:00
if grep -c 'git+' PKGBUILD >/dev/null && ! grep -c '#tag=' PKGBUILD >/dev/null; then
2021-05-19 13:39:48 +02:00
makepkg --nodeps --nobuild --skippgpcheck --noconfirm
2022-07-14 09:51:09 +02:00
makepkg --printsrcinfo >.SRCINFO
2021-05-19 13:26:30 +02:00
fi
2021-06-04 08:35:25 +02:00
name=$(grep -m1 'pkgname' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
2021-05-19 13:17:53 +02:00
ver=$(grep 'pkgver' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
rel=$(grep 'pkgrel' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
epoch=$(grep 'epoch' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
2022-06-28 10:30:05 +02:00
if [ -n "${epoch}" ]; then
epoch=${epoch}:
2021-05-19 12:24:22 +02:00
fi
2021-05-19 11:53:25 +02:00
if pacman -Si "${name}" | grep -v nyyu | grep -c -E '^Repository' >/dev/null; then
echo "WARN: Found ${name} in arch repo"
fi
2022-06-28 10:30:05 +02:00
if ! compgen -G "/repo/${name}-${epoch}${ver}-${rel}-*.pkg.tar.zst" >/dev/null; then
if makepkg -s --skippgpcheck --noconfirm --sign || makepkg -s --skippgpcheck --nocheck --noconfirm --sign; then
for pkg in *.pkg.tar.zst; do
cp "${pkg}"{,.sig} /repo/
repo-add -R -s /repo/nyyu.db.tar.zst /repo/"${pkg}"
2021-05-19 11:53:25 +02:00
done
2021-06-05 21:01:44 +02:00
sudo pacman -Sy
2021-05-19 11:53:25 +02:00
fi
2021-05-19 09:48:07 +02:00
fi
2021-05-19 11:26:24 +02:00
}
2022-06-25 11:23:01 +02:00
git config user.email "drone@nyyu.dev"
git config user.name "drone"
2022-06-28 10:30:05 +02:00
git remote set-url origin "${DRONE_GIT_HTTP_URL}"
2022-07-02 10:47:43 +02:00
# shellcheck disable=SC2016
2022-06-25 11:23:01 +02:00
git config credential.helper '!f() { sleep 1; echo "username=drone"; echo "password=${GIT_PASSWORD}"; }; f'
2021-08-20 07:09:29 +02:00
2022-06-28 10:30:05 +02:00
for d in */; do
cd "${d}" || continue
if [ -f PKGBUILD ]; then
echo "--> ${d}"
if [ -f update.sh ]; then
./update.sh
fi
if ! grep -c 'pkgver()' PKGBUILD >/dev/null; then
repo=$(grep -oPm 1 'github\.com\/\K([a-z0-9]|-)+\/([a-z0-9]|-)+' .SRCINFO)
if [ -n "${repo}" ]; then
update_github_tag "${repo}" && update_pkg
fi
fi
build
fi
2021-05-19 09:48:07 +02:00
cd ..
done
2021-05-19 11:26:24 +02:00
while read -r p; do
2022-06-28 10:30:05 +02:00
git clone https://aur.archlinux.org/"${p}".git || continue
cd "${p}" || continue
2021-05-19 11:26:24 +02:00
build
cd ..
done <aur.txt
2021-09-25 09:58:23 +02:00
2022-07-02 10:47:43 +02:00
del=$(git --no-pager diff HEAD~${DRONE_COMMIT_BEFORE} aur.txt | tail -n +4 | grep -E '^-' | cut -c2-)
if [ -n "${del}" ]; then
# shellcheck disable=SC2086
repo-remove -s /repo/nyyu.db.tar.zst ${del}
fi