PKGBUILDs/alarm/devtools-alarm/0001-makechrootpkg-cache-dir.patch
2021-10-01 23:34:58 +00:00

60 lines
1.8 KiB
Diff

From 003ca8fea163645d1ef73a601f183dfe30d858f6 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Sun, 28 Dec 2014 22:25:58 -0700
Subject: [PATCH 1/8] makechrootpkg: cache dir
---
makechrootpkg.in | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/makechrootpkg.in b/makechrootpkg.in
index d308af2..71ee9c0 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -64,6 +64,7 @@ usage() {
echo 'Flags:'
echo '-h This help'
echo '-c Clean the chroot before building'
+ echo '-X <dir> Set pacman cache to pass to arch-nspawn'
echo '-d <dir> Bind directory into build chroot as read-write'
echo '-D <dir> Bind directory into build chroot as read-only'
echo '-u Update the working copy of the chroot before building'
@@ -277,12 +278,13 @@ move_products() {
}
# }}}
-while getopts 'hcur:I:l:nCTD:d:U:' arg; do
+while getopts 'hcuX:r:I:l:nCTD:d:U:' arg; do
case "$arg" in
c) clean_first=1 ;;
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
d) bindmounts_rw+=("--bind=$OPTARG") ;;
u) update_first=1 ;;
+ X) cache_dir="$OPTARG" ;;
r) passeddir="$OPTARG" ;;
I) install_pkgs+=("$OPTARG") ;;
l) copy="$OPTARG" ;;
@@ -305,6 +307,10 @@ chrootdir=$(readlink -e "$passeddir")
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"
+if [ -n "$cache_dir" ]; then
+ cache_dir="-c $cache_dir"
+fi
+
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
@@ -364,7 +370,7 @@ download_sources
prepare_chroot
-if arch-nspawn "$copydir" \
+if arch-nspawn $cache_dir "$copydir" \
--bind="${PWD//:/\\:}:/startdir" \
--bind="${SRCDEST//:/\\:}:/srcdest" \
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
--
2.30.0