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.in8
-rw-r--r--src/archbuild.in16
-rw-r--r--src/lib/repo/arch32.sh74
-rw-r--r--src/lib/repo/clone.sh12
-rw-r--r--src/lib/valid-tags.sh6
-rw-r--r--src/makechrootpkg.in16
-rw-r--r--src/mkarchroot.in5
7 files changed, 128 insertions, 9 deletions
diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in
index bd99adc..54e474f 100644
--- a/src/arch-nspawn.in
+++ b/src/arch-nspawn.in
@@ -72,8 +72,8 @@ 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_cachemirrors=($(pacman-conf --repo extra CacheServer 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#'))
+host_cachemirrors=($(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo extra CacheServer 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
for host_mirror in "${host_mirrors[@]}"; do
if [[ $host_mirror == *file://* ]]; then
@@ -106,7 +106,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 $host_cachemirrors ]] && printf 'CacheServer = %s\n' "${host_cachemirrors[@]}" >>"$working_dir/etc/pacman.d/mirrorlist"
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..7bdf628
--- /dev/null
+++ b/src/lib/repo/arch32.sh
@@ -0,0 +1,74 @@
+# does local adaptions needed to build for Archlinux32
+# (this should be held in sync with builder/lib/common-functions mangle_pkgbuild)
+#
+# mangle_pkgbuild $PKGBUILD [$sub_pkgrel]
+#
+# append $sub_pkgrel to the pkgrel
+# remove $pkgrel from {make,check,opt,}depends
+pkgctl_repo_patch_arch32() {
+ local pkgname="$1"
+
+ #~ local PKGBUILD="$1"
+ #~ local sub_pkgrel="$2"
+
+ # 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
+
+ #~ if [ -n "${sub_pkgrel}" ]; then
+ #~ sub_pkgrel=".${sub_pkgrel}"
+ #~ fi
+
+ # extend architecture with our architecture
+ awk -i inplace '!/^arch=[^#]*any/ {gsub(/^arch=\(/,"arch=(i486 i686 pentium4 ")}; {print}' \
+ "${pkgname}/PKGBUILD"
+
+ #~ if grep -q '^\s*pkgname=["'"'"']\?lib32-' "${pkgname}/${PKGBUILD}"; then
+ #~ sed -i '
+ #~ s/^\(\s*pkgrel=\)['"'"'"]\?\([0-9]\+\)\.[0-9]*['"'"'"]\?\s*\(#.*\)\?$/\1"\2"/
+ #~ ' "${pkgname}/PKGBUILD"
+ #~ fi
+
+ #~ sed -i '
+ #~ s/^\(\s*pkgrel=\)['"'"'"]\?\([0-9]\+\)\(\.[0-9.]*\)\?['"'"'"]\?\s*\(#.*\)\?$/\1"\2'"${sub_pkgrel:-\\3}"'"/
+ #~ ' "${pkgname}/PKGBUILD"
+
+ # remove "lib32-" and "gcc-multilib" from {make,check,opt,}depends
+ # shellcheck disable=SC2016
+ sed -i '
+ /^\s*\(make\|check\|opt\|\)depends\(_[^=[:space:]]\+\)\?=(/ {
+ :a
+ /^\s*\(\S[^=]*\)=(\(\([^()"'"'"']\|"[^"]*"\|['"'"'][^'"'"']*['"'"']\s*\)*\(#[^\n]*\n\)\?\)*)/! {
+ $b
+ N
+ ba
+ }
+ :b
+ s/\(=.*["'"'"'([:space:]]\)lib32-/\1/g
+ s/\(=.*["'"'"'([:space:]]\)gcc-multilib\(["'"'"')[:space:]]\)/\1gcc\2/g
+ s/\(=.*["'"'"'([:space:]][^[:space:]$]\+[<=>]\S\+\)-[^:"'"'"')[:space:]]\+\([:"'"'"')[:space:]]\)/\1\2/g
+ tb
+ }
+ ' "${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 62e40ae..ef2c5bf 100644
--- a/src/lib/valid-tags.sh
+++ b/src/lib/valid-tags.sh
@@ -5,7 +5,9 @@
# shellcheck disable=2034
DEVTOOLS_VALID_BINARY_ARCHES=(
- x86_64
+ pentium4
+ i686
+ i486
)
# shellcheck disable=2034
@@ -15,7 +17,7 @@ DEVTOOLS_VALID_ARCHES=(
)
# 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 9df14e8..30f78c8 100644
--- a/src/makechrootpkg.in
+++ b/src/makechrootpkg.in
@@ -184,6 +184,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
@@ -222,6 +225,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.
@@ -229,7 +235,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; GIT_TERMINAL_PROMPT=0 CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse makepkg "$@"' -bash "$@"
ret=$?
case $ret in
0|14)
@@ -241,7 +247,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
@@ -254,7 +263,7 @@ download_sources() {
# Ensure sources are downloaded
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME,SSH_AUTH_SOCK \
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
- makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
+ GIT_TERMINAL_PROMPT=0 makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
die "Could not download sources."
}
@@ -350,6 +359,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 06cf5d2..c59c26c 100644
--- a/src/mkarchroot.in
+++ b/src/mkarchroot.in
@@ -94,12 +94,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