public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* make rpm-pkg and version mismatch
@ 2011-05-03 21:27 Arun Sharma
  2011-05-04 20:23 ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Arun Sharma @ 2011-05-03 21:27 UTC (permalink / raw)
  To: linux-kbuild


make rpm-pkg produces files that look like: kernel-2.6.39rc5-2.x86_64.rpm
However, uname -r produces 2.6.39rc5 (-2 is missing).

This differs from how some of the distributors are packaging the kernel.
Their setup includes %{release} in uname -r.

One way to achive that is:

--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -170,4 +170,8 @@ else
        fi
 fi
 
+# Append the RPM release 
+release=`. ./scripts/mkversion`
+res="${res}-${release}"
+

But then, I have to go back and remove the %{release} in a number of
places:

--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -24,9 +24,12 @@ fi
 PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
 __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`

+# Remove the -%{release} from __KERNELRELEASE
+__KERNELVERSION=`echo $__KERNELRELEASE | sed -e "s/-[^-]*$//"`
+
 echo "Name: kernel"
 echo "Summary: The Linux Kernel"
-echo "Version: $__KERNELRELEASE"
+echo "Version: $__KERNELVERSION"
 # we need to determine the NEXT version number so that uname and
 # rpm -q will agree
 echo "Release: `. $srctree/scripts/mkversion`"

Rinse and repeat in all other places that refer to KERNELRELEASE
but want KERNELVERSION.

Is there a simpler way to do this?

 -Arun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: make rpm-pkg and version mismatch
  2011-05-03 21:27 make rpm-pkg and version mismatch Arun Sharma
@ 2011-05-04 20:23 ` Michal Marek
  2011-05-04 20:44   ` Arun Sharma
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Marek @ 2011-05-04 20:23 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild

Dne 3.5.2011 23:27, Arun Sharma napsal(a):
>
> make rpm-pkg produces files that look like: kernel-2.6.39rc5-2.x86_64.rpm
> However, uname -r produces 2.6.39rc5 (-2 is missing).
>
> This differs from how some of the distributors are packaging the kernel.
> Their setup includes %{release} in uname -r.

Distributors have control over the kernel uname -r string. make rpm, on 
the other hand, needs to work with both the vanilla version strings, as 
well as any crazy suffixes the user comes up with. Hence it uses the 
uname -v version number as the rpm release, which is always defined.


>
> One way to achive that is:
>
> --- a/scripts/setlocalversion
> +++ b/scripts/setlocalversion
> @@ -170,4 +170,8 @@ else
>          fi
>   fi
>
> +# Append the RPM release
> +release=`. ./scripts/mkversion`
> +res="${res}-${release}"
> +

Please don't do that. make rpm has to work with the version string set 
by the kernel, not the other way around.

Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: make rpm-pkg and version mismatch
  2011-05-04 20:23 ` Michal Marek
@ 2011-05-04 20:44   ` Arun Sharma
  2011-05-04 21:07     ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Arun Sharma @ 2011-05-04 20:44 UTC (permalink / raw)
  To: Michal Marek; +Cc: Arun Sharma, linux-kbuild

On Wed, May 04, 2011 at 10:23:43PM +0200, Michal Marek wrote:
> Dne 3.5.2011 23:27, Arun Sharma napsal(a):
> >
> >make rpm-pkg produces files that look like: kernel-2.6.39rc5-2.x86_64.rpm
> >However, uname -r produces 2.6.39rc5 (-2 is missing).
> >
> >This differs from how some of the distributors are packaging the kernel.
> >Their setup includes %{release} in uname -r.
> 
> Distributors have control over the kernel uname -r string. make rpm,
> on the other hand, needs to work with both the vanilla version
> strings, as well as any crazy suffixes the user comes up with. Hence
> it uses the uname -v version number as the rpm release, which is
> always defined.

Distributors have been doing this traditionally by hacking on the
EXTRAVERSION. But with the stable kernel series also using it,
EXTRAVERSION seems a bit busy.

> 
> Please don't do that. make rpm has to work with the version string
> set by the kernel, not the other way around.

Right.  Here's an alternative approach:

Could we modify the version string provided by the kernel to include
the version string (which is derived from scripts/mkversion)

--- a/Makefile
+++ b/Makefile
@@ -363,11 +363,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

Since mkspec uses the same string for %{release} we get the same
consistency as a distributor built rpm.

 -Arun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: make rpm-pkg and version mismatch
  2011-05-04 20:44   ` Arun Sharma
@ 2011-05-04 21:07     ` Michal Marek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2011-05-04 21:07 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild

Dne 4.5.2011 22:44, Arun Sharma napsal(a):
> On Wed, May 04, 2011 at 10:23:43PM +0200, Michal Marek wrote:
>> Please don't do that. make rpm has to work with the version string
>> set by the kernel, not the other way around.
> 
> Right.  Here's an alternative approach:
> 
> Could we modify the version string provided by the kernel to include
> the version string (which is derived from scripts/mkversion)
> 
> --- a/Makefile
> +++ b/Makefile
> @@ -363,11 +363,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)

Again, please don't do that. Most users don't give a damn about make
rpm. If I build a pristine 2.6.39-rc6, I want uname -r report
2.6.39-rc6, not 2.6.39-rc6-1. not 2.6.39-rc6-2 or anything like that. If
I wanted to decorate the release string, I would set
CONFIG_LOCALVERSION, but please do not make that choice for me. make rpm
is a simple tool to allow developers easily copy kernels from their
build machine to another machine where they can test stuff. If you want
something more advanced, use the spec file from your distro.

Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-04 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-03 21:27 make rpm-pkg and version mismatch Arun Sharma
2011-05-04 20:23 ` Michal Marek
2011-05-04 20:44   ` Arun Sharma
2011-05-04 21:07     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox