Skip to contentSkip to conversation

Fix scripts/setlocalversion with git

PATCH Superseded Nico Schottelius 4 participants 9 messages Mar 30, 2009 – Apr 25, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix scripts/setlocalversion with git

Hello!

When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion.

This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev.

Please apply, otherwise testers like me always have '2.6.29' for trees with unanottated tags, instead of 2.6.29-20318-g9aa4755, which helps a lot if you've tons of kernels installed from different trees.

Sincerly,

Nico

ps: please cc on reply

scripts/setlocalversion +6 -7
@@ -10,13 +10,12 @@
 
 # Check for git and a git repo.
 if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
-	# Do we have an untagged version?
-	if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
-		if tag=`git describe 2>/dev/null`; then
-			echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
-		else
-			printf '%s%s' -g $head
-		fi
+	# Do we have an annotated tag?
+	if atag=`git describe 2>/dev/null`; then
+		echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+	# add -g${head}, if there is no usable tag
+	else
+		printf '%s%s' -g $head
 	fi
 
 	# Is this git on svn?
#1 lore raw

PATCH RESEND 1/1 Fix scripts/setlocalversion with git

Hello again!

I just saw that this patch did not go anywhere and did not have any replies, so I repost it.

I also created a git-repo at

git://git.schottelius.org/linux/linux-2.6
gitweb:
http://git.schottelius.org/?p=linux/linux-2.6;a=summary

if you want the patch (f43ba0be1204e7c26cc700a75bdb688a788fbf2f) via git.

Sincerly,

Nico

Nico Schottelius [Mon, Mar 30, 2009 at 02:21:37PM +0200]:

Quoted 14 lines

Hello!

When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion.

This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev.

Please apply, otherwise testers like me always have '2.6.29' for trees with unanottated tags, instead of 2.6.29-20318-g9aa4755, which helps a lot if you've tons of kernels installed from different trees.

Quoted 5 lines

Sincerly,

Nico

ps: please cc on reply

scripts/setlocalversion +6 -7
@@ -10,13 +10,12 @@
 
 # Check for git and a git repo.
 if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
-	# Do we have an untagged version?
-	if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
-		if tag=`git describe 2>/dev/null`; then
-			echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
-		else
-			printf '%s%s' -g $head
-		fi
+	# Do we have an annotated tag?
+	if atag=`git describe 2>/dev/null`; then
+		echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+	# add -g${head}, if there is no usable tag
+	else
+		printf '%s%s' -g $head
 	fi
 
 	# Is this git on svn?
#2 lore raw
Quoted 11 lines · Nico Schottelius

Hello again!

I just saw that this patch did not go anywhere and did not have any replies, so I repost it.

I also created a git-repo at

git://git.schottelius.org/linux/linux-2.6
gitweb:
http://git.schottelius.org/?p=linux/linux-2.6;a=summary

Quoted 21 lines

if you want the patch (f43ba0be1204e7c26cc700a75bdb688a788fbf2f) via git.

Sincerly,

Nico

Nico Schottelius [Mon, Mar 30, 2009 at 02:21:37PM +0200]:

Quoted 13 lines

Hello!

When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion.

This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev.

Please apply, otherwise testers like me always have '2.6.29' for trees with unanottated tags, instead of 2.6.29-20318-g9aa4755, which helps a lot if you've tons of kernels installed from different trees.

This patch isn't trivial enough to be applicable through trivial tree. Adding Sam to CC.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#3 lore raw
Quoted 31 lines · Jiri Kosina
Quoted 29 lines · Nico Schottelius

Hello again!

I just saw that this patch did not go anywhere and did not have any replies, so I repost it.

I also created a git-repo at

git://git.schottelius.org/linux/linux-2.6
gitweb:
http://git.schottelius.org/?p=linux/linux-2.6;a=summary

if you want the patch (f43ba0be1204e7c26cc700a75bdb688a788fbf2f) via git.

Sincerly,

Nico

Nico Schottelius [Mon, Mar 30, 2009 at 02:21:37PM +0200]:

Quoted 10 lines

Hello!

When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion.

This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Please apply, otherwise testers like me always have '2.6.29' for trees with unanottated tags, instead of 2.6.29-20318-g9aa4755, which helps a lot if you've tons of kernels installed from different trees.

This patch isn't trivial enough to be applicable through trivial tree. Adding Sam to CC.

Thanks. Will take care later this week.

Sam

#4 lore raw

Hey Sam,

