Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch-nspawn.in6
-rw-r--r--src/archbuild.in16
-rw-r--r--src/lib/repo/arch32.sh33
-rw-r--r--src/lib/repo/clone.sh12
-rw-r--r--src/lib/valid-tags.sh7
-rw-r--r--src/makechrootpkg.in14
-rw-r--r--src/mkarchroot.in5
7 files changed, 86 insertions, 7 deletions
diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in
index 1eba0a6..8fcdead 100644
--- a/src/arch-nspawn.in
+++ b/src/arch-nspawn.in
@@ -70,7 +70,7 @@ if (( ${#cache_dirs[@]} == 0 )); then
fi
# shellcheck disable=2016
-host_mirrors=($(pacman-conf --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
+host_mirrors=($(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#;t;s#(.*/)[^/]+/extra(/?)$#\1$arch/$repo\2#'))
for host_mirror in "${host_mirrors[@]}"; do
if [[ $host_mirror == *file://* ]]; then
@@ -103,7 +103,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/repo/arch32.sh b/src/lib/repo/arch32.sh
new file mode 100644
index 0000000..3ee248e
--- /dev/null
+++ b/src/lib/repo/arch32.sh
@@ -0,0 +1,33 @@
+# does local adaptions needed to build for Archlinux32
+pkgctl_repo_patch_arch32() {
+ local pkgname="$1"
+
+ # add the remote branch with our patches
+ git -C "${pkgname}" remote add -m master archlinux32 git://git.archlinux32.org/packages
+ git -C "${pkgname}" fetch --depth 1 archlinux32
+
+ # extend architecture with our architecture
+ awk -i inplace '!/^arch=[^#]*any/ {gsub(/^arch=\(/,"arch=(i486 i686 pentium4 ")}; {print}' \
+ "${pkgname}/PKGBUILD"
+
+ # iterate the arch32 diffs in the archlinux32/master branch (we don't know
+ # the destination repo, so we just scan both 'core' and 'extra' as well as
+ # 'build-support')
+ listfile=$(mktemp --tmpdir="${WORKDIR}" pkgctl-arch32.XXXXXXXXXX)
+ >"${listfile}"
+ for repo in core extra build-support; do
+ git -C "${pkgname}" ls-tree -r --name-only archlinux32/master "${repo}/${pkgname}" >>"${listfile}"
+ done
+ for file in $(cat "${listfile}"); do
+ if [[ "${file##*/}" = "PKGBUILD" ]]; then
+ if [ -f "${pkgname}/PKGBUILD" ]; then
+ printf "\n\n# -- Arch32 specific --\n\n" >> "${pkgname}/PKGBUILD"
+ git -C "${pkgname}" show archlinux32/master:"${file}" >> "${pkgname}/PKGBUILD"
+ else
+ git -C "${pkgname}" show archlinux32/master:"${file}" > "${pkgname}/PKGBUILD"
+ fi
+ else
+ git -C "${pkgname}" show archlinux32/master:"${file}" > "${pkgname}/${file##*/}"
+ fi
+ done
+}
diff --git a/src/lib/repo/clone.sh b/src/lib/repo/clone.sh
index ef6a0e2..33a333f 100644
--- a/src/lib/repo/clone.sh
+++ b/src/lib/repo/clone.sh
@@ -16,6 +16,8 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/api/gitlab.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/configure.sh
# shellcheck source=src/lib/util/git.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
+# shellcheck source=src/lib/repo/arch32.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/arch32.sh
source /usr/share/makepkg/util/message.sh
@@ -40,6 +42,7 @@ pkgctl_repo_clone_usage() {
--protocol https Clone the repository over https
--switch VERSION Switch the current working tree to a specified version
--universe Clone all existing packages, useful for cache warming
+ --arch32 Make all required modifications to build on Archlinux32
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
-h, --help Show this help text
@@ -63,6 +66,7 @@ pkgctl_repo_clone() {
local MAINTAINER=
local VERSION=
local CONFIGURE_OPTIONS=()
+ local ARCH32=0
local jobs=
jobs=$(nproc)
@@ -124,6 +128,10 @@ pkgctl_repo_clone() {
jobs=$2
shift 2
;;
+ --arch32)
+ ARCH32=1
+ shift
+ ;;
--)
shift
break
@@ -194,5 +202,9 @@ pkgctl_repo_clone() {
if [[ -n "${VERSION}" ]]; then
pkgctl_repo_switch "${VERSION}" "${pkgbase}"
fi
+
+ if (( ARCH32 )); then
+ pkgctl_repo_patch_arch32 "${pkgbase}"
+ fi
done
}
diff --git a/src/lib/valid-tags.sh b/src/lib/valid-tags.sh
index cef0cc6..abca7ef 100644
--- a/src/lib/valid-tags.sh
+++ b/src/lib/valid-tags.sh
@@ -4,13 +4,16 @@
:
# shellcheck disable=2034
-DEVTOOLS_VALID_ARCHES=(
+_arch=(
+ pentium4
+ i686
+ i486
x86_64
any
)
# shellcheck disable=2034
-DEVTOOLS_VALID_TAGS=(
+_tags=(
core-x86_64 core-any
core-staging-x86_64 core-staging-any
core-testing-x86_64 core-testing-any
diff --git a/src/makechrootpkg.in b/src/makechrootpkg.in
index 14b8f11..70eba3c 100644
--- a/src/makechrootpkg.in
+++ b/src/makechrootpkg.in
@@ -182,6 +182,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
@@ -215,6 +218,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.
@@ -222,7 +228,7 @@ _chrootbuild() {
sudo --preserve-env=SOURCE_DATE_EPOCH \
--preserve-env=BUILDTOOL \
--preserve-env=BUILDTOOLVER \
- -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
+ -iu builduser bash -c 'cd /startdir; CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse makepkg "$@"' -bash "$@"
ret=$?
case $ret in
0|14)
@@ -234,7 +240,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
@@ -342,6 +351,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