Bug 37759 - RFE: version.h: kernel spec should pay more attention
RFE: version.h: kernel spec should pay more attention
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
7.0
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brock Organ
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-04-26 06:23 EDT by giulioo
Modified: 2007-03-26 23:43 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-04-26 06:24:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description giulioo 2001-04-26 06:23:59 EDT
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 06:44:29 EDT
fixed; thanks for the report.

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