Commit 262dad68 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: pkg: make out-of-tree rpm/deb-pkg build immediately fail

We do not support out-of-tree building of rpm-pkg / deb-pkg.  If O=
is given, the build should be terminated, but the "false" command is
not effective since it is not the last command in the cmd_src_tar.
Then, rpm-pkg / deb-pkg tries to continue building, and fails for a
different reason.

Set -e option so that the "false" terminates the building immediately.

I also put the error messages to stderr, and made it stand out more.

For example, "make O=foo rpm-pkg" will fail as follows:

  /bin/bash ../scripts/package/mkspec >./kernel.spec
    TAR     kernel-4.15.0_rc2+.tar.gz

    ERROR:
    Building source tarball is not possible outside the
    kernel source tree. Don't set KBUILD_OUTPUT, or use the
    binrpm-pkg or bindeb-pkg target instead.

  ../scripts/package/Makefile:53: recipe for target 'rpm-pkg' failed
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: default avatarJim Davis <jim.epost@gmail.com>
parent 5704d455
......@@ -32,10 +32,14 @@ MKSPEC := $(srctree)/scripts/package/mkspec
quiet_cmd_src_tar = TAR $(2).tar.gz
cmd_src_tar = \
set -e; \
if test "$(objtree)" != "$(srctree)"; then \
echo "Building source tarball is not possible outside the"; \
echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
echo "binrpm-pkg or bindeb-pkg target instead."; \
echo >&2; \
echo >&2 " ERROR:"; \
echo >&2 " Building source tarball is not possible outside the"; \
echo >&2 " kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
echo >&2 " binrpm-pkg or bindeb-pkg target instead."; \
echo >&2; \
false; \
fi ; \
$(srctree)/scripts/setlocalversion --save-scmversion; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment