2021-07-22 03:46:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
|
|
|
|
RED=$(tput setaf 1)
|
|
|
|
BOLD=$(tput bold)
|
|
|
|
RESET=$(tput sgr0)
|
|
|
|
readonly RED BOLD RESET
|
|
|
|
|
|
|
|
traperr() {
|
|
|
|
s=$?
|
|
|
|
echo "$0: $BASH_COMMAND"
|
|
|
|
exit $s
|
|
|
|
}
|
|
|
|
|
|
|
|
trap traperr ERR
|
|
|
|
|
2021-10-29 06:46:08 +00:00
|
|
|
PACKAGES=("$@")
|
|
|
|
EXTRA_ARGS=()
|
2021-12-01 16:49:03 +00:00
|
|
|
REPOSITORY="grawlinson"
|
2021-07-22 03:46:19 +00:00
|
|
|
|
|
|
|
if [ ${#PACKAGES[@]} -eq 0 ]; then
|
|
|
|
echo "${BOLD}${RED}ERROR:${RESET}${BOLD} no packages specified${RESET}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
for package in "${PACKAGES[@]}"; do
|
|
|
|
(
|
|
|
|
# change to package directory
|
2021-10-29 06:46:08 +00:00
|
|
|
cd "$package" || exit 1
|
|
|
|
|
|
|
|
# capture output for parsing dependencies
|
|
|
|
makepkg_output=$(makepkg --printsrcinfo)
|
|
|
|
|
2021-11-25 06:40:59 +00:00
|
|
|
#
|
|
|
|
# cache various downloads
|
|
|
|
#
|
|
|
|
# rust - crates
|
2021-10-29 06:46:08 +00:00
|
|
|
if grep -q "depends = rust\|cargo" <<<"$makepkg_output"; then
|
2022-04-27 07:50:27 +00:00
|
|
|
EXTRA_ARGS+=(
|
|
|
|
--bind-rw /var/cache/cargo/git:/build/.cargo/git
|
|
|
|
--bind-rw /var/cache/cargo/registry:/build/.cargo/registry
|
|
|
|
)
|
2021-10-29 06:46:08 +00:00
|
|
|
fi
|
|
|
|
|
2021-11-25 06:40:59 +00:00
|
|
|
# go - modules
|
2021-10-29 06:46:08 +00:00
|
|
|
if grep -q "depends = go" <<<"$makepkg_output"; then
|
2022-06-18 00:54:15 +00:00
|
|
|
EXTRA_ARGS+=(
|
|
|
|
--bind-rw /var/cache/golang/pkg:/build/go/pkg
|
|
|
|
--bind-rw /var/cache/golang/build:/build/.cache/go-build
|
|
|
|
)
|
2021-10-29 06:46:08 +00:00
|
|
|
fi
|
2021-07-22 03:46:19 +00:00
|
|
|
|
2021-11-25 06:40:59 +00:00
|
|
|
# dart - packages
|
|
|
|
if grep -q "depends = dart" <<<"$makepkg_output"; then
|
|
|
|
EXTRA_ARGS+=(--bind-rw /var/cache/dartlang:/build/.pub-cache)
|
|
|
|
fi
|
|
|
|
|
2022-01-04 20:11:14 +00:00
|
|
|
# javascript - npm/yarn/pkg
|
|
|
|
if grep -q "depends = npm\|yarn\|nodejs" <<<"$makepkg_output"; then
|
|
|
|
EXTRA_ARGS+=(
|
|
|
|
--bind-rw /var/cache/javascript/npm:/build/.npm
|
|
|
|
--bind-rw /var/cache/javascript/pkg-cache:/build/.pkg-cache
|
2022-06-17 07:09:47 +00:00
|
|
|
--bind-rw /var/cache/javascript/yarn:/build/.cache/yarn
|
2022-06-18 03:53:03 +00:00
|
|
|
--bind-rw /var/cache/javascript/electron:/build/.cache/electron
|
2022-08-26 23:30:36 +00:00
|
|
|
--bind-rw /var/cache/javascript/cypress:/build/.cache/Cypress
|
2022-01-04 20:11:14 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2022-09-30 02:55:55 +00:00
|
|
|
# nim - nim/nimble
|
|
|
|
if grep -q "depends = nim\|nimble" <<<"$makepkg_output"; then
|
|
|
|
EXTRA_ARGS+=(
|
|
|
|
--bind-rw /var/cache/nim/nim-cache:/build/.cache/nim
|
|
|
|
--bind-rw /var/cache/nim/nimble:/build/.nimble
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2021-07-22 03:46:19 +00:00
|
|
|
# build signed package in chroot & add to local repo
|
|
|
|
aur build \
|
|
|
|
--chroot \
|
|
|
|
--gpg-sign \
|
|
|
|
--remove \
|
|
|
|
--force \
|
2021-12-01 16:49:03 +00:00
|
|
|
--database="$REPOSITORY" \
|
|
|
|
--makepkg-conf="/etc/aurutils/makepkg-$REPOSITORY.conf" \
|
2021-10-29 06:46:08 +00:00
|
|
|
"${EXTRA_ARGS[@]}"
|
2021-10-29 22:34:38 +00:00
|
|
|
|
|
|
|
# reset EXTRA_ARGS
|
|
|
|
EXTRA_ARGS=()
|
2021-07-22 03:46:19 +00:00
|
|
|
)
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 et
|