Skip to content

Commit f6e09b0

Browse files
committed
kbuild: do not put .scmversion into the source tarball
.scmversion is used by (src)rpm-pkg and deb-pkg to carry KERNELRELEASE. In fact, deb-pkg does not rely on it any more because the generated debian/rules specifies KERNELRELEASE from the command line. Do likwise for (src)rpm-pkg, and remove this feature. For the same reason, you do not need to save LOCALVERSION in the spec file. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
1 parent c9f9cf2 commit f6e09b0

File tree

4 files changed

+8
-27
lines changed

4 files changed

+8
-27
lines changed

scripts/Makefile.package

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export KDEB_SOURCENAME
3232
TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \
3333
include init io_uring ipc kernel lib mm net rust \
3434
samples scripts security sound tools usr virt \
35-
.config .scmversion Makefile \
35+
.config Makefile \
3636
Kbuild Kconfig COPYING $(wildcard localversion*)
3737
MKSPEC := $(srctree)/scripts/package/mkspec
3838

@@ -47,10 +47,8 @@ if test "$(objtree)" != "$(srctree)"; then \
4747
echo >&2; \
4848
false; \
4949
fi ; \
50-
$(srctree)/scripts/setlocalversion --save-scmversion; \
5150
tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
52-
--transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \
53-
rm -f $(objtree)/.scmversion
51+
--transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3)
5452

5553
# rpm-pkg
5654
# ---------------------------------------------------------------------------

scripts/package/mkspec

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
3333
--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
3434
--exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
3535

36-
test -n "$LOCALVERSION" && MAKE="$MAKE LOCALVERSION=$LOCALVERSION"
37-
3836
# We can label the here-doc lines for conditional output to the spec file
3937
#
4038
# Labels:
@@ -90,7 +88,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf
9088
$S rm -f tools/objtool/{fixdep,objtool}
9189
$S
9290
$S %build
93-
$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
91+
$S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
9492
$S
9593
%install
9694
mkdir -p %{buildroot}/boot
@@ -101,8 +99,8 @@ $S
10199
%else
102100
cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
103101
%endif
104-
$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
105-
$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
102+
$M $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE INSTALL_MOD_PATH=%{buildroot} modules_install
103+
$MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE INSTALL_HDR_PATH=%{buildroot}/usr headers_install
106104
cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
107105
cp .config %{buildroot}/boot/config-$KERNELRELEASE
108106
$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build

scripts/remove-stale-files

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ rm -f scripts/kconfig/[gmnq]conf-cfg
3131
rm -f rust/target.json
3232

3333
rm -f scripts/bin2c
34+
35+
rm -f .scmversion

scripts/setlocalversion

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@
1111
#
1212

1313
usage() {
14-
echo "Usage: $0 [--save-scmversion] [srctree]" >&2
14+
echo "Usage: $0 [srctree]" >&2
1515
exit 1
1616
}
1717

18-
scm_only=false
1918
srctree=.
20-
if test "$1" = "--save-scmversion"; then
21-
scm_only=true
22-
shift
23-
fi
2419
if test $# -gt 0; then
2520
srctree=$1
2621
shift
@@ -35,10 +30,6 @@ scm_version()
3530
short=false
3631

3732
cd "$srctree"
38-
if test -e .scmversion; then
39-
cat .scmversion
40-
return
41-
fi
4233
if test "$1" = "--short"; then
4334
short=true
4435
fi
@@ -103,14 +94,6 @@ collect_files()
10394
echo "$res"
10495
}
10596

106-
if $scm_only; then
107-
if test ! -e .scmversion; then
108-
res=$(scm_version)
109-
echo "$res" >.scmversion
110-
fi
111-
exit
112-
fi
113-
11497
if ! test -e include/config/auto.conf; then
11598
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
11699
exit 1

0 commit comments

Comments
 (0)