diff mbox

[5/6] kbuild: Append RPM release to $KERNELRELEASE

Message ID 1305653779-3445-5-git-send-email-asharma@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arun Sharma May 17, 2011, 5:36 p.m. UTC
Provide the same consistency as distributor kernels.
uname -r matches RPM name (includes the release)

Glossary:

KERNELRELEASE = what users see
___KERNELRELEASE = KERNELRELEASE without RPM release
__KERNELRELEASE = ___KERNELRELEASE with s/-/_/g

Signed-off-by: Arun Sharma <asharma@fb.com>
---
 Makefile                 |    9 ++++++---
 scripts/package/Makefile |    2 +-
 scripts/package/mkspec   |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

Comments

Arun Sharma May 17, 2011, 5:46 p.m. UTC | #1
On Tue, May 17, 2011 at 10:36:18AM -0700, Arun Sharma wrote:
> Provide the same consistency as distributor kernels.
> uname -r matches RPM name (includes the release)

Not all of the patches in this series may be appropriate for
inclusion into kbuild. But I wanted to send them out anyway
to get feedback on how things can be improved.

This patch in particular changes the rpm name and might need
to be an opt-in feature.

 -Arun
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Marek May 17, 2011, 8:13 p.m. UTC | #2
On 17.5.2011 19:36, Arun Sharma wrote:
> Provide the same consistency as distributor kernels.
> uname -r matches RPM name (includes the release)
> 
> Glossary:
> 
> KERNELRELEASE = what users see
> ___KERNELRELEASE = KERNELRELEASE without RPM release
> __KERNELRELEASE = ___KERNELRELEASE with s/-/_/g
> 
> Signed-off-by: Arun Sharma <asharma@fb.com>
> ---
>  Makefile                 |    9 ++++++---
>  scripts/package/Makefile |    2 +-
>  scripts/package/mkspec   |    2 +-
>  3 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 28820f7..90d45f4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -367,11 +367,14 @@ KBUILD_AFLAGS_MODULE  := -DMODULE
>  KBUILD_CFLAGS_MODULE  := -DMODULE
>  KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
>  
> -# Read KERNELRELEASE from include/config/kernel.release (if it exists)
> -KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
> +# Read ___KERNELRELEASE from include/config/kernel.release (if it exists)
> +___KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
> +# Append the release version only once. 
> +# Note: .version could change during the build.
> +KERNELRELEASE ?= $(___KERNELRELEASE)-$(shell /bin/sh scripts/mkversion)

Please stop decorating the kernel release string for the sake of make
rpm, thanks. If you really want the kernel release string match rpm's
%{version}-%{release}, how about this: Let the user set
CONFIG_LOCALVERSION=-<number> and check in make rpm if $KERNELRELEASE
ends with -<number>. If so, use <number> in the Release: field and the
rest in Version:, otherwise use the same scheme as before. That way, you
won't force a new kernel release numbering scheme on anyone.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arun Sharma May 20, 2011, 8:59 p.m. UTC | #3
On Tue, May 17, 2011 at 10:13:55PM +0200, Michal Marek wrote:
> 
> Please stop decorating the kernel release string for the sake of make
> rpm, thanks. If you really want the kernel release string match rpm's
> %{version}-%{release}, how about this: Let the user set
> CONFIG_LOCALVERSION=-<number> and check in make rpm if $KERNELRELEASE
> ends with -<number>. If so, use <number> in the Release: field and the
> rest in Version:, otherwise use the same scheme as before. That way, you
> won't force a new kernel release numbering scheme on anyone.

Turns out that even this patch isn't sufficient for what we were trying to
do. Let's drop this patch for now. The other patches are independent
and should still apply.

 -Arun

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 28820f7..90d45f4 100644
--- a/Makefile
+++ b/Makefile
@@ -367,11 +367,14 @@  KBUILD_AFLAGS_MODULE  := -DMODULE
 KBUILD_CFLAGS_MODULE  := -DMODULE
 KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
 
-# Read KERNELRELEASE from include/config/kernel.release (if it exists)
-KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
+# Read ___KERNELRELEASE from include/config/kernel.release (if it exists)
+___KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
+# Append the release version only once. 
+# Note: .version could change during the build.
+KERNELRELEASE ?= $(___KERNELRELEASE)-$(shell /bin/sh scripts/mkversion)
 KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
-export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
+export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION ___KERNELRELEASE
 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP
 export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 1b7eaea..0ec687b 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -26,7 +26,7 @@  RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
 	           else echo rpm; fi)
 
 # Remove hyphens since they have special meaning in RPM filenames
-KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
+KERNELPATH := kernel-$(subst -,_,$(___KERNELRELEASE))
 MKSPEC     := $(srctree)/scripts/package/mkspec
 PREV       := set -e; cd ..;
 
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index bf215c5..9a8c2fa 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -22,7 +22,7 @@  if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
 fi
 
 PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
-__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
+__KERNELRELEASE=`echo $___KERNELRELEASE | sed -e "s/-/_/g"`
 
 echo "Name: kernel"
 echo "Summary: The Linux Kernel"