kpatch-build: suppress make directory info for `make kernelversion`

When invoking kpatch-build through integration testing, like:

  $ make PATCH_DIR="linux-6.9.0" \
         KPATCH_BUILD_OPTS="--sourcedir /root/linux" \
         integration-slow

results in an error as kpatch-build's `make kernelversion` adds
directory information to its output:

  make[2]: Entering directory '/root/linux'
  6.9.0
  make[2]: Leaving directory '/root/linux'

This screws up kpatch-build's assignment of the make output to
LOCALVERSION, which was expecting only "6.9.0".

Add --no-print-directory to the make invocation to avoid the undesired
entering / leaving directory info.

Fixes: 629b5acf3d ("kpatch-build: Fix setlocalversion issue with 6.3 kernel")
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
This commit is contained in:
Joe Lawrence 2024-06-07 10:14:58 -04:00
parent 77d9346383
commit 7d89578c6f
1 changed files with 1 additions and 1 deletions

View File

@ -1132,7 +1132,7 @@ if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" ]]; then
cd "$KERNEL_SRCDIR" || die
if ! ./scripts/setlocalversion --save-scmversion &>/dev/null; then
backup_kernel_file "scripts/setlocalversion"
LOCALVERSION="$(make kernelversion)"
LOCALVERSION="$(make --no-print-directory kernelversion)"
LOCALVERSION="$(KERNELVERSION="$LOCALVERSION" ./scripts/setlocalversion)"
[[ -n "$LOCALVERSION" ]] || die "setlocalversion failed"
echo "echo $LOCALVERSION" > scripts/setlocalversion