Bug 37759 - RFE: version.h: kernel spec should pay more attention
Summary: RFE: version.h: kernel spec should pay more attention
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 7.0
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-04-26 10:23 UTC by giulioo
Modified: 2007-03-27 03:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-04-26 10:24:04 UTC
Embargoed:


Attachments (Terms of Use)

Description giulioo 2001-04-26 10:23:59 UTC
The problem described here can now be easily solved by editing the spec, 
but it would be nice if you consider this issue next time you'll redesign 
part of the kernel spec, so that this would be taken care of automatically.

Problem:
At the top of the spec file there are %define's to include various kind of 
kernels in the rpm build: smp, BOOT, enterprise, ....
I usually set all of them to off, to build just the "normal" up kernel.

You use this "trick" to build the version.h
===
echo "#include <linux/rhconfig.h>" >> version.h
keyword=if
for i in smp BOOT BOOTsmp enterprise up; do
    verh=`echo ../../savedheaders/*/$i/version.h | awk ' { print $1 } '`
    if [ -n "$verh" -a -f "$verh" ]; then
   if [ "$i" = up ]; then
       echo "#else" >> version.h
   else
       echo "#$keyword defined(__module__$i)" >> version.h
       keyword=elif
   fi
   grep UTS_RELEASE $verh >> version.h
   fi
done
echo "#endif" >> version.h
===

Guess what happens if you build the rpm with just the up kernel... :)
You end up with a version.h like

===
#include <linux/rhconfig.h>
#else
#define UTS_RELEASE "x.x.x"
#endif
#define LINUX_VERSION_CODE 131600
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
===

Maybe, since rhconfig.h defines __module__up, you could take out the up 
particular case and use something like this (not tested), which should 
always produce a correct version.h. If you want to maintain a catch-all 
rule you could add it after "done", before "#endif".

===
echo "#include <linux/rhconfig.h>" >> version.h
keyword=if
for i in smp BOOT BOOTsmp enterprise up; do
	verh=`echo ../../savedheaders/*/$i/version.h | awk ' { print 
$1 } '`
	if [ -n "$verh" -a -f "$verh" ]; then
		echo "#$keyword defined(__module__$i)" >> version.h
		keyword=elif
		grep UTS_RELEASE $verh >> version.h
	fi
done
echo "#endif" >> version.h
===

Comment 1 Arjan van de Ven 2001-04-26 10:44:29 UTC
fixed; thanks for the report.


Note You need to log in before you can comment on or make changes to this bug.