Compare commits

...

8 Commits

Author SHA1 Message Date
Marius Kittler 748ca90359 Adjust systemd-nspawn flags
* Remove --keep-unit since it causes sometimes errors and does not seem
  to be required
* Increase maximum number of open files (the default of 1000 is too less
  for some packages)
* Use /etc/resolv.conf from host (otherwise systemd-nspawn uses a config
  which does not work on my host setup)
2019-08-10 22:56:30 +02:00
Kevin Mihelich 69d1132881 makechrootpkg: don't delete MAKEFLAGS and PACKAGER 2019-08-10 22:56:30 +02:00
Kevin Mihelich 84b0812df1 archbuild: no setarch 2019-08-10 22:56:30 +02:00
Kevin Mihelich 452d0997bf makechrootpkg: no default logging 2019-08-10 22:55:36 +02:00
Kevin Mihelich 4d71d26d2f arch-nspawn: arm fix 2019-08-10 22:53:53 +02:00
Kevin Mihelich 0a8dc72757 makechrootpkg: distcc 2019-08-10 22:52:54 +02:00
Kevin Mihelich abace432ad arch-nspawn: keep mirrorlist 2019-08-10 22:52:54 +02:00
Kevin Mihelich 0e34558ff8 makechrootpkg: cache dir 2019-08-10 22:51:04 +02:00
3 changed files with 17 additions and 12 deletions

View File

@ -99,7 +99,7 @@ build_mount_args() {
copy_hostconf () {
unshare --fork --pid gpg --homedir "$working_dir"/etc/pacman.d/gnupg/ --no-permission-warning --quiet --batch --import --import-options import-local-sigs "$(pacman-conf GpgDir)"/pubring.gpg >/dev/null 2>&1
pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg/ --import-trustdb "$(pacman-conf GpgDir)" >/dev/null 2>&1
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"
@ -130,9 +130,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[@]}" \
"$@"

View File

@ -69,7 +69,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
mkdir -m755 -p "${chroots}/${repo}-${arch}"
setarch "${arch}" mkarchroot \
mkarchroot \
-C "${pacman_config}" \
-M "${makepkg_config}" \
"${chroots}/${repo}-${arch}/root" \

View File

@ -15,7 +15,7 @@ m4_include(lib/archroot.sh)
shopt -s nullglob
default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
default_makepkg_args=(--syncdeps --noconfirm --holdver --skipinteg)
makepkg_args=("${default_makepkg_args[@]}")
verifysource_args=()
chrootdir=
@ -61,6 +61,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'
@ -187,9 +188,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"
@ -229,7 +228,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)
@ -261,7 +262,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 "${verifysource_args[@]}" ||
makepkg -A --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
die "Could not download sources."
}
@ -296,12 +297,13 @@ move_products() {
}
# }}}
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=1 ;;
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
d) bindmounts_rw+=("--bind=$OPTARG") ;;
u) update_first=1 ;;
C) cache_dir="$OPTARG" ;;
r) passeddir="$OPTARG" ;;
I) install_pkgs+=("$OPTARG") ;;
l) copy="$OPTARG" ;;
@ -386,7 +388,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[@]}" \