public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Arun Sharma <asharma@fb.com>
To: Michal Marek <mmarek@suse.cz>
Cc: Arun Sharma <asharma@fb.com>, linux-kbuild@vger.kernel.org
Subject: Re: make rpm-pkg and version mismatch
Date: Wed, 4 May 2011 13:44:51 -0700	[thread overview]
Message-ID: <20110504204451.GA28259@dev1756.snc6.facebook.com> (raw)
In-Reply-To: <4DC1B5CF.3070803@suse.cz>

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

  reply	other threads:[~2011-05-04 20:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-05-04 21:07     ` Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110504204451.GA28259@dev1756.snc6.facebook.com \
    --to=asharma@fb.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox