Skip to contentSkip to conversation

read EXTRAVERSION from file

PATCH In review Christoph Hellwig 5 participants 6 messages Aug 30, 2004 – Sep 10, 2004 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 read EXTRAVERSION from file

The're an very interesting patch in the Debian tree still from the time where Herbert Xu mentioned it, it allows creating a file .extraversion in the toplevel kernel directory and the Makefile will set EXTRAVERSION to it's contents. This has the nice advantage of keeping an extraversion pre-tree instead of having to patch the Makefile and getting rejects everytime you pull a new tree (or BK refuses to touch the Makefile).

The only thing I'm not fully comfortable is the .extraversion name, I think I'd prefer a user-visible name.

Any other comments on this one?

Makefile +3 -0
@@ -151,6 +151,9 @@
 
 export srctree objtree VPATH TOPDIR
 
+ifeq ($(EXTRAVERSION),)
+EXTRAVERSION := $(shell [ ! -f .extraversion ] || cat .extraversion)
+endif
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
 # SUBARCH tells the usermode build what the underlying arch is.  That is set
#1 lore raw
Quoted 2 lines · Christoph Hellwig

The only thing I'm not fully comfortable is the .extraversion name, I think I'd prefer a user-visible name.

Agreed.

Quoted 1 line

Any other comments on this one?

Yes please!

Cheers,
Muli

Signature · 2 lines
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/
#2 lore raw
In reply to Christoph Hellwig
Quoted 16 lines · Christoph Hellwig

The're an very interesting patch in the Debian tree still from the time where Herbert Xu mentioned it, it allows creating a file .extraversion in the toplevel kernel directory and the Makefile will set EXTRAVERSION to it's contents. This has the nice advantage of keeping an extraversion pre-tree instead of having to patch the Makefile and getting rejects everytime you pull a new tree (or BK refuses to touch the Makefile).

The only thing I'm not fully comfortable is the .extraversion name, I think I'd prefer a user-visible name.

Any other comments on this one?

Makefile line 157

Quoted 7 lines
Makefile +3 -0
@@ -151,6 +151,9 @@
 
 export srctree objtree VPATH TOPDIR
 
+ifeq ($(EXTRAVERSION),)
+EXTRAVERSION := $(shell [ ! -f .extraversion ] || cat .extraversion)
+endif
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)

This would fail for 2.6.8.1 for instance. Or at least the '1' that Linus added would be part of the final EXTRAVERSION.

Ian Wienand <[email protected]> posted a patch some time ago that introduces LOCALVERSION - it's in my queue but not applied since it needs some rework. And documentation also.
That should be easy to extend to read the file localversion.

I would then prefer something like:
If exists $(srctree)/localversion read file and append to LOCALVERSION If exists $(objtree)/localversion read file and append to LOCALVERSION

Example for a debian patched kernel src tree:

srctree:
localversion <= contains -deb-unstb-7.9
objtree:
localversion <= contains -smp-p4

Resulting in a kernelversion equals: 2.6.8-rc1-deb-unstb-7.9-smp-p4

Sam

#3 lore raw
Quoted 6 lines · Sam Ravnborg

This would fail for 2.6.8.1 for instance. Or at least the '1' that Linus added would be part of the final EXTRAVERSION.

Ian Wienand <[email protected]> posted a patch some time ago that introduces LOCALVERSION - it's in my queue but not applied since it needs some rework. And documentation also.
That should be easy to extend to read the file localversion.

Nice idea, because we indeed ran into the problem with 2.6.8.1 that our own extraversion we always set in the kernel rpms overwrite the .1. So we are now extracting the EXTRAVERSION from the Makefile to add our own stuff. All very ugly since the extraversion is contained e.g. in the path of the kernel source file, and thus, setting an own extraversion makes all the path stuff difficult.
A LOCALVERSION that was always uninitialized in the kernel.org packages would be a nice thing, so that EXTRAVERSION could be left untouched.

cu,
Frank

Signature · 4 lines
Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
#4 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

The're an very interesting patch in the Debian tree still from the time where Herbert Xu mentioned it, it allows creating a file .extraversion in the toplevel kernel directory and the Makefile will set EXTRAVERSION to it's contents. This has the nice advantage of keeping an extraversion pre-tree instead of having to patch the Makefile and getting rejects everytime you pull a new tree (or BK refuses to touch the Makefile).

Quoted 4 lines

The only thing I'm not fully comfortable is the .extraversion name, I think I'd prefer a user-visible name.

Any other comments on this one?

(catching up)

Consider this approach as a more flexible alternative:

http://groups.google.com/groups?q=oxymoron+patch+names&hl=en&lr=&ie=UTF-8&selm=fa.jif8l5v.1b049jd%40ifi.uio.no&rnum=1

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#5 lore raw
Quoted 12 lines · Matt Mackall
Quoted 11 lines · Christoph Hellwig

The're an very interesting patch in the Debian tree still from the time where Herbert Xu mentioned it, it allows creating a file .extraversion in the toplevel kernel directory and the Makefile will set EXTRAVERSION to it's contents. This has the nice advantage of keeping an extraversion pre-tree instead of having to patch the Makefile and getting rejects everytime you pull a new tree (or BK refuses to touch the Makefile).

The only thing I'm not fully comfortable is the .extraversion name, I think I'd prefer a user-visible name.

Quoted 7 lines
Quoted 1 line

Any other comments on this one?

(catching up)

Consider this approach as a more flexible alternative:

http://groups.google.com/groups?q=oxymoron+patch+names&hl=en&lr=&ie=UTF-8&selm=fa.jif8l5v.1b049jd%40ifi.uio.no&rnum=1

Did something remotely similar.
Name the file localversion* and it will be in KERNELRELEASE.

Sam