Sam Ravnborg [Tue, Apr 07, 2009 at 07:45:50PM +0200]:

Quoted 5 lines · Jiri Kosina
Quoted 4 lines · Nico Schottelius
Quoted 3 lines

git://git.schottelius.org/linux/linux-2.6

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

if you want the patch (f43ba0be1204e7c26cc700a75bdb688a788fbf2f) via git.

This patch isn't trivial enough to be applicable through trivial tree. Adding Sam to CC.

Thanks. Will take care later this week.

had some time to look at it / some comments?

Sincerly,

Nico

Signature · 4 lines
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C
#5 lore raw
Quoted 11 lines · Nico Schottelius

Hey Sam,

Sam Ravnborg [Tue, Apr 07, 2009 at 07:45:50PM +0200]:

Quoted 8 lines · Jiri Kosina
Quoted 7 lines · Nico Schottelius
Quoted 5 lines

git://git.schottelius.org/linux/linux-2.6

if you want the patch (f43ba0be1204e7c26cc700a75bdb688a788fbf2f) via git.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This patch isn't trivial enough to be applicable through trivial tree. Adding Sam to CC.

Thanks. Will take care later this week.

had some time to look at it / some comments?

I thought I already applied a similar fix.
Care to resend.

Thanks,
Sam

#6 lore raw

Sam Ravnborg [Fri, Apr 17, 2009 at 11:58:02PM +0200]:

Quoted 2 lines

I thought I already applied a similar fix.
Care to resend.

- git: git://git.schottelius.org/foreign/linux-2.6 (URL changed!):
f43ba0be1204e7c26cc700a75bdb688a788fbf2fcommit
- Original patch attached (p1)
- Diff against your tree attached (p2)

Nico

Signature · 4 lines
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C

commit f43ba0be1204e7c26cc700a75bdb688a788fbf2f

Author: Nico Schottelius <[email protected]>
Date:   Tue Apr 7 17:27:18 2009 +0200

[PATCH] Fix scripts/setlocalversion with git

When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion.

This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev.

scripts/setlocalversion +6 -7
index f6946cf..296669a 100755
@@ -10,13 +10,12 @@ cd "${1:-.}" || usage
 
 # Check for git and a git repo.
 if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
-	# Do we have an untagged version?
-	if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
-		if tag=`git describe 2>/dev/null`; then
-			echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
-		else
-			printf '%s%s' -g $head
-		fi
+	# Do we have an annotated tag?
+	if atag=`git describe 2>/dev/null`; then
+		echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+	# add -g${head}, if there is no usable tag
+	else
+		printf '%s%s' -g $head
 	fi
 
 	# Is this git on svn?
scripts/setlocalversion +7 -8
@@ -10,18 +10,17 @@
 
 # Check for git and a git repo.
 if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
-	# Do we have an untagged version?
-	if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
-		if tag=`git describe 2>/dev/null`; then
-			echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
-		else
-			printf '%s%s' -g $head
-		fi
+	# Do we have an annotated tag?
+	if atag=`git describe 2>/dev/null`; then
+		echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+	# add -g${head}, if there is no usable tag
+	else
+		printf '%s%s' -g $head
 	fi
 
 	# Is this git on svn?
 	if git config --get svn-remote.svn.url >/dev/null; then
-	        printf -- '-svn%s' "`git svn find-rev $head`"
+	        printf -- '-svn%s' "`git-svn find-rev $head`"
 	fi
 
 	# Are there uncommitted changes?
#7 lore raw
Quoted 10 lines · Nico Schottelius

Sam Ravnborg [Fri, Apr 17, 2009 at 11:58:02PM +0200]:

Quoted 2 lines

I thought I already applied a similar fix.
Care to resend.

- git: git://git.schottelius.org/foreign/linux-2.6 (URL changed!):
f43ba0be1204e7c26cc700a75bdb688a788fbf2fcommit
- Original patch attached (p1)
- Diff against your tree attached (p2)

Nico

Applied p2 - had to do so manually.

Sam

#8 lore raw

Sam Ravnborg [Sat, Apr 25, 2009 at 09:50:19AM +0200]:

Quoted 5 lines · Nico Schottelius
Quoted 2 lines

Sam Ravnborg [Fri, Apr 17, 2009 at 11:58:02PM +0200]:
- Diff against your tree attached (p2)

Applied p2 - had to do so manually.

Thanks! This makes life much easier for testers like me :-)

Enjod the sunny saturday!

Nico

Signature · 4 lines
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C