kbuild: do not put .scmversion into the source tarball
PATCH 1/7 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.
---
scripts/Makefile.package | 6 ++---- scripts/package/mkspec | 6 +++--- scripts/setlocalversion | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-)
scripts/Makefile.package +2 -4
@@ -32,7 +32,7 @@ export KDEB_SOURCENAME TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ include init io_uring ipc kernel lib mm net rust \ samples scripts security sound tools usr virt \ - .config .scmversion Makefile \ + .config Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) MKSPEC := $(srctree)/scripts/package/mkspec
@@ -47,10 +47,8 @@ if test "$(objtree)" != "$(srctree)"; then \ echo >&2; \ false; \ fi ; \ -$(srctree)/scripts/setlocalversion --save-scmversion; \ tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ - --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ -rm -f $(objtree)/.scmversion + --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) # rpm-pkg # ---------------------------------------------------------------------------
scripts/package/mkspec +3 -3
@@ -90,7 +90,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf $S rm -f tools/objtool/{fixdep,objtool} $S $S %build -$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} +$S $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} KBUILD_BUILD_VERSION=%{release} $S %install mkdir -p %{buildroot}/boot
@@ -101,8 +101,8 @@ $S %else cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif -$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install - $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install +$M $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_MOD_PATH=%{buildroot} modules_install + $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE cp .config %{buildroot}/boot/config-$KERNELRELEASE $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
scripts/setlocalversion +1 -18
@@ -11,16 +11,11 @@ # usage() { - echo "Usage: $0 [--save-scmversion] [srctree]" >&2 + echo "Usage: $0 [srctree]" >&2 exit 1 } -scm_only=false srctree=. -if test "$1" = "--save-scmversion"; then - scm_only=true - shift -fi if test $# -gt 0; then srctree=$1 shift
@@ -35,10 +30,6 @@ scm_version() short=false cd "$srctree" - if test -e .scmversion; then - cat .scmversion - return - fi if test "$1" = "--short"; then short=true fi
@@ -103,14 +94,6 @@ collect_files() echo "$res" } -if $scm_only; then - if test ! -e .scmversion; then - res=$(scm_version) - echo "$res" >.scmversion - fi - exit -fi - if ! test -e include/config/auto.conf; then echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 exit 1
Signature · 1 line
2.34.1
PATCH 2/7 setlocalversion: simplify the construction of the short version
With the --short option given, scm_version() prints "+". Just append it.
---
scripts/setlocalversion | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/setlocalversion +1 -2
@@ -121,8 +121,7 @@ elif [ "${LOCALVERSION+set}" != "set" ]; then # # If the variable LOCALVERSION is set (including being set # to an empty string), we don't want to append a plus sign. - scm=$(scm_version --short) - res="$res${scm:++}" + res="$res$(scm_version --short)" fi echo "$res"
Signature · 1 line
2.34.1
Re: [PATCH 2/7] setlocalversion: simplify the construction of the short version
Quoted 25 lines · Masahiro Yamada
With the --short option given,
scm_version()prints "+". Just append it.Signed-off-by Masahiro Yamada <[email protected]>---
scripts/setlocalversion | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)scripts/setlocalversion +1
-2@@ -121,8 +121,7 @@ elif [ "${LOCALVERSION+set}" != "set" ]; then # # If the variable LOCALVERSION is set (including being set # to an empty string), we don't want to append a plus sign. - scm=$(scm_version --short) - res="$res${scm:++}" + res="$res$(scm_version --short)" fi echo "$res"Signature · 1 line
2.34.1
PATCH 3/7 setlocalversion: make indentation shallower
In reply to Masahiro YamadaReturn earlier if we are not in the correct git repository. This makes the code more readable.
---
scripts/setlocalversion | 79 +++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 38 deletions(-)
scripts/setlocalversion +41 -38
@@ -34,46 +34,49 @@ scm_version() short=true fi - # Check for git and a git repo. - if test -z "$(git rev-parse --show-cdup 2>/dev/null)" && - head=$(git rev-parse --verify HEAD 2>/dev/null); then - - # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore - # it, because this version is defined in the top level Makefile. - if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then - - # If only the short version is requested, don't bother - # running further git commands - if $short; then - echo "+" - return - fi - # If we are past a tagged commit (like - # "v2.6.30-rc5-302-g72357d5"), we pretty print it. - if atag="$(git describe 2>/dev/null)"; then - echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}' - fi - - # Add -g and exactly 12 hex chars. - printf '%s%s' -g "$(echo $head | cut -c1-12)" - fi + if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then + return + fi + + if ! head=$(git rev-parse --verify HEAD 2>/dev/null); then + return + fi + + # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it + # because this version is defined in the top level Makefile. + if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then - # Check for uncommitted changes. - # This script must avoid any write attempt to the source tree, - # which might be read-only. - # You cannot use 'git describe --dirty' because it tries to - # create .git/index.lock . - # First, with git-status, but --no-optional-locks is only - # supported in git >= 2.14, so fall back to git-diff-index if - # it fails. Note that git-diff-index does not refresh the - # index, so it may give misleading results. See - # git-update-index(1), git-diff-index(1), and git-status(1). - if { - git --no-optional-locks status -uno --porcelain 2>/dev/null || - git diff-index --name-only HEAD - } | read dummy; then - printf '%s' -dirty + # If only the short version is requested, don't bother + # running further git commands + if $short; then + echo "+" + return fi + # If we are past a tagged commit (like + # "v2.6.30-rc5-302-g72357d5"), we pretty print it. + if atag="$(git describe 2>/dev/null)"; then + echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}' + fi + + # Add -g and exactly 12 hex chars. + printf '%s%s' -g "$(echo $head | cut -c1-12)" + fi + + # Check for uncommitted changes. + # This script must avoid any write attempt to the source tree, which + # might be read-only. + # You cannot use 'git describe --dirty' because it tries to create + # .git/index.lock . + # First, with git-status, but --no-optional-locks is only supported in + # git >= 2.14, so fall back to git-diff-index if it fails. Note that + # git-diff-index does not refresh the index, so it may give misleading + # results. + # See git-update-index(1), git-diff-index(1), and git-status(1). + if { + git --no-optional-locks status -uno --porcelain 2>/dev/null || + git diff-index --name-only HEAD + } | read dummy; then + printf '%s' -dirty fi }
Signature · 1 line
2.34.1
Re: [PATCH 3/7] setlocalversion: make indentation shallower
Quoted 103 lines · Masahiro Yamada
Return earlier if we are not in the correct git repository. This makes the code more readable.
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/setlocalversion | 79 +++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 38 deletions(-)scripts/setlocalversion +41
-38@@ -34,46 +34,49 @@ scm_version() short=true fi - # Check for git and a git repo. - if test -z "$(git rev-parse --show-cdup 2>/dev/null)" && - head=$(git rev-parse --verify HEAD 2>/dev/null); then - - # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore - # it, because this version is defined in the top level Makefile. - if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then - - # If only the short version is requested, don't bother - # running further git commands - if $short; then - echo "+" - return - fi - # If we are past a tagged commit (like - # "v2.6.30-rc5-302-g72357d5"), we pretty print it. - if atag="$(git describe 2>/dev/null)"; then - echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}' - fi - - # Add -g and exactly 12 hex chars. - printf '%s%s' -g "$(echo $head | cut -c1-12)" - fi + if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then + return + fi + + if ! head=$(git rev-parse --verify HEAD 2>/dev/null); then + return + fi + + # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it + # because this version is defined in the top level Makefile. + if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then - # Check for uncommitted changes. - # This script must avoid any write attempt to the source tree, - # which might be read-only. - # You cannot use 'git describe --dirty' because it tries to - # create .git/index.lock . - # First, with git-status, but --no-optional-locks is only - # supported in git >= 2.14, so fall back to git-diff-index if - # it fails. Note that git-diff-index does not refresh the - # index, so it may give misleading results. See - # git-update-index(1), git-diff-index(1), and git-status(1). - if { - git --no-optional-locks status -uno --porcelain 2>/dev/null || - git diff-index --name-only HEAD - } | read dummy; then - printf '%s' -dirty + # If only the short version is requested, don't bother + # running further git commands + if $short; then + echo "+" + return fi + # If we are past a tagged commit (like + # "v2.6.30-rc5-302-g72357d5"), we pretty print it. + if atag="$(git describe 2>/dev/null)"; then + echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}' + fi + + # Add -g and exactly 12 hex chars. + printf '%s%s' -g "$(echo $head | cut -c1-12)" + fi + + # Check for uncommitted changes. + # This script must avoid any write attempt to the source tree, which + # might be read-only. + # You cannot use 'git describe --dirty' because it tries to create + # .git/index.lock . + # First, with git-status, but --no-optional-locks is only supported in + # git >= 2.14, so fall back to git-diff-index if it fails. Note that + # git-diff-index does not refresh the index, so it may give misleading + # results. + # See git-update-index(1), git-diff-index(1), and git-status(1). + if { + git --no-optional-locks status -uno --porcelain 2>/dev/null || + git diff-index --name-only HEAD + } | read dummy; then + printf '%s' -dirty fi }Signature · 1 line
2.34.1
PATCH 4/7 setlocalversion: use only the correct release tag for git-describe
In reply to Masahiro YamadaCurrently, setlocalversion uses any annotated tag for git-describe. If we are at a tagged commit, it will not append the commit hash.
$ git checkout v6.2-rc1^ $ make -s defconfig prepare $ make kernelrelease 6.1.0-14595-g292a089d78d3 $ git tag -a foo -m foo $ make kernelrelease 6.1.0
If a local tag 'foo' exists, it pretends to be a released version '6.1.0', while there are many commits on top of it.
The output should be consistent irrespective of such a local tag. Pass the correct release tag to --match option of git-describe.
In the mainline kernel, the SUBLEVEL is always '0' but it is omitted from the tag.
version tag 6.1.0 -> v6.1 (mainline) 6.2.0-rc5 -> v6.2-rc5 (mainline, release candidate) 6.1.7 -> v6.1.7 (stable)
---
scripts/setlocalversion | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
scripts/setlocalversion +17 -6
@@ -27,6 +27,7 @@ fi scm_version() { local short + local tag short=false cd "$srctree"
@@ -42,9 +43,14 @@ scm_version() return fi - # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it - # because this version is defined in the top level Makefile. - if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then + # convert the version to a tag + # mainline kernel: 6.2.0-rc5 -> v6.2-rc5 + # stable kernel: 6.1.7 -> v6.1.7 + tag=v$(echo "${KERNELVERSION}" | sed 's/^\(.*\..*\)\.0\(.*\)$/\1\2/') + + # If we are at a tagged commit and the tag matches the version defined + # in the top level Makefile, we ignore it. + if [ -z "$(git describe --exact-match --match=$tag 2>/dev/null)" ]; then # If only the short version is requested, don't bother # running further git commands
@@ -52,9 +58,9 @@ scm_version() echo "+" return fi - # If we are past a tagged commit (like - # "v2.6.30-rc5-302-g72357d5"), we pretty print it. - if atag="$(git describe 2>/dev/null)"; then + # If we are past the release tag, we pretty print it. + # (like 6.1.0-14595-g292a089d78d3) + if atag="$(git describe --match=$tag 2>/dev/null)"; then echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}' fi
@@ -102,6 +108,11 @@ if ! test -e include/config/auto.conf; then exit 1 fi +if [ -z "${KERNELVERSION}" ]; then + echo "KERNELVERSION is not set" >&2 + exit 1 +fi + # localversion* files in the build and source directory res="$(collect_files localversion*)" if test ! "$srctree" -ef .; then
Signature · 1 line
2.34.1
Re: [PATCH 4/7] setlocalversion: use only the correct release tag for git-describe
Quoted 21 lines · Masahiro Yamada
Currently, setlocalversion uses any annotated tag for git-describe. If we are at a tagged commit, it will not append the commit hash.
$ git checkout v6.2-rc1^ $ make -s defconfig prepare $ make kernelrelease 6.1.0-14595-g292a089d78d3 $ git tag -a foo -m foo $ make kernelrelease 6.1.0If a local tag 'foo' exists, it pretends to be a released version '6.1.0', while there are many commits on top of it.
The output should be consistent irrespective of such a local tag. Pass the correct release tag to --match option of git-describe.
In the mainline kernel, the SUBLEVEL is always '0' but it is omitted from the tag.
Quoted 6 lines
version tag 6.1.0 -> v6.1 (mainline) 6.2.0-rc5 -> v6.2-rc5 (mainline, release candidate) 6.1.7 -> v6.1.7 (stable)Signed-off-by Masahiro Yamada <[email protected]>
I will drop this patch,
and send an alternative one.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 5/7 setlocalversion: absorb $(KERNELVERSION)
In reply to Masahiro YamadaPrint $(KERNELVERSION) in setlocalversion so that the callers get simpler.
---
Makefile | 5 ++--- scripts/setlocalversion | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-)
Makefile +2 -3
@@ -1247,8 +1247,7 @@ vmlinux: vmlinux.o $(KBUILD_LDS) modpost # make sure no implicit rule kicks in $(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ; -filechk_kernel.release = \ - echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" +filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree) # Store (new) KERNELRELEASE string in include/config/kernel.release include/config/kernel.release: FORCE
@@ -2112,7 +2111,7 @@ checkstack: $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH) kernelrelease: - @echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" + @$(srctree)/scripts/setlocalversion $(srctree) kernelversion: @echo $(KERNELVERSION)
scripts/setlocalversion +3 -1
@@ -113,8 +113,10 @@ if [ -z "${KERNELVERSION}" ]; then exit 1 fi +res="${KERNELVERSION}" + # localversion* files in the build and source directory -res="$(collect_files localversion*)" +res="${res}$(collect_files localversion*)" if test ! "$srctree" -ef .; then res="$res$(collect_files "$srctree"/localversion*)" fi
Signature · 1 line
2.34.1
PATCH 6/7 setlocalversion: print ${KERNELRELEASE} if set
In reply to Masahiro YamadaWhen KERNELRELEASE is overridden, include/config/kernel.release still stores the string would be returned by the script if KERNELRELEASE had not been overridden. This is not strange.
include/config/kernel.release should store KERNELRELEASE that was used for building the kernel.
---
scripts/setlocalversion | 5 +++++ 1 file changed, 5 insertions(+)
scripts/setlocalversion +5 -0
@@ -103,6 +103,11 @@ collect_files() echo "$res" } +if [ -n "${KERNELRELEASE}" ]; then + echo "${KERNELRELEASE}" + 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
Signature · 1 line
2.34.1
Re: [PATCH 6/7] setlocalversion: print ${KERNELRELEASE} if set
Quoted 9 lines · Masahiro Yamada
When KERNELRELEASE is overridden,
include/config/kernel.releasestill stores the string would be returned by the script if KERNELRELEASE had not been overridden. This is not strange.
include/config/kernel.releaseshould store KERNELRELEASE that was used for building the kernel.Signed-off-by Masahiro Yamada <[email protected]>
I will drop this patch because a regression was reported.
Quoted 24 lines
---
scripts/setlocalversion | 5 +++++ 1 file changed, 5 insertions(+)scripts/setlocalversion +5
-1@@ -103,6 +103,11 @@ collect_files() echo "$res" } +if [ -n "${KERNELRELEASE}" ]; then + echo "${KERNELRELEASE}" + 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 --2.34.1
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 7/7 kbuild: do not re-run setlocalversion for kernelrelease
In reply to Masahiro YamadaRevert:
- 7b8ea53d7f18 ("makefile: not need to regenerate kernel.release file when make kernelrelease")
- 01ab17887f4c ("Makefile: "make kernelrelease" should show the correct full kernel version")
I think the original behavior was better - 'make kernelrelease' should print $(KERNELRELEASE) used in the last build, not the one that will be used in the next build. Therefore, it is an error if you run it in the pristine source tree.
---
Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Makefile +5 -5
@@ -281,13 +281,13 @@ clean-targets := %clean mrproper cleandocs no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers headers_% archheaders archscripts \ - %asm-generic kernelversion %src-pkg dt_binding_check \ + %asm-generic kernelrelease kernelversion %src-pkg dt_binding_check \ outputmakefile rustavailable rustfmt rustfmtcheck # Installation targets should not require compiler. Unfortunately, vdso_install # is an exception where build artifacts may be updated. This must be fixed. no-compiler-targets := $(no-dot-config-targets) install dtbs_install \ - headers_install modules_install kernelrelease image_name -no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \ + headers_install modules_install image_name +no-sync-config-targets := $(no-dot-config-targets) %install \ image_name single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/
@@ -1677,7 +1677,7 @@ help: @echo ' tags/TAGS - Generate tags file for editors' @echo ' cscope - Generate cscope index' @echo ' gtags - Generate GNU GLOBAL index' - @echo ' kernelrelease - Output the release version string (use with make -s)' + @echo ' kernelrelease - Output the release version string used in the last build (use with make -s)' @echo ' kernelversion - Output the version stored in Makefile (use with make -s)' @echo ' image_name - Output the image name (use with make -s)' @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
@@ -2111,7 +2111,7 @@ checkstack: $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH) kernelrelease: - @$(srctree)/scripts/setlocalversion $(srctree) + @echo $(or $(KERNELRELEASE),$(error kernelrelease not valid - run 'make prepare' to update it)) kernelversion: @echo $(KERNELVERSION)
Signature · 1 line
2.34.1
Re: [PATCH 7/7] kbuild: do not re-run setlocalversion for kernelrelease
Quoted 8 lines · Masahiro Yamada
Revert:
-7b8ea53d7f18("makefile: not need to regenerate kernel.release file when make kernelrelease")-
01ab17887f4c("Makefile: "make kernelrelease" should show the correct full kernel version")
Quoted 6 lines
I think the original behavior was better - 'make kernelrelease' should print $(KERNELRELEASE) used in the last build, not the one that will be used in the next build. Therefore, it is an error if you run it in the pristine source tree.
Signed-off-by Masahiro Yamada <[email protected]>
I locally got a question about this, and
on second thought, this might be annoying because you need to build something to get kernelrelease.
I will drop this commit.
--
Best Regards
Masahiro Yamada
Quoted 7 lines · Masahiro Yamada
.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.
Quoted 7 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/Makefile.package | 6 ++---- scripts/package/mkspec | 6 +++--- scripts/setlocalversion | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-)
Hi Masahiro,
I've been observing some strange behaviour when doing incremental builds on recent linux-next versions. What happens is that the kernel version doesn't get updated as I switch branches.
For instance I was rebuilding in a kernel tree which I hadn't touched in a very long while and rebased on a recent linux-next. The kernel version then stayed at the prior version rather than being updated to reflect the actual state of the working tree.
Reverting all of the seven patches in this series fixes the issue, but I don't really have a clue where exactly it fails. Do you have any ideas how to fix this?
Thanks,
Thierry
Quoted 101 lines
scripts/Makefile.package +2
-4@@ -32,7 +32,7 @@ export KDEB_SOURCENAME TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ include init io_uring ipc kernel lib mm net rust \ samples scripts security sound tools usr virt \ - .config .scmversion Makefile \ + .config Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) MKSPEC := $(srctree)/scripts/package/mkspec@@ -47,10 +47,8 @@ if test "$(objtree)" != "$(srctree)"; then \ echo >&2; \ false; \ fi ; \ -$(srctree)/scripts/setlocalversion --save-scmversion; \ tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ - --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ -rm -f $(objtree)/.scmversion + --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) # rpm-pkg # ---------------------------------------------------------------------------scripts/package/mkspec +3
-3@@ -90,7 +90,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf $S rm -f tools/objtool/{fixdep,objtool} $S $S %build -$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} +$S $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} KBUILD_BUILD_VERSION=%{release} $S %install mkdir -p %{buildroot}/boot@@ -101,8 +101,8 @@ $S %else cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif -$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install - $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install +$M $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_MOD_PATH=%{buildroot} modules_install + $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE cp .config %{buildroot}/boot/config-$KERNELRELEASE $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/buildscripts/setlocalversion +1
-18@@ -11,16 +11,11 @@ # usage() { - echo "Usage: $0 [--save-scmversion] [srctree]" >&2 + echo "Usage: $0 [srctree]" >&2 exit 1 } -scm_only=false srctree=. -if test "$1" = "--save-scmversion"; then - scm_only=true - shift -fi if test $# -gt 0; then srctree=$1 shift@@ -35,10 +30,6 @@ scm_version() short=false cd "$srctree" - if test -e .scmversion; then - cat .scmversion - return - fi if test "$1" = "--short"; then short=true fi@@ -103,14 +94,6 @@ collect_files() echo "$res" } -if $scm_only; then - if test ! -e .scmversion; then - res=$(scm_version) - echo "$res" >.scmversion - fi - exit -fi - if ! test -e include/config/auto.conf; then echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 exit 1Signature · 1 line
2.34.1
Quoted 23 lines · Thierry Reding
Quoted 7 lines · Masahiro Yamada
.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.
Quoted 7 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/Makefile.package | 6 ++---- scripts/package/mkspec | 6 +++--- scripts/setlocalversion | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-)Hi Masahiro,
I've been observing some strange behaviour when doing incremental builds on recent linux-next versions. What happens is that the kernel version doesn't get updated as I switch branches.
Quoted 8 lines
For instance I was rebuilding in a kernel tree which I hadn't touched in a very long while and rebased on a recent linux-next. The kernel version then stayed at the prior version rather than being updated to reflect the actual state of the working tree.
Reverting all of the seven patches in this series fixes the issue, but I don't really have a clue where exactly it fails. Do you have any ideas how to fix this?
Thanks for the report.
"setlocalversion: print ${KERNELRELEASE} if set" is bad.
I will fix it.
Best Regards
Masahiro Yamada
Nathan Chancellor
maintainerHi Masahiro,
Quoted 115 lines · Masahiro Yamada
.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.
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/Makefile.package | 6 ++---- scripts/package/mkspec | 6 +++--- scripts/setlocalversion | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-)scripts/Makefile.package +2
-4@@ -32,7 +32,7 @@ export KDEB_SOURCENAME TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ include init io_uring ipc kernel lib mm net rust \ samples scripts security sound tools usr virt \ - .config .scmversion Makefile \ + .config Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) MKSPEC := $(srctree)/scripts/package/mkspec@@ -47,10 +47,8 @@ if test "$(objtree)" != "$(srctree)"; then \ echo >&2; \ false; \ fi ; \ -$(srctree)/scripts/setlocalversion --save-scmversion; \ tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ - --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ -rm -f $(objtree)/.scmversion + --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) # rpm-pkg # ---------------------------------------------------------------------------scripts/package/mkspec +3
-3@@ -90,7 +90,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf $S rm -f tools/objtool/{fixdep,objtool} $S $S %build -$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} +$S $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} KBUILD_BUILD_VERSION=%{release} $S %install mkdir -p %{buildroot}/boot@@ -101,8 +101,8 @@ $S %else cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif -$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install - $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install +$M $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_MOD_PATH=%{buildroot} modules_install + $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE cp .config %{buildroot}/boot/config-$KERNELRELEASE $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/buildscripts/setlocalversion +1
-18@@ -11,16 +11,11 @@ # usage() { - echo "Usage: $0 [--save-scmversion] [srctree]" >&2 + echo "Usage: $0 [srctree]" >&2 exit 1 } -scm_only=false srctree=. -if test "$1" = "--save-scmversion"; then - scm_only=true - shift -fi if test $# -gt 0; then srctree=$1 shift@@ -35,10 +30,6 @@ scm_version() short=false cd "$srctree" - if test -e .scmversion; then - cat .scmversion - return - fi if test "$1" = "--short"; then short=true fi@@ -103,14 +94,6 @@ collect_files() echo "$res" } -if $scm_only; then - if test ! -e .scmversion; then - res=$(scm_version) - echo "$res" >.scmversion - fi - exit -fi - if ! test -e include/config/auto.conf; then echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 exit 1Signature · 1 line
2.34.1
I believe this patch causes issues with binrpm-pkg (I have not done a full bisect, as I am not fully online today; the source path has been replaced with $PWD):
$ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- RPMOPTS="--define '_topdir $PWD/rpmbuild'" olddefconfig binrpm-pkg ... Building target platforms: aarch64-linux Building for target aarch64-linux warning: line 23: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers error: cannot open Packages database in /var/lib/rpm Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.targJq + umask 022 + cd . + /usr/bin/rm -rf $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64 + /usr/bin/mkdir -p $PWD/rpmbuild/BUILDROOT + /usr/bin/mkdir $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64 + mkdir -p $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot ++ make -f ./Makefile -s image_name + cp arch/arm64/boot/Image.gz $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot/vmlinuz-6.2.0-rc5-next-20230127+ + make -f ./Makefile -j128 KERNELRELEASE=6.2.0_rc5_next_20230127+ INSTALL_MOD_PATH=$PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64 modules_install make[3]: warning: -j128 forced in submake: resetting jobserver mode. + make -f ./Makefile -j128 KERNELRELEASE=6.2.0_rc5_next_20230127+ INSTALL_HDR_PATH=$PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/usr headers_install make[3]: warning: -j128 forced in submake: resetting jobserver mode. + cp System.map $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot/System.map-6.2.0-rc5-next-20230127+ + cp .config $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot/config-6.2.0-rc5-next-20230127+ + /usr/lib/rpm/brp-compress Processing files: kernel-6.2.0_rc5_next_20230127+-1.aarch64 error: File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+ warning: File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/build warning: File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/source
RPM build warnings:
line 23: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/build
File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/sourceRPM build errors:
cannot open Packages database in /var/lib/rpm
File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+
...
Cheers,
Nathan
Quoted 115 lines · Nathan Chancellor
Hi Masahiro,
Quoted 111 lines · Masahiro Yamada
.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.
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/Makefile.package | 6 ++---- scripts/package/mkspec | 6 +++--- scripts/setlocalversion | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-)scripts/Makefile.package +2
-4@@ -32,7 +32,7 @@ export KDEB_SOURCENAME TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ include init io_uring ipc kernel lib mm net rust \ samples scripts security sound tools usr virt \ - .config .scmversion Makefile \ + .config Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) MKSPEC := $(srctree)/scripts/package/mkspec@@ -47,10 +47,8 @@ if test "$(objtree)" != "$(srctree)"; then \ echo >&2; \ false; \ fi ; \ -$(srctree)/scripts/setlocalversion --save-scmversion; \ tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ - --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ -rm -f $(objtree)/.scmversion + --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) # rpm-pkg # ---------------------------------------------------------------------------scripts/package/mkspec +3
-3@@ -90,7 +90,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf $S rm -f tools/objtool/{fixdep,objtool} $S $S %build -$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} +$S $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} KBUILD_BUILD_VERSION=%{release} $S %install mkdir -p %{buildroot}/boot@@ -101,8 +101,8 @@ $S %else cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif -$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install - $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install +$M $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_MOD_PATH=%{buildroot} modules_install + $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE cp .config %{buildroot}/boot/config-$KERNELRELEASE $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/buildscripts/setlocalversion +1
-18@@ -11,16 +11,11 @@ # usage() { - echo "Usage: $0 [--save-scmversion] [srctree]" >&2 + echo "Usage: $0 [srctree]" >&2 exit 1 } -scm_only=false srctree=. -if test "$1" = "--save-scmversion"; then - scm_only=true - shift -fi if test $# -gt 0; then srctree=$1 shift@@ -35,10 +30,6 @@ scm_version() short=false cd "$srctree" - if test -e .scmversion; then - cat .scmversion - return - fi if test "$1" = "--short"; then short=true fi@@ -103,14 +94,6 @@ collect_files() echo "$res" } -if $scm_only; then - if test ! -e .scmversion; then - res=$(scm_version) - echo "$res" >.scmversion - fi - exit -fi - if ! test -e include/config/auto.conf; then echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
Quoted 8 lines
Quoted 4 lines
scripts/setlocalversion +0
-1exit 1 --2.34.1
I believe this patch causes issues with binrpm-pkg (I have not done a full bisect, as I am not fully online today; the source path has been replaced with $PWD):
Thanks for the report.
%{version} contains underscores instead of hyphens. So, it does not match to ${KERNELRELEASE} used during the build.
I will squash the following:
scripts/package/mkspec +0 -1
@@ -90,7 +90,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf $S rm -f tools/objtool/{fixdep,objtool} $S $S %build -$S $MAKE %{?_smp_mflags} KERNELRELEASE=%{version}
KBUILD_BUILD_VERSION=%{release}
+$S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE
KBUILD_BUILD_VERSION=%{release}
$S
%install
mkdir -p %{buildroot}/boot
@@ -101,8 +101,8 @@ $S
%else
cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
%endif-$M $MAKE %{?_smp_mflags} KERNELRELEASE=%{version}
INSTALL_MOD_PATH=%{buildroot} modules_install
- $MAKE %{?_smp_mflags} KERNELRELEASE=%{version}
INSTALL_HDR_PATH=%{buildroot}/usr headers_install
+$M $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE
INSTALL_MOD_PATH=%{buildroot} modules_install
+ $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE
INSTALL_HDR_PATH=%{buildroot}/usr headers_install
cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE cp .config %{buildroot}/boot/config-$KERNELRELEASE
$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
Quoted 40 lines
$ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- RPMOPTS="--define '_topdir $PWD/rpmbuild'" olddefconfig binrpm-pkg ... Building target platforms: aarch64-linux Building for target aarch64-linux warning: line 23: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers error: cannot open Packages database in /var/lib/rpm Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.targJq + umask 022 + cd . + /usr/bin/rm -rf $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64 + /usr/bin/mkdir -p $PWD/rpmbuild/BUILDROOT + /usr/bin/mkdir $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64 + mkdir -p $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot ++ make -f ./Makefile -s image_name + cp arch/arm64/boot/Image.gz $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot/vmlinuz-6.2.0-rc5-next-20230127+ + make -f ./Makefile -j128 KERNELRELEASE=6.2.0_rc5_next_20230127+ INSTALL_MOD_PATH=$PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64 modules_install make[3]: warning: -j128 forced in submake: resetting jobserver mode. + make -f ./Makefile -j128 KERNELRELEASE=6.2.0_rc5_next_20230127+ INSTALL_HDR_PATH=$PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/usr headers_install make[3]: warning: -j128 forced in submake: resetting jobserver mode. + cp System.map $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot/System.map-6.2.0-rc5-next-20230127+ + cp .config $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/boot/config-6.2.0-rc5-next-20230127+ + /usr/lib/rpm/brp-compress Processing files: kernel-6.2.0_rc5_next_20230127+-1.aarch64 error: File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+ warning: File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/build warning: File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/sourceRPM build warnings:
line 23: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/build File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+/sourceRPM build errors:
cannot open Packages database in/var/lib/rpm
File not found: $PWD/rpmbuild/BUILDROOT/kernel-6.2.0_rc5_next_20230127+-1.aarch64/lib/modules/6.2.0-rc5-next-20230127+
...Cheers,
Nathan
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 70 lines · Masahiro Yamada
.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.
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/Makefile.package | 6 ++---- scripts/package/mkspec | 6 +++--- scripts/setlocalversion | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-)scripts/Makefile.package +2
-4@@ -32,7 +32,7 @@ export KDEB_SOURCENAME TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ include init io_uring ipc kernel lib mm net rust \ samples scripts security sound tools usr virt \ - .config .scmversion Makefile \ + .config Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) MKSPEC := $(srctree)/scripts/package/mkspec@@ -47,10 +47,8 @@ if test "$(objtree)" != "$(srctree)"; then \ echo >&2; \ false; \ fi ; \ -$(srctree)/scripts/setlocalversion --save-scmversion; \ tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ - --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ -rm -f $(objtree)/.scmversion + --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) # rpm-pkg # ---------------------------------------------------------------------------scripts/package/mkspec +3
-3@@ -90,7 +90,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf $S rm -f tools/objtool/{fixdep,objtool} $S $S %build -$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} +$S $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} KBUILD_BUILD_VERSION=%{release} $S %install mkdir -p %{buildroot}/boot@@ -101,8 +101,8 @@ $S %else cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif -$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install - $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install +$M $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_MOD_PATH=%{buildroot} modules_install + $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE cp .config %{buildroot}/boot/config-$KERNELRELEASE $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/buildscripts/setlocalversion +0
-0
scripts/setlocalversion line 14
Quoted 5 lines
scripts/setlocalversion +1
-1@@ -11,16 +11,11 @@ # usage() { - echo "Usage: $0 [--save-scmversion] [srctree]" >&2 + echo "Usage: $0 [srctree]" >&2
Hi Masahiro,
as .scmversion will not we generated (or removed by 'make clean' or 'make mrproper'), might it make sense to add it to scripts/remove-stale-files?
Kind regards,
Nicolas
Quoted 80 lines · Nicolas Schier
Quoted 70 lines · Masahiro Yamada
.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.
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/Makefile.package | 6 ++---- scripts/package/mkspec | 6 +++--- scripts/setlocalversion | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-)scripts/Makefile.package +2
-4@@ -32,7 +32,7 @@ export KDEB_SOURCENAME TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ include init io_uring ipc kernel lib mm net rust \ samples scripts security sound tools usr virt \ - .config .scmversion Makefile \ + .config Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) MKSPEC := $(srctree)/scripts/package/mkspec@@ -47,10 +47,8 @@ if test "$(objtree)" != "$(srctree)"; then \ echo >&2; \ false; \ fi ; \ -$(srctree)/scripts/setlocalversion --save-scmversion; \ tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ - --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ -rm -f $(objtree)/.scmversion + --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) # rpm-pkg # ---------------------------------------------------------------------------scripts/package/mkspec +3
-3@@ -90,7 +90,7 @@ $S rm -f scripts/basic/fixdep scripts/kconfig/conf $S rm -f tools/objtool/{fixdep,objtool} $S $S %build -$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} +$S $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} KBUILD_BUILD_VERSION=%{release} $S %install mkdir -p %{buildroot}/boot@@ -101,8 +101,8 @@ $S %else cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif -$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install - $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install +$M $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_MOD_PATH=%{buildroot} modules_install + $MAKE %{?_smp_mflags} KERNELRELEASE=%{version} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE cp .config %{buildroot}/boot/config-$KERNELRELEASE $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/buildscripts/setlocalversion +0
-0scripts/setlocalversion line 14
Quoted 5 lines
scripts/setlocalversion +1
-1@@ -11,16 +11,11 @@ # usage() { - echo "Usage: $0 [--save-scmversion] [srctree]" >&2 + echo "Usage: $0 [srctree]" >&2Hi Masahiro,
Quoted 8 lines
as .scmversion will not we generated (or removed by 'make clean' or 'make mrproper'), might it make sense to add it to
scripts/remove-stale-files?Reviewed-by Nicolas Schier <[email protected]>Kind regards,
Nicolas
Good point.
.scmversion is removed after the tarball is created (see "rm -f $(objtree)/.scmversion"), but it is left over if the user interrupts while the tarball is being created.
I will fold it locally.
Thanks.
Signature · 2 lines
Best Regards Masahiro Yamada