From 55d3c99c4ef9d75e80c0a69817fd07ca6fa3e41a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 21 Jul 2025 20:24:42 -0600 Subject: [PATCH] Add a way to override pp_rpm_arch when building rpms This will be used to build x86_64_v2 packages for Alma Linux. --- etc/sudo-logsrvd.pp | 5 +++++ etc/sudo-python.pp | 5 +++++ etc/sudo.pp | 5 +++++ scripts/mkpkg | 22 +++++++++++++++++++--- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/etc/sudo-logsrvd.pp b/etc/sudo-logsrvd.pp index a904c720e..502dc3459 100644 --- a/etc/sudo-logsrvd.pp +++ b/etc/sudo-logsrvd.pp @@ -128,6 +128,11 @@ This makes it possible to have all sudo I/O logs on a central server." %endif %if [rpm] + # Used to set rpm_arch to x86_64_v2 on Alma Linux + if test -n "$pp_rpm_arch_override"; then + pp_rpm_arch="$pp_rpm_arch_override" + fi + # Add distro info to release osrelease=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*\([0-9]\{1,3\}\).*/\1/'` case "$pp_rpm_distro" in diff --git a/etc/sudo-python.pp b/etc/sudo-python.pp index 97d88d795..7738fcdda 100644 --- a/etc/sudo-python.pp +++ b/etc/sudo-python.pp @@ -84,6 +84,11 @@ %endif %if [rpm] + # Used to set rpm_arch to x86_64_v2 on Alma Linux + if test -n "$pp_rpm_arch_override"; then + pp_rpm_arch="$pp_rpm_arch_override" + fi + # Add distro info to release osrelease=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*\([0-9]\{1,3\}\).*/\1/'` case "$pp_rpm_distro" in diff --git a/etc/sudo.pp b/etc/sudo.pp index 541a56111..499c3c758 100644 --- a/etc/sudo.pp +++ b/etc/sudo.pp @@ -149,6 +149,11 @@ still allow people to get their work done." %endif %if [rpm] + # Used to set rpm_arch to x86_64_v2 on Alma Linux + if test -n "$pp_rpm_arch_override"; then + pp_rpm_arch="$pp_rpm_arch_override" + fi + # Add distro info to release osrelease=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*\([0-9]\{1,3\}\).*/\1/'` case "$pp_rpm_distro" in diff --git a/scripts/mkpkg b/scripts/mkpkg index b6dcec7f9..68b141916 100755 --- a/scripts/mkpkg +++ b/scripts/mkpkg @@ -17,8 +17,8 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # Build a binary package using polypkg -# Usage: mkpkg [--build-only] [--configure-only] [--debug] [--flavor flavor] -# [--platform platform] [--osversion ver] +# Usage: mkpkg [--arch arch] [--build-only] [--configure-only] [--debug] +# [--flavor flavor] [--osversion ver] [--platform platform] # # Make sure IFS is set to space, tab, newline in that order. @@ -29,7 +29,7 @@ nl=' IFS=" $nl" # Parse arguments -usage="usage: mkpkg [--build-only] [--configure-only] [--debug] [--flavor flavor] [--platform platform] [--osversion ver]" +usage="usage: mkpkg [--arch arch] [--build-only] [--configure-only] [--debug] [--flavor flavor] [--osversion ver] [--platform platform]" debug=0 flavor=vanilla crossbuild=false @@ -37,6 +37,18 @@ build_packages=true; build_sudo=true; while test $# -gt 0; do case "$1" in + --arch=?*) + arch=`echo "$1" | sed -n 's/^--arch=\(.*\)/\1/p'` + ;; + --arch) + arch=`echo "$1" | sed -n 's/^--arch=\(.*\)/\1/p'` + if [ $# -lt 2 ]; then + echo "$usage" 1>&2 + exit 1 + fi + arch="$2" + shift + ;; --debug) set -x debug=1 @@ -208,6 +220,10 @@ case "$osversion" in ;; esac + if [ -n "$arch" ]; then + # Override the default rpm arch for, e.g. x86_64_v2 + PPVARS="${PPVARS}${PPVARS+$space}pp_rpm_arch_override=$arch" + fi if [ X"$with_selinux" = X"true" ]; then configure_opts="${configure_opts}${configure_opts+$tab}--with-selinux" fi