abr: new ptrcport

This commit is contained in:
psykose 2023-03-26 09:34:49 +00:00
parent c69d9a2b1b
commit e47b48ea7b
3 changed files with 159 additions and 0 deletions

45
abr/APKBUILD Normal file
View file

@ -0,0 +1,45 @@
# Maintainer: psykose <alice@ayaya.dev>
pkgname=abr
pkgver=1
pkgrel=0
pkgdesc="abr~!"
url="https://git.ddd.rip/ptrcnull/aports"
arch="noarch"
license="ISC"
# chrt, ionice
depends="
abuild
util-linux-misc
"
checkdepends="
shellcheck
shfmt
"
source="
abr
apkbuild-anitya
"
builddir="$srcdir"
options="!check" # manual
check() {
shellcheck -s sh .
shfmt \
--diff \
--simplify \
--posix \
--indent 3 \
--space-redirects \
--binary-next-line \
.
}
package() {
install -Dm755 abr apkbuild-anitya \
-t "$pkgdir"/usr/bin/
}
sha512sums="
1a01d9a9cc3fd29622c803193e7b60c4c5855a65db786cb5d826fdd03a2ab071baff70a6bf01d7cd82e2c638a0691700e7810dca070b30071a0ad4066bc73b13 abr
71d8cb1e5e57ff739915fa4de1f5699afa60ab36e2e5219c4c366af5ceab24dc6ee55e738d29ca2b63dd5e387de7661594fc86bf2183d787932e75b4c03c6a9f apkbuild-anitya
"

104
abr/abr Executable file
View file

@ -0,0 +1,104 @@
#!/bin/sh -e
# clean self and do not pass through any environment
# except env, because it doesn't matter too much for this specific purpose
# and a few that are useful to keep some cache paths
if [ -z "$_CLEAN" ]; then
exec env -i \
_CLEAN=1 \
CARGO_HOME="$CARGO_HOME" \
GNUPGHOME="$GNUPGHOME" \
GOCACHE="$GOCACHE" \
GOMODCACHE="$GOMODCACHE" \
GOPATH="$GOPATH" \
GOTMPDIR="$GOTMPDIR" \
HOME="$HOME" \
PATH="$PATH" \
XDG_CACHE_HOME="$XDG_CACHE_HOME" \
XDG_CONFIG_HOME="$XDG_CONFIG_HOME" \
"$0" "$@"
fi
while getopts "j:fmnx" opt; do
case "$opt" in
'j')
jobs="$OPTARG"
export JOBS="$jobs"
export MAKEFLAGS="-j$jobs"
export SAMUFLAGS="-j$jobs"
export CARGO_BUILD_JOBS="$jobs"
;;
'f')
# also run checksum/checkapk
full=1
;;
'm')
# don't set LD_PRELOAD for another alloc
# since i set this normally, this unexports it.
# XXX: funnily, any extra alloc breaks gjs-based testsuites (why?)
nomemhack=1
unset LD_PRELOAD
;;
'n')
nonice=1
;;
'x')
# skip checks
export ABUILD_BOOTSTRAP=1
;;
*)
echo "invalid argument passed"
;;
esac
done
shift "$((OPTIND - 1))"
# loop again to check if rootbld
for arg; do
if eltest "${arg:-x}" =~ "rootbld"; then
# not available in rootbld
nosccache=1
fi
done
if [ -z "$nosccache" ]; then
export RUSTC_WRAPPER=sccache
fi
if [ -z "$nomemhack" ]; then
extra="scudo-malloc"
export LD_PRELOAD="/usr/lib/libscudo.so"
fi
if [ -z "$nonice" ]; then
# max bg idle
# note that there is no nice here,
# but nice is mostly useless with modern linux process groups.
# (and this is in its' own by virtue of a new terminal)
nicewrap="chrt -i 0 ionice -c 2 -n 7"
fi
root="$(git rev-parse --show-toplevel)"
if [ -n "$root" ]; then
# abuild cannot detect the root dir to get .rootbld-repositories
# to work, unless the dir has aports in git remotes or is ~/aports
# ...
export APORTSDIR="$root"
fi
export EXTRADEPENDS_BUILD="$extra pigz xz"
if [ -n "$full" ]; then
abuild checksum
fi
$nicewrap abuild -fr "$@"
if [ -n "$full" ]; then
checkapk
abuild sanitycheck
apkbuild-shellcheck
apkbuild-anitya
fi

10
abr/apkbuild-anitya Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
. APKBUILD
items="$(curl -s "https://release-monitoring.org/api/v2/packages/?name=$pkgname&distribution=Alpine" | jq .total_items)"
if [ "$items" = 0 ]; then
echo "Package $pkgname is not tracked by Anitya."
echo "Add it here: https://release-monitoring.org/"
exit 1
fi