index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | src/arch-nspawn.in | 4 | ||||
-rw-r--r-- | src/archbuild.in | 16 | ||||
-rw-r--r-- | src/lib/valid-tags.sh | 1 | ||||
-rw-r--r-- | src/makechrootpkg.in | 12 | ||||
-rw-r--r-- | src/mkarchroot.in | 5 |
diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in index 1453ba0..11af616 100644 --- a/src/arch-nspawn.in +++ b/src/arch-nspawn.in @@ -94,7 +94,9 @@ 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[@]}" | \ + tee "$working_dir/etc/pacman.d/mirrorlist" > \ + "$working_dir/etc/pacman.d/mirrorlist32" [[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf" [[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf" diff --git a/src/archbuild.in b/src/archbuild.in index 2f3faf9..d023e0d 100644 --- a/src/archbuild.in +++ b/src/archbuild.in @@ -76,6 +76,14 @@ done check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME "${BASH_SOURCE[0]}" "$@" +if [ "${arch}" = "x86_64" ]; then + cache_dir='' +else + mkdir -p '/var/cache/archbuild32' + cache_dir='-c/var/cache/archbuild32' + makechrootpkg_args+=('-d/var/cache/archbuild32:/var/cache/pacman/pkg') +fi + # Pass all arguments after -- right to makepkg makechrootpkg_args+=("${@:$OPTIND}") @@ -89,6 +97,12 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then lock 9 "$copy.lock" "Locking chroot copy '%s'" "$copy" subvolume_delete_recursive "${copy}" + find "${copy}" \ + -mindepth 1 \ + -type d \ + -exec mountpoint -q {} \; \ + -prune \ + -exec umount -l {} \; rm -rf --one-file-system "${copy}" done lock_close 9 @@ -98,6 +112,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then setarch "${set_arch}" mkarchroot \ -C "${pacman_config}" \ -M "${makepkg_config}" \ + ${cache_dir} \ "${chroots}/${repo}-${arch}/root" \ "${base_packages[@]}" || abort else @@ -105,6 +120,7 @@ else arch-nspawn \ -C "${pacman_config}" \ -M "${makepkg_config}" \ + ${cache_dir} \ "${chroots}/${repo}-${arch}/root" \ pacman -Syuu --noconfirm || abort fi diff --git a/src/lib/valid-tags.sh b/src/lib/valid-tags.sh index ca8d7d7..5382c5c 100644 --- a/src/lib/valid-tags.sh +++ b/src/lib/valid-tags.sh @@ -5,6 +5,7 @@ # shellcheck disable=2034 _arch=( + i686 x86_64 any ) diff --git a/src/makechrootpkg.in b/src/makechrootpkg.in index 2cfd849..aac7a0b 100644 --- a/src/makechrootpkg.in +++ b/src/makechrootpkg.in @@ -176,6 +176,9 @@ prepare_chroot() { grep -q "^$x" "$copydir/etc/makepkg.conf" && continue echo "$x" >>"$copydir/etc/makepkg.conf" done + if [ -n "${PKGEXT}" ]; then + sed -i 's/^PKGEXT=.*/PKGEXT='"'${PKGEXT}'"'/' "$copydir/etc/makepkg.conf" + fi cat > "$copydir/etc/sudoers.d/builduser-pacman" <<EOF builduser ALL = NOPASSWD: /usr/bin/pacman @@ -209,6 +212,9 @@ _chrootbuild() { # shellcheck source=/dev/null . /etc/profile + # otherwise we might have missing keys + pacman-key --populate + # Beware, there are some stupid arbitrary rules on how you can # use "$" in arguments to commands with "sudo -i". ${foo} or # ${1} is OK, but $foo or $1 isn't. @@ -228,7 +234,10 @@ _chrootbuild() { _chrootnamcap() { pacman -S --needed --noconfirm namcap - for pkgfile in /startdir/PKGBUILD /pkgdest/*; do + for pkgfile in /startdir/PKGBUILD /startdir/*.pkg.tar.xz /pkgdest/*; do + if [ ! -f "${pkgfile}" ]; then + continue + fi echo "Checking ${pkgfile##*/}" sudo -u builduser namcap "$pkgfile" 2>&1 | tee "/logdest/${pkgfile##*/}-namcap.log" done @@ -331,6 +340,7 @@ done umask 0022 ORIG_HOME=$HOME +PKGEXT=$PKGEXT IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}") load_makepkg_config HOME=$ORIG_HOME diff --git a/src/mkarchroot.in b/src/mkarchroot.in index fc60b4e..2abe001 100644 --- a/src/mkarchroot.in +++ b/src/mkarchroot.in @@ -91,12 +91,15 @@ done unshare --mount pacstrap -${umode}Mc ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' -printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen" +printf '%s.UTF-8 UTF-8\n' C en_US de_DE > "$working_dir/etc/locale.gen" +cat '/etc/hosts' > "$working_dir/etc/hosts" echo 'LANG=C.UTF-8' > "$working_dir/etc/locale.conf" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" systemd-machine-id-setup --root="$working_dir" +pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg --init + exec arch-nspawn \ "${nspawn_args[@]}" \ "$working_dir" locale-gen |