2023-02-11 11:26:44 +01:00
|
|
|
#!/bin/bash
|
2023-04-09 09:51:46 +02:00
|
|
|
# shellcheck disable=SC3044,SC3009,SC2312
|
2021-05-19 09:59:59 +02:00
|
|
|
|
2022-06-28 10:30:05 +02:00
|
|
|
. .util.sh
|
2023-12-09 14:19:53 +01:00
|
|
|
export BUILDDIR=/build
|
2021-07-26 20:17:49 +02:00
|
|
|
|
2022-06-28 10:30:05 +02:00
|
|
|
build() {
|
2023-04-09 09:51:46 +02:00
|
|
|
local upd=$1
|
|
|
|
|
2023-12-09 14:19:53 +01:00
|
|
|
rm -rf /build/*
|
|
|
|
|
2023-03-22 08:49:51 +01:00
|
|
|
if grep -c 'git+' PKGBUILD >/dev/null && ! grep -c '#tag=' PKGBUILD >/dev/null; then
|
|
|
|
makepkg --noprepare --nodeps --nobuild --skippgpcheck --noconfirm
|
|
|
|
makepkg --printsrcinfo >.SRCINFO
|
2023-04-09 09:51:46 +02:00
|
|
|
if [[ "${upd}" = true ]]; then
|
|
|
|
update_pkg
|
|
|
|
fi
|
2023-03-22 08:49:51 +01: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-11-16 22:37:48 +01:00
|
|
|
if [[ -n "${epoch}" ]]; then
|
2022-06-28 10:30:05 +02:00
|
|
|
epoch=${epoch}:
|
2021-05-19 12:24:22 +02:00
|
|
|
fi
|
2021-05-19 11:53:25 +02:00
|
|
|
|
2023-08-11 11:43:39 +02:00
|
|
|
# TMP: fix wrong pkgrel cs-firewall-bouncer
|
|
|
|
if [[ "$name" == "cs-firewall-bouncer" ]]; then
|
|
|
|
relpkg=$(grep -E '^pkgrel' PKGBUILD | cut -d'=' -f2 | tr -d ' ')
|
|
|
|
if [[ "$rel" != "$pkgrel" ]]; then
|
|
|
|
rel=1
|
|
|
|
sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2023-04-09 09:51:46 +02:00
|
|
|
if pacman -Si "${name}" 2>/dev/null | grep -v nyyu | grep -c -E '^Repository' &>/dev/null; then
|
2022-07-03 10:13:32 +02:00
|
|
|
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
|
2023-03-22 08:43:41 +01:00
|
|
|
echo "Building package ${name}-${epoch}${ver}-${rel}"
|
2023-03-18 13:43:33 +01:00
|
|
|
if makepkg --nodeps --skippgpcheck --noconfirm --sign || makepkg -C -s --skippgpcheck --noconfirm --sign || makepkg -C -s --skippgpcheck --nocheck --noconfirm --sign; then
|
2022-06-28 10:30:05 +02:00
|
|
|
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
|
2023-08-11 11:29:33 +02:00
|
|
|
sudo pacman -Syu
|
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-08-01 07:58:04 +02:00
|
|
|
git config --global user.email "drone@nyyu.dev"
|
|
|
|
git config --global user.name "drone"
|
2023-12-09 14:19:53 +01:00
|
|
|
git remote set-url origin "${CI_REPO_CLONE_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
|
2023-04-09 09:51:46 +02:00
|
|
|
if [[ -f PKGBUILD ]]; then
|
2022-06-28 10:30:05 +02:00
|
|
|
echo "--> ${d}"
|
2023-04-09 09:51:46 +02:00
|
|
|
if [[ -f update.sh ]]; then
|
2022-06-28 10:30:05 +02:00
|
|
|
./update.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! grep -c 'pkgver()' PKGBUILD >/dev/null; then
|
2023-02-04 09:29:40 +01:00
|
|
|
repo=$(grep -oPm 1 'github\.com\/\K(\w|-)+\/(\w|-)+' .SRCINFO)
|
2023-04-09 09:51:46 +02:00
|
|
|
if [[ -n "${repo}" ]]; then
|
2023-03-17 19:42:20 +01:00
|
|
|
update_github_tag "${repo}"
|
2022-06-28 10:30:05 +02:00
|
|
|
fi
|
2023-08-05 14:40:59 +02:00
|
|
|
repo=$(grep -oPm 1 'gitea\.com\/\K(\w|-)+\/(\w|-)+' .SRCINFO)
|
|
|
|
if [[ -n "${repo}" ]]; then
|
|
|
|
update_gitea_tag "${repo}"
|
|
|
|
fi
|
2022-06-28 10:30:05 +02:00
|
|
|
fi
|
2023-03-17 19:45:25 +01:00
|
|
|
update_pkg
|
2023-04-09 09:51:46 +02:00
|
|
|
build true
|
2022-06-28 10:30:05 +02:00
|
|
|
fi
|
2021-05-19 09:48:07 +02:00
|
|
|
cd ..
|
|
|
|
done
|
2021-05-19 11:26:24 +02:00
|
|
|
|
|
|
|
while read -r p; do
|
2023-05-29 16:14:46 +02:00
|
|
|
git clone https://aur.archlinux.org/"${p}".git --depth 1 || echo "ERR: Package ${p} not found in AUR"
|
2022-06-28 10:30:05 +02:00
|
|
|
cd "${p}" || continue
|
2023-04-09 09:51:46 +02:00
|
|
|
build false
|
2021-05-19 11:26:24 +02:00
|
|
|
cd ..
|
|
|
|
done <aur.txt
|
2021-09-25 09:58:23 +02:00
|
|
|
|
2022-11-16 22:17:52 +01:00
|
|
|
del=$(git --no-pager diff ${CI_PREV_COMMIT_SHA}..HEAD aur.txt | tail -n +4 | grep -E '^-' | cut -c2-)
|
2023-04-09 10:07:33 +02:00
|
|
|
del+=$(git --no-pager diff --name-status ${CI_PREV_COMMIT_SHA}..HEAD | grep -Po 'D\s+(\K.*)(?=/PKGBUILD)')
|
2023-04-09 09:51:46 +02:00
|
|
|
if [[ -n "${del}" ]]; then
|
2022-07-02 10:47:43 +02:00
|
|
|
# shellcheck disable=SC2086
|
2022-11-16 22:17:52 +01:00
|
|
|
repo-remove -s /repo/nyyu.db.tar.zst ${del} || true
|
2022-07-02 10:47:43 +02:00
|
|
|
fi
|