From: Prarit Bhargava <prarit@xxxxxxxxxx> redhat/Makefile: Add RHTEST For a long time we have wanted a mechanism by which we could do a 'test run' of Makefile targets. Make has built-in options '-n, --just-print, --dry-run, --recon' that can be added on the command line that allow users to show the output for commands but not execute them. However, as explained in the Make manual [1], Makefile lines beginning with a '+' will still be executed if '-n' is specified. Add a RHTEST variable that is set to 1 if '-n' (or any of the other 'dry run' parameters) is added to the make command. Modify the scripts to return without executing if RHTEST is set. [1] https://www.gnu.org/software/automake/manual/html_node/Debugging-Make-Rules.html Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx> diff --git a/redhat/Makefile b/redhat/Makefile index blahblah..blahblah 100644 --- a/redhat/Makefile +++ b/redhat/Makefile @@ -33,6 +33,12 @@ SPECRELEASED_KERNEL=$(RELEASED_KERNEL) SPECINCLUDE_FEDORA_FILES=$(INCLUDE_FEDORA_FILES) SPECINCLUDE_RHEL_FILES=$(INCLUDE_RHEL_FILES) +ifneq (,$(findstring n,$(MAKEFLAGS))) + # Do not set RHTEST on the command line. Use the make command built-in options + # -n, --just-print, --dry-run, --recon on the command line. + RHTEST=1 +endif + LANG=C ifndef RHSELFTESTDATA diff --git a/redhat/configs/build_configs.sh b/redhat/configs/build_configs.sh index blahblah..blahblah 100755 --- a/redhat/configs/build_configs.sh +++ b/redhat/configs/build_configs.sh @@ -4,6 +4,8 @@ # and debug to form the necessary $PACKAGE_NAME<version>-<arch>-<variant>.config # files for building RHEL kernels, based on the contents of a control file +test -n "$RHTEST" && exit 0 + PACKAGE_NAME="${1:-kernel}" # defines the package name used if [ -z "$2" ]; then cat flavors > .flavors diff --git a/redhat/configs/generate_all_configs.sh b/redhat/configs/generate_all_configs.sh index blahblah..blahblah 100755 --- a/redhat/configs/generate_all_configs.sh +++ b/redhat/configs/generate_all_configs.sh @@ -2,6 +2,8 @@ # Adjusts the configuration options to build the variants correctly +test -n "$RHTEST" && exit 0 + DEBUGBUILDSENABLED=$1 if [ -z "$DEBUGBUILDSENABLED" ]; then exit 1 diff --git a/redhat/configs/process_configs.sh b/redhat/configs/process_configs.sh index blahblah..blahblah 100755 --- a/redhat/configs/process_configs.sh +++ b/redhat/configs/process_configs.sh @@ -6,6 +6,8 @@ # Globally disable suggestion of appending '|| exit' or '|| return' to cd/pushd/popd commands # shellcheck disable=SC2164 +test -n "$RHTEST" && exit 0 + usage() { # alphabetical order please -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1728 _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure