Skip to contentSkip to conversation

.version, newversion in Makefile

PATCH In review Rudi Sluijtman 4 participants 5 messages Oct 10, 2001 – Oct 11, 2001 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 .version, newversion in Makefile

Hi,

Due to a change in the main Makefile the .version file is overwritten by a new empty one since at least 2.4.10-pre12, so the version becomes or remains 1 after each recompile.

Quoted 9 lines

From the xfs cvs tree (http://oss.sgi.com/cgi-bin/cvsweb.cgi/linux-2.4-xfs/):

linux/Makefile 2001/09/21 16:28:50 1.124 renamed from linux/Makefile 2001/09/17 02:09:52 1.123 +0 -1
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 10
-EXTRAVERSION =-pre10-xfs

linux/Makefile 2001/09/21 16:28:50 1.124

Quoted 10 lines
linux/Makefile 2001/09/21 16:28:50 1.124 renamed from linux/Makefile 2001/09/17 02:09:52 1.123 +2 -5
+EXTRAVERSION =-pre12-xfs
  .
  .
 newversion:
-       @if [ ! -f .version ]; then \
-               echo 1 > .version; \
-       else \
-               expr 0`cat .version` + 1 > .version; \
-       fi
+       . scripts/mkversion > .version

The script does the same as the lines in the Makefile, except that it does not specify stdout.

The script cats .version, but, this has just been overwritten because of the redirection: "scripts/mkversion > .version", so it is empty before the script can read it.

I do no know why the lines in the Makefile have been moved to a script, but this is obviously not the way to do it.

A small change to mkversion and leaving out the "> .version" in the Makefile for instance can do the trick:

A patch for this against linux-2.4.11:

Makefile +2 -2
diff -u --recursive --new-file linux-2.4.11/Makefile linux/Makefile
@@ -300,7 +300,7 @@
 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
 
 newversion:
-	. scripts/mkversion > .version
+	. scripts/mkversion
 
 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
 	@echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
@@ -530,6 +530,6 @@
 	tar -cvz --exclude CVS -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
 	rm $(KERNELPATH) ; \
 	cd $(TOPDIR) ; \
-	. scripts/mkversion > .version ; \
+	. scripts/mkversion ; \
 	rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
 	rm $(TOPDIR)/../$(KERNELPATH).tar.gz
scripts/mkversion +2 -2
diff -u --recursive --new-file linux-2.4.11/scripts/mkversion linux/scripts/mkversion
@@ -1,6 +1,6 @@
 if [ ! -f .version ]
 then
-    echo 1
+    echo 1 > .version
 else
-    expr 0`cat .version` + 1
+    expr 0`cat .version` + 1 > .version
 fi
#2 lore raw

From: Russell King <[email protected]>
Date: Thu, 11 Oct 2001 01:00:32 +0100

Quoted 3 lines · Rudi Sluijtman

Due to a change in the main Makefile the .version file is overwritten by a new empty one since at least 2.4.10-pre12, so the version becomes or remains 1 after each recompile.

There is a patch in -ac to fix this.

I've also independantly just sent Linus a patch to fix this. I was not aware of the -ac fix, sorry.

Franks a lot,
David S. Miller
[email protected]

#3 lore raw
Quoted 4 lines

There is a patch in -ac to fix this.

I've also independantly just sent Linus a patch to fix this. I was not aware of the -ac fix, sorry.

Maybe he'll notice this time. Russell sent him a fix, I sent him Russells fix and now you've sent him a fix 8)

No big problem

Alan