Skip to contentSkip to conversation

buildsteps/CheckOutLayers: use a commit object for git rev-parse

PATCH In review Stefan Stanacar 2 participants 2 messages Oct 10, 2013 – Oct 17, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildsteps/CheckOutLayers: use a commit object for git rev-parse

When the object passed to git rev-parse is a tag, we need to dereference the tag until a commit id is found or the object cannot be dereferenced anymore hence add ^0. (<rev>^0 is a short-hand for <rev>^{commit})

This avoids confusing tarballs like
http://autobuilder.yoctoproject.org/pub/releases/dora-10.0.0/poky-319e24a8b1e100e950b07bbcad5fc81c42396845.tar.bz2
which have the SHA-1 hash of the tag instead of the commit. It was first mentioned here
https://lists.yoctoproject.org/pipermail/yocto/2013-October/018607.html

---
 lib/python2.7/site-packages/autobuilder/buildsteps/CheckOutLayers.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/python2.7/site-packages/autobuilder/buildsteps/CheckOutLayers.py +1 -1
index f7b7d6e..46f9b25 100644
@@ -128,7 +128,7 @@ class CheckOutLayers(Git):
 
     @defer.inlineCallbacks
     def parseGotRevision(self, _=None):
-        stdout = yield self._dovccmd(['rev-parse', self.commit], collectStdout=True)
+        stdout = yield self._dovccmd(['rev-parse', self.commit + "^0"], collectStdout=True)
         revision = stdout.strip()
         if len(revision) != 40:
             raise buildstep.BuildStepFailed()
Signature · 1 line
1.8.3.1
#1 lore raw

Stefan,

I'm pulling this patch, as this is part of our override of parseGotRevision in buildbot/steps/source/git.py, but I'd also suggest that this get suggested to the buildbot project for the original parseGotRevision.

-b

Quoted 31 lines · Stefan Stanacar

When the object passed to git rev-parse is a tag, we need to dereference the tag until a commit id is found or the object cannot be dereferenced anymore hence add ^0. (<rev>^0 is a short-hand for <rev>^{commit})

This avoids confusing tarballs like
http://autobuilder.yoctoproject.org/pub/releases/dora-10.0.0/poky-319e24a8b1e100e950b07bbcad5fc81c42396845.tar.bz2
which have the SHA-1 hash of the tag instead of the commit. It was first mentioned here
https://lists.yoctoproject.org/pipermail/yocto/2013-October/018607.html

---
 lib/python2.7/site-packages/autobuilder/buildsteps/CheckOutLayers.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/python2.7/site-packages/autobuilder/buildsteps/CheckOutLayers.py +1 -2
index f7b7d6e..46f9b25 100644
@@ -128,7 +128,7 @@ class CheckOutLayers(Git):
 
     @defer.inlineCallbacks
     def parseGotRevision(self, _=None):
-        stdout = yield self._dovccmd(['rev-parse', self.commit], collectStdout=True)
+        stdout = yield self._dovccmd(['rev-parse', self.commit + "^0"], collectStdout=True)
         revision = stdout.strip()
         if len(revision) != 40:
             raise buildstep.BuildStepFailed()
--

1.8.3.1

Signature · 3 lines
Elizabeth Flanagan
Yocto Project
Build and Release