[yocto] [AB PATCH 02/22] yoctogit.py: Fix cp construction from source to build

Elizabeth Flanagan elizabeth.flanagan at intel.com
Wed Mar 19 13:51:00 PDT 2014


This commit removes the mkdir from movecopy as it is not needed.
It also changes the workdir in barecopy and movecopy to
the source dir, as we can't alwas be sure that the destination
dir even exists.

This also ensures that we are in fact constructing our cp string
correctly, by striping any trailing "/" from self.repourl

As repourl is used to construct the cp from source to build, that
trailing slash, if it exists, causes the directory structure to
not be correct (e.g. cp -R ./foo/ ./bar and cp -R ./foo ./bar
don't do the same thing, obviously)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan at intel.com>
---
 .../buildbot/steps/source/yoctogit.py              | 35 +++++++---------------
 1 file changed, 11 insertions(+), 24 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 26599e7..487e286 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
@@ -121,7 +121,7 @@ class YoctoGit(Source):
         self.branch    = branch
         self.method    = method
         self.prog  = progress
-        self.repourl   = repourl
+        self.repourl   = repourl.rstrip('/')
         self.retryFetch = retryFetch
         self.submodules = submodules
         self.shallow   = shallow
@@ -255,13 +255,11 @@ class YoctoGit(Source):
         if "poky" in self.layername or \
            "oecore" in self.layername or \
            "eclipse" in self.layername:
-            todir = "."
-            self.workdir = "build"
+            todir = "build"
+            self.workdir = 'source/'+self.repourl
         else:
-            todir = "./" + self.layername
-            self.workdir = "build/" + self.layername
-
-
+            todir = "build/" + self.layername
+            self.workdir = 'source/'+self.repourl
         d.addCallback(lambda _: self.incremental())
         def copy(_):
             cmd = buildstep.RemoteCommand('cpdir',
@@ -278,7 +276,7 @@ class YoctoGit(Source):
             d.addCallback(lambda _: evaluateCommand(cmd))
             return d
         d.addCallback(copy)
-        
+       
         def resetWorkdir(_):
             if "poky" in self.layername or \
                "oecore" in self.layername or \
@@ -316,26 +314,15 @@ class YoctoGit(Source):
                 log.msg("Source step failed while running command %s" % cmd)
                 raise buildstep.BuildStepFailed()
         d.addCallback(lambda _: evaluateCommand(cmd))
-
-        if self.layername == "poky" or self.layername == "oecore":
+        if "poky" in self.layername or \
+           "oecore" in self.layername or \
+           "eclipse" in self.layername:
             todir = "build"
+            self.workdir = 'source/'+self.repourl.rstrip('/')
         else:
             todir = "build/" + self.layername
+            self.workdir = 'source/'+self.repourl
 
-        def mkdir(_):
-            cmd = buildstep.RemoteCommand('mkdir', {'dir': 'build',
-                                                    'logEnviron': self.logEnviron,
-                                                    'timeout': self.timeout,})
-            cmd.useLog(self.stdio_log, False)
-            d = self.runCommand(cmd)
-            def evaluateCommand(cmd):
-                if cmd.didFail():
-                    log.msg("Source step failed while running command %s" % cmd)
-                    raise buildstep.BuildStepFailed()
-            d.addCallback(lambda _: evaluateCommand(cmd))
-            return d
-        d.addCallback(mkdir)
-        d.addCallback(lambda _: self.incremental())
         def copy(_):
             cmd = buildstep.RemoteCommand('cpdir',
                                           {'fromdir': srcdir,
-- 
1.8.1.2




More information about the yocto mailing list