Add --build-only flag to skip building packages.

This commit is contained in:
Todd C. Miller
2023-01-21 09:43:15 -07:00
parent ec79bbc8e0
commit 733303ed96
2 changed files with 26 additions and 9 deletions

View File

@@ -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

View File

@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: ISC
#
# Copyright (c) 2010-2020 Todd C. Miller <Todd.Miller@sudo.ws>
# Copyright (c) 2010-2023 Todd C. Miller <Todd.Miller@sudo.ws>
#
# 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