Skip to contentSkip to conversation

newbie question about patch to fix 'fatal: cannot describe'

U-Boot Rainer Keller 2 participants 2 messages Jun 15, 2009 – Jun 16, 2009

lore
Share & tools
lore
#0 lore raw

Hi All,

This is my first posting to the list and I just joined the mailing list about a week ago. Plus I am pretty new to the open source world as well, so please send me pointers to where to look things up if the posting is not inappropriate or does not belong here.

Any time I build U-Boot from my git checkout I receive the 'fatal:
cannot describe' message. Googling quickly got me to the solution: A fix for similar behaviour in the kernel was fixed a while ago, basically it is a problem in setlocalversion. So I took the two relevant patches (instead of the full file because it looks like u-boot has it's own version of that file) and applied them to my repository.

This is my patch:

commit ec6609f492e41594715c4764ae7c0994e9e70270

Author: Rainer Keller <[email protected]>
Date:   Mon Jun 15 12:55:50 2009 -0700
    combined two kernel patches to fix git describe errors in tools/setlocalversion: Commit f03b283f081f538ec71b9e87cb8411bb62e2abc9 and Commit 56b2f0706d82535fd8d85503f2dcc0be40c8e55d
tools/setlocalversion +6 -2
index b3f5f28..aca9d63 100755
@@ -9,11 +9,15 @@ usage() {
 cd "${1:-.}" || usage
 
 # Check for git and a git repo.
-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+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
-	        git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+		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
 	fi
 
 	# Are there uncommitted changes?

So here are my questions:

Obviously that is not my code, do I still add my `Signed-off-by'?

Should I add the comments from the original commits to the kernel or it is ok to just refer to the commits?

I don't have a publicly accessible git repository to ask a custodian to pull from and from checking the custodian list it looks like this is Wolfgang's area. Is it ok to just post it as is and expect him to apply it out of the email?

If these seem to be slighly overly careful questions please consider that over time Ubicom would like to add a complete additional architecture with dozens of boards and we'll have a lot more newbie questions, so I want to start as polite as I can :)

Best Regards,
Rainer Keller

#1 lore raw

Hi Rainer,

Quoted 2 lines

This is my first posting to the list and I just joined the mailing list about a week ago.

Welcome aboard!

Quoted 3 lines

Plus I am pretty new to the open source world as well, so please send me pointers to where to look things up if the posting is not inappropriate or does not belong here.

Judging by the questions you ask I presume you have found the relevant places, but still the most important one here:

http://www.denx.de/wiki/U-Boot/Patches

Quoted 38 lines

Any time I build U-Boot from my git checkout I receive the 'fatal:
cannot describe' message. Googling quickly got me to the solution: A fix for similar behaviour in the kernel was fixed a while ago, basically it is a problem in setlocalversion. So I took the two relevant patches (instead of the full file because it looks like u-boot has it's own version of that file) and applied them to my repository.

This is my patch:

commit ec6609f492e41594715c4764ae7c0994e9e70270

Author: Rainer Keller <[email protected]>
Date:   Mon Jun 15 12:55:50 2009 -0700
    combined two kernel patches to fix git describe errors in tools/setlocalversion: Commit f03b283f081f538ec71b9e87cb8411bb62e2abc9 and Commit 56b2f0706d82535fd8d85503f2dcc0be40c8e55d
tools/setlocalversion +6 -2
index b3f5f28..aca9d63 100755
@@ -9,11 +9,15 @@ usage() {
 cd "${1:-.}" || usage
 
 # Check for git and a git repo.
-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+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
-	        git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+		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
 	fi
 
 	# Are there uncommitted changes?
Quoted 3 lines

So here are my questions:

Obviously that is not my code, do I still add my `Signed-off-by'?

Yep - as you introduce the code, you certify the "Developer's Certificate of Origin" (-> Documentation/SubmittingPatches in a Linux tree).

Quoted 2 lines

Should I add the comments from the original commits to the kernel or it is ok to just refer to the commits?

I'm pretty lazy so it is more work for me to look up the comments in the other repo. So please include the comments in the log here directly.

Quoted 4 lines

I don't have a publicly accessible git repository to ask a custodian to pull from and from checking the custodian list it looks like this is Wolfgang's area. Is it ok to just post it as is and expect him to apply it out of the email?

Entirely correct.

Quoted 4 lines

If these seem to be slighly overly careful questions please consider that over time Ubicom would like to add a complete additional architecture with dozens of boards and we'll have a lot more newbie questions, so I want to start as polite as I can :)

Hey, you're welcome, looking forward to those patches. So it looks like actually you need to prepare yourself for a custodian job soon :)

Cheers
Detlev

Signature · 8 lines
Q: Does that mean we also shouldn't be using IRQF_SAMPLE_RANDOM on
   interrupt [sources]?
A: Yes. The flag needs to be taken out and shot.
                            -- Matt Mackall <1239116251.14392.133.camel@calx>
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de