summaryrefslogtreecommitdiff
path: root/src/chroot-tools/makechrootpkg.sh.patch
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-05 16:52:57 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-05 16:52:57 -0500
commitf5663f08d44091ca16c7f53c492c2594202ba7e5 (patch)
tree93beec630eefb4180c4861fd187d5f4d93d66250 /src/chroot-tools/makechrootpkg.sh.patch
parentbd47fdc61018da61cbd0b1978e04a27239a380b5 (diff)
update to the new devtools
Diffstat (limited to 'src/chroot-tools/makechrootpkg.sh.patch')
-rw-r--r--src/chroot-tools/makechrootpkg.sh.patch95
1 files changed, 45 insertions, 50 deletions
diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch
index 4dd1146..672da83 100644
--- a/src/chroot-tools/makechrootpkg.sh.patch
+++ b/src/chroot-tools/makechrootpkg.sh.patch
@@ -1,5 +1,5 @@
---- makechrootpkg.sh.in 2013-10-26 14:53:57.000000000 -0400
-+++ makechrootpkg.sh.ugly 2013-11-16 15:14:04.000000000 -0500
+--- makechrootpkg.sh.in 2014-01-05 00:02:08.650446097 -0500
++++ makechrootpkg.sh.ugly 2014-01-05 00:20:01.914448010 -0500
@@ -12,6 +12,7 @@
shopt -s nullglob
@@ -38,9 +38,9 @@
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
-@@ -110,30 +110,47 @@
- repack=true
- fi
+@@ -115,30 +115,48 @@
+ esac
+ done
-if [[ -n $SUDO_USER ]]; then
+if [[ -n ${SUDO_USER:-} ]]; then
@@ -54,8 +54,9 @@
+# Usage: load_vars $makepkg_conf
+# Globals:
+# - SRCDEST
-+# - LOGDEST
++# - SRCPKGDEST
+# - PKGDEST
++# - LOGDEST
+# - MAKEFLAGS
+# - PACKAGER
load_vars() {
@@ -63,7 +64,7 @@
[[ -f $makepkg_conf ]] || return 1
- for var in {SRC,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
+ for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
- [[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf")
+ [[ -z ${!var:-} ]] && eval $(grep "^${var}=" "$makepkg_conf")
done
@@ -92,7 +93,7 @@
# Get a read lock on the root chroot to make
# sure we don't clone a half-updated chroot
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
-@@ -154,11 +171,16 @@
+@@ -159,11 +177,16 @@
# Drop the read lock again
lock_close 8
@@ -112,7 +113,7 @@
if [[ "$chroottype" == btrfs ]]; then
btrfs subvolume delete "$copydir" >/dev/null ||
die "Unable to delete subvolume %s" "$copydir"
-@@ -173,9 +195,14 @@
+@@ -178,9 +201,14 @@
stat_done
}
@@ -127,7 +128,7 @@
for install_pkg in "${install_pkgs[@]}"; do
pkgname="${install_pkg##*/}"
cp "$install_pkg" "$copydir/$pkgname"
-@@ -188,11 +215,19 @@
+@@ -193,11 +221,19 @@
rm "$copydir/$pkgname"
done
@@ -149,9 +150,9 @@
$repack || rm -rf "$copydir/build"
mkdir -p "$copydir/build"
-@@ -226,12 +261,12 @@
+@@ -236,12 +272,12 @@
- chown -R nobody "$copydir"/{build,pkgdest,logdest,srcdest,startdir}
+ chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
- if [[ -n $MAKEFLAGS ]]; then
+ if [[ -n ${MAKEFLAGS:-} ]]; then
@@ -164,7 +165,7 @@
sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf"
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
fi
-@@ -244,20 +279,38 @@
+@@ -254,20 +290,38 @@
chmod 440 "$copydir/etc/sudoers.d/nobody-pacman"
fi
@@ -179,11 +180,10 @@
+
# This is a little gross, but this way the script is recreated every time in the
# working copy
-- printf $'#!/bin/bash\n%s\n_chrootbuild %q "$@"' "$(declare -f _chrootbuild)" \
-+ printf '#!/bin/bash\n%s\n_chrootprepare "$@"' "$(declare -f _chrootprepare)" \
++ printf $'#!/bin/bash\n%s\n_chrootprepare "$@"' "$(declare -f _chrootprepare)" \
+ > "$copydir/chrootprepare"
+ chmod +x "$copydir/chrootprepare"
-+ printf '#!/bin/bash\n%s\n_chrootbuild %q "$@"' "$(declare -f _chrootbuild)" \
+ printf $'#!/bin/bash\n%s\n_chrootbuild %q "$@"' "$(declare -f _chrootbuild)" \
"$run_namcap" >"$copydir/chrootbuild"
chmod +x "$copydir/chrootbuild"
}
@@ -206,7 +206,7 @@
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
else
( export SRCDEST BUILDDIR="$builddir"
-@@ -267,20 +320,15 @@
+@@ -277,20 +331,18 @@
(( $? != 0 )) && die "Could not download sources."
# Clean up garbage from verifysource
@@ -221,28 +221,19 @@
- local run_namcap="$1"; shift
- local makepkg_args=("$@")
-
-- . /etc/profile
-- export HOME=/build
-- shopt -s nullglob
+ . /etc/profile
+ export HOME=/build
+ shopt -s nullglob
# XXX: Workaround makepkg disliking read-only dirs
+ rm -rf -- /srcdest/* /startdir/*
ln -sft /srcdest /srcdest_host/*
ln -sft /startdir /startdir_host/*
-@@ -295,15 +343,27 @@
- done
- done
-
-- cd /startdir
--
- # XXX: Keep PKGBUILD writable for pkgver()
-- rm PKGBUILD*
-- cp /startdir_host/PKGBUILD* .
-- chown nobody PKGBUILD*
-+ rm /startdir/PKGBUILD*
-+ cp /startdir_host/PKGBUILD* /startdir
-+ chown nobody /startdir/PKGBUILD*
+@@ -313,9 +365,23 @@
+ rm PKGBUILD*
+ cp /startdir_host/PKGBUILD* .
+ chown nobody PKGBUILD*
+}
+
+_chrootbuild() {
@@ -263,7 +254,7 @@
echo "Can't write to PKGBUILD!"
exit 1
fi
-@@ -321,12 +381,24 @@
+@@ -333,12 +399,24 @@
exit 0
}
@@ -286,9 +277,9 @@
+ local l
for l in "$copydir"/logdest/*; do
+ [[ $l == */logpipe.* ]] && continue
chown "$src_owner" "$l"
- mv "$l" "$LOGDEST"
-@@ -334,6 +406,10 @@
+@@ -352,6 +430,10 @@
}
# }}}
@@ -299,25 +290,23 @@
umask 0022
load_vars /etc/makepkg.conf
-@@ -344,17 +420,25 @@
- [[ -d $SRCDEST ]] || SRCDEST=$PWD
- [[ -d $LOGDEST ]] || LOGDEST=$PWD
+@@ -363,30 +445,45 @@
+ [[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
+ [[ -d $LOGDEST ]] || LOGDEST=$PWD
-create_chroot
+# Lock the chroot we want to use. We'll keep this lock until we exit.
+lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
-
--$update_first && arch-nspawn "$copydir" \
-- "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
-- pacman -Syu --noconfirm
++
+if [[ ! -d $copydir ]] || $clean_first; then
+ sync_chroot "$chrootdir" "$copy"
+fi
--[[ -n ${install_pkgs[*]} ]] && install_packages
-+$update_first && arch-nspawn "$copydir" pacman -Syu --noconfirm
+ $update_first && arch-nspawn "$copydir" \
+ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
+ pacman -Syu --noconfirm
--prepare_chroot
+-[[ -n ${install_pkgs[*]} ]] && install_packages
+if [[ -n ${install_pkgs[*]:-} ]]; then
+ install_packages "$copydir" "${install_pkgs[@]}"
+ ret=$?
@@ -325,15 +314,21 @@
+ [[ -f PKGBUILD ]] || exit $ret
+fi
--download_sources
+-prepare_chroot
+prepare_chroot "$copydir" "$USER_HOME" "$repack"
-+
+
+-download_sources
+download_sources "$copydir" "$src_owner"
if arch-nspawn "$copydir" \
--bind-ro="$PWD:/startdir_host" \
-@@ -362,12 +446,12 @@
+ --bind-ro="$SRCDEST:/srcdest_host" \
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
++ /chrootprepare &&
++ arch-nspawn "$copydir" \
++ --bind-ro="$PWD:/startdir_host" \
++ --bind-ro="$SRCDEST:/srcdest_host" \
++ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
/chrootbuild "${makepkg_args[@]}"
then
- move_products
@@ -347,7 +342,7 @@
if (( ret != 0 )); then
if $temp_chroot; then
-@@ -378,3 +462,4 @@
+@@ -397,3 +494,4 @@
else
true
fi