History

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

Masahiro Yamada committed 8 years ago

Commit 262dad61 parent 5704d451 file · +7 −3Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/package/Makefile+7−3
@@ -32,10 +32,14 @@ MKSPEC := $(srctree)/scripts/package/mkspec · 31 unmodified lines
32 32
33quiet_cmd_src_tar = TAR $(2).tar.gz33quiet_cmd_src_tar = TAR $(2).tar.gz
34 cmd_src_tar = \34 cmd_src_tar = \
35set -e; \
35if test "$(objtree)" != "$(srctree)"; then \36if test "$(objtree)" != "$(srctree)"; then \
36 echo "Building source tarball is not possible outside the"; \37 echo >&2; \
37 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \38 echo >&2 " ERROR:"; \
38 echo "binrpm-pkg or bindeb-pkg target instead."; \39 echo >&2 " Building source tarball is not possible outside the"; \
40 echo >&2 " kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
41 echo >&2 " binrpm-pkg or bindeb-pkg target instead."; \
42 echo >&2; \
39 false; \43 false; \
40fi ; \44fi ; \
41$(srctree)/scripts/setlocalversion --save-scmversion; \45$(srctree)/scripts/setlocalversion --save-scmversion; \