fix: build sh
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
nyyu 2023-04-09 09:51:46 +02:00
parent 2d61203a51
commit e48dbb9ab8
2 changed files with 14 additions and 9 deletions

View File

@ -7,7 +7,7 @@ update_github_tag() {
update_pkg() { update_pkg() {
if [ $(git diff . | wc -l) -ne 0 ]; then if [[ $(git diff . | wc -l) -ne 0 ]]; then
sed -i 's/pkgrel=.*/pkgrel=1/' PKGBUILD sed -i 's/pkgrel=.*/pkgrel=1/' PKGBUILD
if updpkgsums; then if updpkgsums; then

View File

@ -1,12 +1,17 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC3044,SC3009 # shellcheck disable=SC3044,SC3009,SC2312
. .util.sh . .util.sh
build() { build() {
local upd=$1
if grep -c 'git+' PKGBUILD >/dev/null && ! grep -c '#tag=' PKGBUILD >/dev/null; then if grep -c 'git+' PKGBUILD >/dev/null && ! grep -c '#tag=' PKGBUILD >/dev/null; then
makepkg --noprepare --nodeps --nobuild --skippgpcheck --noconfirm makepkg --noprepare --nodeps --nobuild --skippgpcheck --noconfirm
makepkg --printsrcinfo >.SRCINFO makepkg --printsrcinfo >.SRCINFO
if [[ "${upd}" = true ]]; then
update_pkg
fi
fi fi
name=$(grep -m1 'pkgname' .SRCINFO | cut -d'=' -f2 | tr -d ' ') name=$(grep -m1 'pkgname' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
ver=$(grep 'pkgver' .SRCINFO | cut -d'=' -f2 | tr -d ' ') ver=$(grep 'pkgver' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
@ -16,7 +21,7 @@ build() {
epoch=${epoch}: epoch=${epoch}:
fi fi
if pacman -Si "${name}" 2> /dev/null | grep -v nyyu | grep -c -E '^Repository' &>/dev/null; then if pacman -Si "${name}" 2>/dev/null | grep -v nyyu | grep -c -E '^Repository' &>/dev/null; then
echo "WARN: Found ${name} in arch repo" echo "WARN: Found ${name} in arch repo"
fi fi
@ -40,20 +45,20 @@ git config credential.helper '!f() { sleep 1; echo "username=drone"; echo "passw
for d in */; do for d in */; do
cd "${d}" || continue cd "${d}" || continue
if [ -f PKGBUILD ]; then if [[ -f PKGBUILD ]]; then
echo "--> ${d}" echo "--> ${d}"
if [ -f update.sh ]; then if [[ -f update.sh ]]; then
./update.sh ./update.sh
fi fi
if ! grep -c 'pkgver()' PKGBUILD >/dev/null; then if ! grep -c 'pkgver()' PKGBUILD >/dev/null; then
repo=$(grep -oPm 1 'github\.com\/\K(\w|-)+\/(\w|-)+' .SRCINFO) repo=$(grep -oPm 1 'github\.com\/\K(\w|-)+\/(\w|-)+' .SRCINFO)
if [ -n "${repo}" ]; then if [[ -n "${repo}" ]]; then
update_github_tag "${repo}" update_github_tag "${repo}"
fi fi
fi fi
update_pkg update_pkg
build build true
fi fi
cd .. cd ..
done done
@ -61,12 +66,12 @@ done
while read -r p; do while read -r p; do
git clone https://aur.archlinux.org/"${p}".git || continue git clone https://aur.archlinux.org/"${p}".git || continue
cd "${p}" || continue cd "${p}" || continue
build build false
cd .. cd ..
done <aur.txt done <aur.txt
del=$(git --no-pager diff ${CI_PREV_COMMIT_SHA}..HEAD aur.txt | tail -n +4 | grep -E '^-' | cut -c2-) del=$(git --no-pager diff ${CI_PREV_COMMIT_SHA}..HEAD aur.txt | tail -n +4 | grep -E '^-' | cut -c2-)
if [ -n "${del}" ]; then if [[ -n "${del}" ]]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
repo-remove -s /repo/nyyu.db.tar.zst ${del} || true repo-remove -s /repo/nyyu.db.tar.zst ${del} || true
fi fi