build: cache Rust/Go downloads when required
This commit is contained in:
parent
03f4517adf
commit
3248cee07f
1 changed files with 18 additions and 3 deletions
19
.repo/build
19
.repo/build
|
@ -15,6 +15,7 @@ traperr() {
|
||||||
trap traperr ERR
|
trap traperr ERR
|
||||||
|
|
||||||
PACKAGES=("$@")
|
PACKAGES=("$@")
|
||||||
|
EXTRA_ARGS=()
|
||||||
|
|
||||||
if [ ${#PACKAGES[@]} -eq 0 ]; then
|
if [ ${#PACKAGES[@]} -eq 0 ]; then
|
||||||
echo "${BOLD}${RED}ERROR:${RESET}${BOLD} no packages specified${RESET}"
|
echo "${BOLD}${RED}ERROR:${RESET}${BOLD} no packages specified${RESET}"
|
||||||
|
@ -24,7 +25,20 @@ fi
|
||||||
for package in "${PACKAGES[@]}"; do
|
for package in "${PACKAGES[@]}"; do
|
||||||
(
|
(
|
||||||
# change to package directory
|
# change to package directory
|
||||||
cd "$package" || exit 1;
|
cd "$package" || exit 1
|
||||||
|
|
||||||
|
# capture output for parsing dependencies
|
||||||
|
makepkg_output=$(makepkg --printsrcinfo)
|
||||||
|
|
||||||
|
# cache downloaded crates
|
||||||
|
if grep -q "depends = rust\|cargo" <<<"$makepkg_output"; then
|
||||||
|
EXTRA_ARGS+=(--bind-rw /var/cache/cargo:/build/.cargo)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cache downloaded modules
|
||||||
|
if grep -q "depends = go" <<<"$makepkg_output"; then
|
||||||
|
EXTRA_ARGS+=(--bind-rw /var/cache/golang:/build/go)
|
||||||
|
fi
|
||||||
|
|
||||||
# build signed package in chroot & add to local repo
|
# build signed package in chroot & add to local repo
|
||||||
aur build \
|
aur build \
|
||||||
|
@ -32,7 +46,8 @@ for package in "${PACKAGES[@]}"; do
|
||||||
--gpg-sign \
|
--gpg-sign \
|
||||||
--remove \
|
--remove \
|
||||||
--force \
|
--force \
|
||||||
--makepkg-conf=/etc/aurutils/makepkg-grawlinson.conf
|
--makepkg-conf=/etc/aurutils/makepkg-grawlinson.conf \
|
||||||
|
"${EXTRA_ARGS[@]}"
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue