[2/6] kbuild: deb-pkg: do not take KERNELRELEASE from the source version

Message ID 20230312200731.599706-3-masahiroy@kernel.org
State New
Headers
Series kbuild: fix some packaging issues, and use git-archive for source package |

Commit Message

Masahiro Yamada March 12, 2023, 8:07 p.m. UTC
  KERNELRELEASE does not need to match the package version in changelog.
Rather, it conventially matches what is called 'ABINAME', which is a
part of the binary package names.

Both are the same by default, but the former might be overridden by
KDEB_PKGVERSION. In this case, the resulting package would not boot
because /lib/modules/$(uname -r) does not point the module directory.

Partially revert 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability
of source package").

Reported-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fixes: 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source package")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/deb-build-option | 9 ++++-----
 scripts/package/mkdebian         | 1 +
 2 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

Péter Ujfalusi March 13, 2023, 11:31 a.m. UTC | #1
Hi,

On 12/03/2023 22:07, Masahiro Yamada wrote:
> KERNELRELEASE does not need to match the package version in changelog.
> Rather, it conventially matches what is called 'ABINAME', which is a
> part of the binary package names.
> 
> Both are the same by default, but the former might be overridden by
> KDEB_PKGVERSION. In this case, the resulting package would not boot
> because /lib/modules/$(uname -r) does not point the module directory.
> 
> Partially revert 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability
> of source package").

Thank you, I have tested locally and in our CI, bindeb-pkg target works
again.

Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

> 
> Reported-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
> Fixes: 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source package")
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/package/deb-build-option | 9 ++++-----
>  scripts/package/mkdebian         | 1 +
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/package/deb-build-option b/scripts/package/deb-build-option
> index b079b0d121d4..bd53624318f2 100755
> --- a/scripts/package/deb-build-option
> +++ b/scripts/package/deb-build-option
> @@ -8,9 +8,8 @@ if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUI
>  fi
>  
>  version=$(dpkg-parsechangelog -S Version)
> -version_upstream="${version%-*}"
> -debian_revision="${version#${version_upstream}}"
> -debian_revision="${debian_revision#*-}"
> +debian_revision="${version##*-}"
>  
> -echo KERNELRELEASE=${version_upstream}
> -echo KBUILD_BUILD_VERSION=${debian_revision}
> +if [ "${version}" != "${debian_revision}" ]; then
> +	echo KBUILD_BUILD_VERSION=${debian_revision}
> +fi
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index c6fbfb9f74ba..31b050368cd0 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -244,6 +244,7 @@ KERNELRELEASE = ${KERNELRELEASE}
>  build-indep:
>  build-arch:
>  	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
> +	KERNELRELEASE=\$(KERNELRELEASE) \
>  	\$(shell \$(srctree)/scripts/package/deb-build-option) \
>  	olddefconfig all
>
  

Patch

diff --git a/scripts/package/deb-build-option b/scripts/package/deb-build-option
index b079b0d121d4..bd53624318f2 100755
--- a/scripts/package/deb-build-option
+++ b/scripts/package/deb-build-option
@@ -8,9 +8,8 @@  if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUI
 fi
 
 version=$(dpkg-parsechangelog -S Version)
-version_upstream="${version%-*}"
-debian_revision="${version#${version_upstream}}"
-debian_revision="${debian_revision#*-}"
+debian_revision="${version##*-}"
 
-echo KERNELRELEASE=${version_upstream}
-echo KBUILD_BUILD_VERSION=${debian_revision}
+if [ "${version}" != "${debian_revision}" ]; then
+	echo KBUILD_BUILD_VERSION=${debian_revision}
+fi
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index c6fbfb9f74ba..31b050368cd0 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -244,6 +244,7 @@  KERNELRELEASE = ${KERNELRELEASE}
 build-indep:
 build-arch:
 	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
+	KERNELRELEASE=\$(KERNELRELEASE) \
 	\$(shell \$(srctree)/scripts/package/deb-build-option) \
 	olddefconfig all