kbuild: use git-archive for source package creation
Commit5c3d1d0abb("kbuild: add a tool to list files ignored by git") added a new tool, scripts/list-gitignored. My intention was to create source packages without cleaning the source tree, without relying on git. Linus strongly objected to it, and suggested using 'git archive' instead. [1] [2] [3] This commit goes in that direction - Remove scripts/list-gitignored.c and rewrites Makefiles and scripts to use 'git archive' for building Debian and RPM source packages. It also makes 'make perf-tar*-src-pkg' use 'git archive' again. Going forward, building source packages is only possible in a git-managed tree. Building binary packages does not require git. [1]: https://lore.kernel.org/lkml/CAHk-=wi49sMaC7vY1yMagk7eqLK=1jHeHQ=yZ_k45P=xBccnmA@mail.gmail.com/ [2]: https://lore.kernel.org/lkml/CAHk-=wh5AixGsLeT0qH2oZHKq0FLUTbyTw4qY921L=PwYgoGVw@mail.gmail.com/ [3]: https://lore.kernel.org/lkml/CAHk-=wgM-W6Fu==EoAVCabxyX8eYBz9kNC88-tm9ExRQwA79UQ@mail.gmail.com/ Fixes:5c3d1d0abb("kbuild: add a tool to list files ignored by git") Fixes:e0ca16749a("kbuild: make perf-tar*-src-pkg work without relying on git") Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
+34
-11
@@ -11,10 +11,16 @@
|
||||
#
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [srctree]" >&2
|
||||
echo "Usage: $0 [--no-local] [srctree]" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
no_local=false
|
||||
if test "$1" = "--no-local"; then
|
||||
no_local=true
|
||||
shift
|
||||
fi
|
||||
|
||||
srctree=.
|
||||
if test $# -gt 0; then
|
||||
srctree=$1
|
||||
@@ -26,14 +32,22 @@ fi
|
||||
|
||||
scm_version()
|
||||
{
|
||||
local short
|
||||
local short=false
|
||||
local no_dirty=false
|
||||
local tag
|
||||
short=false
|
||||
|
||||
while [ $# -gt 0 ];
|
||||
do
|
||||
case "$1" in
|
||||
--short)
|
||||
short=true;;
|
||||
--no-dirty)
|
||||
no_dirty=true;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cd "$srctree"
|
||||
if test "$1" = "--short"; then
|
||||
short=true
|
||||
fi
|
||||
|
||||
if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then
|
||||
return
|
||||
@@ -75,6 +89,10 @@ scm_version()
|
||||
printf '%s%s' -g "$(echo $head | cut -c1-12)"
|
||||
fi
|
||||
|
||||
if ${no_dirty}; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Check for uncommitted changes.
|
||||
# This script must avoid any write attempt to the source tree, which
|
||||
# might be read-only.
|
||||
@@ -110,11 +128,6 @@ collect_files()
|
||||
echo "$res"
|
||||
}
|
||||
|
||||
if ! test -e include/config/auto.conf; then
|
||||
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${KERNELVERSION}" ]; then
|
||||
echo "KERNELVERSION is not set" >&2
|
||||
exit 1
|
||||
@@ -126,6 +139,16 @@ if test ! "$srctree" -ef .; then
|
||||
file_localversion="${file_localversion}$(collect_files "$srctree"/localversion*)"
|
||||
fi
|
||||
|
||||
if ${no_local}; then
|
||||
echo "${KERNELVERSION}$(scm_version --no-dirty)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! test -e include/config/auto.conf; then
|
||||
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# version string from CONFIG_LOCALVERSION
|
||||
config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user