From 733303ed968e11ccad992c570936cfdcf32b090d Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 21 Jan 2023 09:43:15 -0700 Subject: [PATCH] Add --build-only flag to skip building packages. --- scripts/build_pkgs | 13 ++++++++++--- scripts/mkpkg | 22 ++++++++++++++++------ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/scripts/build_pkgs b/scripts/build_pkgs index fe63a39cd..6616c0831 100755 --- a/scripts/build_pkgs +++ b/scripts/build_pkgs @@ -358,6 +358,9 @@ sub run_job { # Name of the config.cache file, if using. $build_args .= "--cache-file config.cache "; } + if (exists $conf->{"no_packages"} && $conf->{"no_packages"}) { + $build_args .= "--no-packages "; + } $status = run_remote_command($conf, "cd $temporary && ./$build_script_base ${build_args}$tarball_base", @@ -828,17 +831,21 @@ sub default_build_script { open(my $fh, ">", $fname); print $fh <<~'EOF'; #!/bin/sh - CONFIGURE_OPTS= + configure_opts= while test $# != 0; do case "$1" in --cache-file) - CONFIGURE_OPTS="--cache-file=../$2" + configure_opts="${configure_opts} --cache-file=../$2" shift 2 ;; --osversion) osversion="$2" shift 2 ;; + --no-packages) + configure_opts="${configure_opts} --build-only" + shift + ;; *) break ;; @@ -866,7 +873,7 @@ sub default_build_script { osversion="`./scripts/pp --probe`" fi - ./scripts/mkpkg $CONFIGURE_OPTS --osversion="$osversion" || exit 1 + ./scripts/mkpkg $configure_opts --osversion="$osversion" || exit 1 for f in *.rpm *.deb *.bff *.depot *.pkg *.txz ../artifacts; do if [ -f "$f" ]; then mv "$f" ../artifacts diff --git a/scripts/mkpkg b/scripts/mkpkg index fc9b4ce83..4e857a37e 100755 --- a/scripts/mkpkg +++ b/scripts/mkpkg @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: ISC # -# Copyright (c) 2010-2020 Todd C. Miller +# Copyright (c) 2010-2023 Todd C. Miller # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # Build a binary package using polypkg -# Usage: mkpkg [--debug] [--flavor flavor] [--platform platform] [--osversion ver] +# Usage: mkpkg [--build-only] [--debug] [--flavor flavor] [--platform platform] [--osversion ver] # # Make sure IFS is set to space, tab, newline in that order. @@ -28,10 +28,11 @@ nl=' IFS=" $nl" # Parse arguments -usage="usage: mkpkg [--debug] [--flavor flavor] [--platform platform] [--osversion ver]" +usage="usage: mkpkg [--build-only] [--debug] [--flavor flavor] [--platform platform] [--osversion ver]" debug=0 flavor=vanilla crossbuild=false +build_packages=true; while test $# -gt 0; do case "$1" in --debug) @@ -80,6 +81,9 @@ while test $# -gt 0; do crossbuild=true configure_opts="${configure_opts}${configure_opts+$tab}$1" ;; + --build-only) + build_packages=false + ;; *) # Pass unknown options to configure configure_opts="${configure_opts}${configure_opts+$tab}$1" @@ -91,11 +95,15 @@ done scriptdir=`dirname $0` configure="${scriptdir}/../configure" -: ${osversion="`$scriptdir/pp --probe`"} -test -n "$osversion" || exit 1 +: ${osversion="`$scriptdir/pp --probe 2>/dev/null || echo unknown`"} osrelease=`echo "$osversion" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'` : ${MAKE=make} +if [ $build_packages = true -a $osversion = unknown ]; then + echo "unable to determine platform" 1>&2 + exit 1 +fi + # If using GNU make, set number of jobs if ${MAKE} --version 2>&1 | grep GNU >/dev/null; then NJOBS=0 @@ -545,7 +553,9 @@ if [ -r Makefile ]; then fi ${configure} "$@" || exit $? ${MAKE} $make_opts || exit $? -${MAKE} $make_opts PPFLAGS="$PPFLAGS" PPVARS="$PPVARS" package +if [ $build_packages = true ]; then + ${MAKE} $make_opts PPFLAGS="$PPFLAGS" PPVARS="$PPVARS" package +fi exitval=$? test $debug -eq 0 && rm -rf destdir