kbuild: give up untracked files for source package builds
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 10 Apr 2023 12:09:07 +0000 (21:09 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Mon, 10 Apr 2023 23:58:45 +0000 (08:58 +0900)
commitaa7d233f45b4c549750044c9921f7afcbe50925b
treeb987d6ad1b3ece19a9d7144705c80d3c5905a5d3
parentdcc11ac9dcaffdce428794f282c100a736244b55
kbuild: give up untracked files for source package builds

When the source tree is dirty and contains untracked files, package
builds may fail, for example, when a broken symlink exists, a file
path contains whitespaces, etc.

Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), the source tarball only contains committed files because
it is created by 'git archive'. scripts/package/gen-diff-patch tries
to address the diff from HEAD, but including untracked files by the
hand-crafted script introduces more complexity. I wrote a patch [1] to
make it work in most cases, but still wonder if this is what we should
aim for.

To simplify the code, this patch just gives up untracked files. Going
forward, it is your responsibility to do 'git add' for what you want in
the source package. The script shows a warning just in case you forgot
to do so. It should be checked only when building source packages.

[1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch

Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
scripts/Makefile.package
scripts/package/gen-diff-patch
scripts/package/mkdebian
scripts/package/mkspec