[yocto] [AB PATCH 07/22] yoctogit.py: pathExists returns a defered value.
Elizabeth Flanagan
elizabeth.flanagan at intel.com
Wed Mar 19 13:51:05 PDT 2014
We can't use pathExists this way to figure out if the path actually
exists as it will always evalutate to true as it returns a generator
object and not T/F.
In order to actually figure out if the mirrordir + repourl exists,
we need to call a function that returns the deferred generator
object outside of any of fetch/movecopy/barecopy functions (which
also return defereds and you can't yield a defered in a defered)
So, yield the generator object at the beginning, and save everyone
the headache.
Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan at intel.com>
---
.../buildbot/steps/source/yoctogit.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/source/yoctogit.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/source/yoctogit.py
index 080f5b2..4c89ceb 100644
--- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/source/yoctogit.py
+++ b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/source/yoctogit.py
@@ -177,6 +177,7 @@ class YoctoGit(Source):
@defer.inlineCallbacks
def full(self):
updatable = yield self._sourcedirIsUpdatable()
+ self.mirrorexists = yield self._mirrorExists()
if self.method == 'clobber':
yield self.clobber()
@@ -248,9 +249,9 @@ class YoctoGit(Source):
d.addCallback(lambda _: evaluateCommand(cmd))
if self.mirrordir:
mirror = self.mirrordir + "/" + self.repourl.replace("git://", "") + "/"
- if self.pathExists(mirror):
+ if self.mirrorexists:
srcdir=mirror
- else:
+ else:
srcdir='source/'+self.repourl
if "poky" in self.layername or \
"oecore" in self.layername or \
@@ -493,8 +494,10 @@ class YoctoGit(Source):
mirror = None
if self.mirrordir:
mirror = self.mirrordir + "/" + self.repourl.replace("git://", "") + "/"
- if self.pathExists(mirror):
- command = ['clone'] + ["-s", "-n"] + [mirror, '.']
+ if self.mirrorexists:
+ command = ['clone'] + ["-s", "-n"] + [mirror, '.']
+ else:
+ command = ['clone'] + ["-s", "-n"] + [self.repourl, '.']
#Fix references
if self.prog:
@@ -560,6 +563,10 @@ class YoctoGit(Source):
def _sourcedirIsUpdatable(self):
return self.pathExists(self.build.path_module.join(self.workdir, '.git'))
+ def _mirrorExists(self):
+ mirror = self.mirrordir + "/" + self.repourl.replace("git://", "") + "/"
+ return self.pathExists(self.build.path_module.join(mirror, '.git'))
+
def _updateSubmodule(self, _):
if self.submodules:
return self._dovccmd(['submodule', 'update', '--recursive'])
--
1.8.1.2
More information about the yocto
mailing list