Skip to contentSkip to conversation

kbuild: Restore .version auto-increment behaviour for Debian/RPM packages

PATCH In review Marc Zyngier 2 participants 4 messages Nov 13, 2022 – Nov 15, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: Restore .version auto-increment behaviour for Debian/RPM packages

Since 2df8220cc511 ("kbuild: build init/built-in.a just once"), generating Debian packages using 'make bindeb-pkg' results in packages that are stuck to the same .version, leading to unexpected behaviours (multiple packages with the same version).

Restore the previous behaviour by calling init/build-version instead of reading the .version file. This is likely to result in too many .version bumps, but this is what was happening before (although the bump was affecting builds made the current one).

Only tested with bindeb-pkg.

Fixes 2df8220cc511 ("kbuild: build init/built-in.a just once")
Cc Masahiro Yamada <[email protected]>
Cc Michal Marek <[email protected]>
Cc Nick Desaulniers <[email protected]>
---
 scripts/package/mkdebian | 2 +-
 scripts/package/mkspec   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/package/mkdebian +1 -1
index 60a2a63a5e90..e5c983afddab 100755
@@ -90,7 +90,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
 	packageversion=$KDEB_PKGVERSION
 	revision=${packageversion##*-}
 else
-	revision=$(cat .version 2>/dev/null||echo 1)
+	revision=$(init/build-version)
 	packageversion=$version-$revision
 fi
 sourcename=$KDEB_SOURCENAME
scripts/package/mkspec +1 -1
index 70392fd2fd29..9cbd45f497ba 100755
@@ -42,7 +42,7 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
 	Name: kernel
 	Summary: The Linux Kernel
 	Version: $__KERNELRELEASE
-	Release: $(cat .version 2>/dev/null || echo 1)
+	Release: $(init/build-version)
 	License: GPL
 	Group: System Environment/Kernel
 	Vendor: The Linux Community
Signature · 1 line
2.34.1
#1 lore raw

scripts/package/mkdebian if [ -n "$KDEB_PKGVERSION" ]; then · line 93

Quoted 11 lines · Marc Zyngier
scripts/package/mkdebian +1 -1
index 60a2a63a5e90..e5c983afddab 100755
@@ -90,7 +90,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
        packageversion=$KDEB_PKGVERSION
        revision=${packageversion##*-}
 else
-       revision=$(cat .version 2>/dev/null||echo 1)
+       revision=$(init/build-version)

This does not work for out-of-tree builds because init/build-version is a check-in source file.

For example, "make O=/tmp/foo bindeb-pkg" fails with:
.../linux/scripts/package/mkdebian: 93: init/build-version: not found

The correct code is:

          revision=$($srctree/init/build-version)

scripts/package/mkspec sed -e '/^DEL/d' -e 's/^\t*//' <<EOF · line 45

Quoted 13 lines
scripts/package/mkdebian +0 -0
        packageversion=$version-$revision
 fi
 sourcename=$KDEB_SOURCENAME
scripts/package/mkspec +1 -1
index 70392fd2fd29..9cbd45f497ba 100755
@@ -42,7 +42,7 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
        Name: kernel
        Summary: The Linux Kernel
        Version: $__KERNELRELEASE
-       Release: $(cat .version 2>/dev/null || echo 1)
+       Release: $(init/build-version)

Ditto.

          Release: $($srctree/init/build-version)
Quoted 6 lines
scripts/package/mkspec +0 -1
        License: GPL
        Group: System Environment/Kernel
        Vendor: The Linux Community
--

2.34.1

--
Best Regards
Masahiro Yamada

#2 lore raw
Quoted 49 lines · Masahiro Yamada

scripts/package/mkdebian if [ -n "$KDEB_PKGVERSION" ]; then · line 93

Quoted 11 lines · Marc Zyngier
scripts/package/mkdebian +1 -1
index 60a2a63a5e90..e5c983afddab 100755
@@ -90,7 +90,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
        packageversion=$KDEB_PKGVERSION
        revision=${packageversion##*-}
 else
-       revision=$(cat .version 2>/dev/null||echo 1)
+       revision=$(init/build-version)

This does not work for out-of-tree builds because init/build-version is a check-in source file.

For example, "make O=/tmp/foo bindeb-pkg" fails with:
.../linux/scripts/package/mkdebian: 93: init/build-version: not found

The correct code is:

          revision=$($srctree/init/build-version)

scripts/package/mkspec sed -e '/^DEL/d' -e 's/^\t*//' <<EOF · line 45

Quoted 13 lines
scripts/package/mkdebian +0 -0
        packageversion=$version-$revision
 fi
 sourcename=$KDEB_SOURCENAME
scripts/package/mkspec +1 -1
index 70392fd2fd29..9cbd45f497ba 100755
@@ -42,7 +42,7 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
        Name: kernel
        Summary: The Linux Kernel
        Version: $__KERNELRELEASE
-       Release: $(cat .version 2>/dev/null || echo 1)
+       Release: $(init/build-version)

Ditto.

Quoted 1 line
          Release: $($srctree/init/build-version)

No, mkspec needs no change because binrpm-pkg builds the kernel _before_ generating the spec file.

If you increment the .version file here again, you would have the revision mismatch between the package and the actual vmlinuz.

Please send the change for mkdebian only.

Quoted 12 lines
Quoted 10 lines
scripts/package/mkspec +0 -1
        License: GPL
        Group: System Environment/Kernel
        Vendor: The Linux Community
--

2.34.1

Quoted 3 lines

--
Best Regards
Masahiro Yamada

--
Best Regards
Masahiro Yamada

#3 lore raw
Quoted 58 lines · Masahiro Yamada
Quoted 49 lines · Masahiro Yamada

scripts/package/mkdebian if [ -n "$KDEB_PKGVERSION" ]; then · line 93

Quoted 11 lines · Marc Zyngier
scripts/package/mkdebian +1 -1
index 60a2a63a5e90..e5c983afddab 100755
@@ -90,7 +90,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
        packageversion=$KDEB_PKGVERSION
        revision=${packageversion##*-}
 else
-       revision=$(cat .version 2>/dev/null||echo 1)
+       revision=$(init/build-version)

This does not work for out-of-tree builds because init/build-version is a check-in source file.

For example, "make O=/tmp/foo bindeb-pkg" fails with:
.../linux/scripts/package/mkdebian: 93: init/build-version: not found

The correct code is:

          revision=$($srctree/init/build-version)

scripts/package/mkspec sed -e '/^DEL/d' -e 's/^\t*//' <<EOF · line 45

Quoted 13 lines
scripts/package/mkdebian +0 -0
        packageversion=$version-$revision
 fi
 sourcename=$KDEB_SOURCENAME
scripts/package/mkspec +1 -1
index 70392fd2fd29..9cbd45f497ba 100755
@@ -42,7 +42,7 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
        Name: kernel
        Summary: The Linux Kernel
        Version: $__KERNELRELEASE
-       Release: $(cat .version 2>/dev/null || echo 1)
+       Release: $(init/build-version)

Ditto.

Quoted 1 line
          Release: $($srctree/init/build-version)

No, mkspec needs no change because binrpm-pkg builds the kernel _before_ generating the spec file.

Quoted 6 lines

If you increment the .version file here again, you would have the revision mismatch between the package and the actual vmlinuz.

Please send the change for mkdebian only.

Yup, good point on both count. Patch incoming shortly.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.