public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Josh Hunt <josh@scalex86.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	kiran@scalex86.org, mingo@elte.hu
Subject: Re: [PATCH] Fix 'make rpm' when CONFIG_LOCALVERSION_AUTO=y and using SCM tree
Date: Sun, 15 Feb 2009 10:03:01 +0100	[thread overview]
Message-ID: <20090215090301.GA29048@uranus.ravnborg.org> (raw)
In-Reply-To: <20090212181605.GA7696@localhost.localdomain>

On Thu, Feb 12, 2009 at 10:16:05AM -0800, Josh Hunt wrote:
> Running 'make rpm' fails when CONFIG_LOCALVERSION_AUTO=y and using a kernel source
> tree under SCM.  This is due to KERNELRELEASE being different when the initial make
> is run and when make is run from rpmbuild.
...

I had to hand apply your patch and ended up with the following.

Changes:
- renamed from autoversion to scmversion
- simpler logic in top-level Makefile
- removed "set -e;" in scripts/package/Makefile - they are not needed

Please test.

	Sam

diff --git a/Makefile b/Makefile
index 22d7584..3824446 100644
--- a/Makefile
+++ b/Makefile
@@ -903,12 +903,18 @@ localver = $(subst $(space),, $(string) \
 # and if the SCM is know a tag from the SCM is appended.
 # The appended tag is determined by the SCM used.
 #
-# Currently, only git is supported.
-# Other SCMs can edit scripts/setlocalversion and add the appropriate
-# checks as needed.
+# .scmversion is used when generating rpm packages so we do not loose
+# the version information from the SCM when we do the build of the kernel
+# from the copied source
 ifdef CONFIG_LOCALVERSION_AUTO
-	_localver-auto = $(shell $(CONFIG_SHELL) \
-	                  $(srctree)/scripts/setlocalversion $(srctree))
+
+ifeq ($(wildcard .scmversion),)
+        _localver-auto = $(shell $(CONFIG_SHELL) \
+                         $(srctree)/scripts/setlocalversion $(srctree))
+else
+        _localver-auto = $(shell cat .scmversion 2> /dev/null)
+endif
+
 	localver-auto  = $(LOCALVERSION)$(_localver-auto)
 endif
 
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 8c6b7b0..fa4a0a1 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -35,9 +35,10 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
 rpm-pkg rpm: $(objtree)/kernel.spec FORCE
 	$(MAKE) clean
 	$(PREV) ln -sf $(srctree) $(KERNELPATH)
+	$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion
 	$(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
 	$(PREV) rm $(KERNELPATH)
-
+	rm -f $(objtree)/.scmversion
 	set -e; \
 	$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
 	set -e; \

  reply	other threads:[~2009-02-15  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 18:16 [PATCH] Fix 'make rpm' when CONFIG_LOCALVERSION_AUTO=y and using SCM tree Josh Hunt
2009-02-15  9:03 ` Sam Ravnborg [this message]
2009-02-17  0:10   ` Josh Hunt

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=20090215090301.GA29048@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=josh@scalex86.org \
    --cc=kiran@scalex86.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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