Bug 8275

Summary: make rpm-pkg broken for git cloned sources
Product: Other Reporter: Julio Merino (jmmv)
Component: ConfigurationAssignee: Sam Ravnborg (sam)
Status: REJECTED INSUFFICIENT_DATA    
Severity: normal    
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.21-rc5-g28defbea Subsystem:
Regression: --- Bisected commit-id:
Attachments: A fix that modifies the tarball's local version.

Description Julio Merino 2007-03-28 04:51:31 UTC
I'm currently fetching the Linux sources using git (more exactly, cogito) and
have found that a "make rpm-pkg" from them breaks.  The version for which I'm
reporting this bug is the most recent head of torvalds/linux-2.6.git's master
branch (g28defbea at the moment).

The rpm-pkg target breaks because the build installs the kernel modules into
/lib/modules/2.6.21-rc5, but the rpm .spec file expects them to be in
/lib/modules/2.6.21-rc5-g28defbea.  Below is an analysis of the problem:

1. The rpm-pkg target creates a tarball of the sources for use by the rpmbuild
utility.  This tarball is created ignoring all GIT control files (by means of
the RCS_FIND_IGNORE definition in the main Makefile), as well as any other file
used by different VCS systems.

2. The kernel.spec file used to construct the RPM file is generated by the
Makefiles and scripts found in the sources extracted from git.

3. Because of 2, the .spec file contains references to the kernel version with
the git local version string added (2.6.21-rc5-g28defbea).

4. Because of 1, when the kernel is built by rpmbuild from the generated
tarball, it does not have the .git control directories available.  Hence it
deduces a different version number (2.6.21-rc5).

5. As a result, when the kernel is built, the modules end up in
/lib/modules/2.6.21-rc5, but the .spec file expects them in the
/lib/modules/2.6.21-rc5-g28defbea directory.  Boom, error.

To reproduce, clone the kernel sources by using cg-clone, configure them and
then run a "make rpm-pkg".

This has been detected using the powerpc architecture, but should happen on all
others.
Comment 1 Julio Merino 2007-03-28 04:53:30 UTC
Created attachment 10971 [details]
A fix that modifies the tarball's local version.

This patch modifies the tarball generation to include a modified .config file
that carries the git's version number as part of the local version identifier. 
I don't know if this is the correct way to go, but so far fixes the problems
for me.
Comment 2 Sam Ravnborg 2007-06-07 12:14:13 UTC
We already store the kernel.release string in the file:
include/config/kernel.release

So it should be much simpler just to cat this file.
Can you please try that out and let us know if it cures the troubles.

Thanks,
    Sam