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. # Name of the config.cache file, if using.
$build_args .= "--cache-file config.cache "; $build_args .= "--cache-file config.cache ";
} }
if (exists $conf->{"no_packages"} && $conf->{"no_packages"}) {
$build_args .= "--no-packages ";
}
$status = run_remote_command($conf, $status = run_remote_command($conf,
"cd $temporary && ./$build_script_base ${build_args}$tarball_base", "cd $temporary && ./$build_script_base ${build_args}$tarball_base",
@@ -828,17 +831,21 @@ sub default_build_script {
open(my $fh, ">", $fname); open(my $fh, ">", $fname);
print $fh <<~'EOF'; print $fh <<~'EOF';
#!/bin/sh #!/bin/sh
CONFIGURE_OPTS= configure_opts=
while test $# != 0; do while test $# != 0; do
case "$1" in case "$1" in
--cache-file) --cache-file)
CONFIGURE_OPTS="--cache-file=../$2" configure_opts="${configure_opts} --cache-file=../$2"
shift 2 shift 2
;; ;;
--osversion) --osversion)
osversion="$2" osversion="$2"
shift 2 shift 2
;; ;;
--no-packages)
configure_opts="${configure_opts} --build-only"
shift
;;
*) *)
break break
;; ;;
@@ -866,7 +873,7 @@ sub default_build_script {
osversion="`./scripts/pp --probe`" osversion="`./scripts/pp --probe`"
fi 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 for f in *.rpm *.deb *.bff *.depot *.pkg *.txz ../artifacts; do
if [ -f "$f" ]; then if [ -f "$f" ]; then
mv "$f" ../artifacts mv "$f" ../artifacts

View File

@@ -2,7 +2,7 @@
# #
# SPDX-License-Identifier: ISC # 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 # Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above # 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. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# #
# Build a binary package using polypkg # 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. # Make sure IFS is set to space, tab, newline in that order.
@@ -28,10 +28,11 @@ nl='
IFS=" $nl" IFS=" $nl"
# Parse arguments # 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 debug=0
flavor=vanilla flavor=vanilla
crossbuild=false crossbuild=false
build_packages=true;
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
--debug) --debug)
@@ -80,6 +81,9 @@ while test $# -gt 0; do
crossbuild=true crossbuild=true
configure_opts="${configure_opts}${configure_opts+$tab}$1" configure_opts="${configure_opts}${configure_opts+$tab}$1"
;; ;;
--build-only)
build_packages=false
;;
*) *)
# Pass unknown options to configure # Pass unknown options to configure
configure_opts="${configure_opts}${configure_opts+$tab}$1" configure_opts="${configure_opts}${configure_opts+$tab}$1"
@@ -91,11 +95,15 @@ done
scriptdir=`dirname $0` scriptdir=`dirname $0`
configure="${scriptdir}/../configure" configure="${scriptdir}/../configure"
: ${osversion="`$scriptdir/pp --probe`"} : ${osversion="`$scriptdir/pp --probe 2>/dev/null || echo unknown`"}
test -n "$osversion" || exit 1
osrelease=`echo "$osversion" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'` osrelease=`echo "$osversion" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'`
: ${MAKE=make} : ${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 using GNU make, set number of jobs
if ${MAKE} --version 2>&1 | grep GNU >/dev/null; then if ${MAKE} --version 2>&1 | grep GNU >/dev/null; then
NJOBS=0 NJOBS=0
@@ -545,7 +553,9 @@ if [ -r Makefile ]; then
fi fi
${configure} "$@" || exit $? ${configure} "$@" || exit $?
${MAKE} $make_opts || 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=$? exitval=$?
test $debug -eq 0 && rm -rf destdir test $debug -eq 0 && rm -rf destdir