Compare commits
8 Commits
master
...
custom-201
Author | SHA1 | Date |
---|---|---|
Marius Kittler | ee21929673 | |
Kevin Mihelich | 7579084455 | |
Kevin Mihelich | bf3a93ce05 | |
Kevin Mihelich | ac0d04dd48 | |
Kevin Mihelich | 18bae8acef | |
Kevin Mihelich | f0ede5a66d | |
Kevin Mihelich | 0b10b0f589 | |
Kevin Mihelich | 0482ed934e |
|
@ -83,7 +83,7 @@ build_mount_args() {
|
|||
|
||||
copy_hostconf () {
|
||||
cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d"
|
||||
printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
|
||||
#printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
|
||||
|
||||
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
|
||||
[[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf"
|
||||
|
@ -114,9 +114,12 @@ eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")"
|
|||
|
||||
[[ -z $nosetarch ]] || unset CARCH
|
||||
|
||||
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \
|
||||
exec systemd-nspawn -q \
|
||||
-D "$working_dir" \
|
||||
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
|
||||
--register=no --keep-unit --as-pid2 \
|
||||
--register=no \
|
||||
--as-pid2 \
|
||||
--rlimit=NOFILE=10000 \
|
||||
--resolv-conf=copy-host \
|
||||
"${mount_args[@]}" \
|
||||
"$@"
|
||||
|
|
|
@ -60,7 +60,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
|||
|
||||
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
|
||||
mkdir -p "${chroots}/${repo}-${arch}"
|
||||
setarch "${arch}" mkarchroot \
|
||||
mkarchroot \
|
||||
-C "@pkgdatadir@/pacman-${repo}.conf" \
|
||||
-M "@pkgdatadir@/makepkg-${arch}.conf" \
|
||||
"${chroots}/${repo}-${arch}/root" \
|
||||
|
|
|
@ -38,6 +38,7 @@ usage() {
|
|||
echo 'Flags:'
|
||||
echo '-h This help'
|
||||
echo '-c Clean the chroot before building'
|
||||
echo '-C <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'
|
||||
|
@ -183,9 +184,7 @@ prepare_chroot() {
|
|||
|
||||
$install -d "$copydir"/{build,startdir,{pkg,srcpkg,src,log}dest}
|
||||
|
||||
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
|
||||
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
|
||||
"MAKEFLAGS='${MAKEFLAGS:-}'" "PACKAGER='${PACKAGER:-}'"
|
||||
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest
|
||||
do
|
||||
grep -q "^$x" "$copydir/etc/makepkg.conf" && continue
|
||||
echo "$x" >>"$copydir/etc/makepkg.conf"
|
||||
|
@ -225,7 +224,9 @@ _chrootbuild() {
|
|||
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||
# ${1} is OK, but $foo or $1 isn't.
|
||||
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||
mkdir /build/.distcc
|
||||
chown builduser /build/.distcc
|
||||
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser DISTCC_IO_TIMEOUT=1200 DISTCC_DIR='/build/.distcc' bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||
ret=$?
|
||||
case $ret in
|
||||
0|14)
|
||||
|
@ -256,7 +257,7 @@ download_sources() {
|
|||
# Ensure sources are downloaded
|
||||
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME \
|
||||
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
|
||||
makepkg -A --config="$copydir/etc/makepkg.conf" --verifysource -o ||
|
||||
die "Could not download sources."
|
||||
}
|
||||
|
||||
|
@ -300,7 +301,7 @@ move_products() {
|
|||
# }}}
|
||||
|
||||
main() {
|
||||
default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
|
||||
default_makepkg_args=(--syncdeps --noconfirm --holdver --skipinteg)
|
||||
makepkg_args=("${default_makepkg_args[@]}")
|
||||
keepbuilddir=false
|
||||
update_first=false
|
||||
|
@ -321,12 +322,13 @@ main() {
|
|||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||
src_owner=${SUDO_USER:-$USER}
|
||||
|
||||
while getopts 'hcur:I:l:nTD:d:U:' arg; do
|
||||
while getopts 'hcuC:r:I:l:nTD:d:U:' arg; do
|
||||
case "$arg" in
|
||||
c) clean_first=true ;;
|
||||
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
||||
d) bindmounts_rw+=("--bind=$OPTARG") ;;
|
||||
u) update_first=true ;;
|
||||
C) cache_dir="$OPTARG" ;;
|
||||
r) passeddir="$OPTARG" ;;
|
||||
I) install_pkgs+=("$OPTARG") ;;
|
||||
l) copy="$OPTARG" ;;
|
||||
|
@ -348,6 +350,10 @@ main() {
|
|||
[[ ! -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
|
||||
|
@ -411,7 +417,7 @@ main() {
|
|||
|
||||
prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
|
||||
|
||||
if arch-nspawn "$copydir" \
|
||||
if arch-nspawn $cache_dir "$copydir" \
|
||||
--bind="$PWD:/startdir" \
|
||||
--bind="$SRCDEST:/srcdest" \
|
||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||
|
|
Loading…
Reference in New Issue