Patchwork [bitbake-devel,v3,07/15] fetch2/git.py: Use local download dir, when using an external read-only GITDIR

login
register
mail settings
Submitter Jason Wessel
Date June 6, 2012, 8:28 p.m.
Message ID <1339014519-9972-8-git-send-email-jason.wessel@windriver.com>
Download mbox | patch
Permalink /patch/29339/
State New
Headers show

Comments

Jason Wessel - June 6, 2012, 8:28 p.m.
When building the yocto kernel or yocto kernel tools, if the GITDIR is
on a read-only server that is shared and updated by via some cron
jobs, the fetch2 should not try to write to that area.  The end result
will be odd failures if you have download turned off, or extra
needless downloading if you have download turned on.

The fetch2 should prefer to create mirror the mirror clones in the
local "downloads" directory in the work space.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 lib/bb/fetch2/git.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index bcc0da5..59d95cb 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -136,8 +136,11 @@  class Git(FetchMethod):
                 gitsrcname = gitsrcname + '_' + ud.revisions[name]
         ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname)
         ud.fullmirror = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball)
-        ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
+        ud.gitdir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
+        ud.clonedir = os.path.join(data.getVar("DL_DIR", d, True), gitsrcname)
 
+        if os.path.exists(ud.gitdir):
+            ud.clonedir = ud.gitdir
         ud.localfile = ud.clonedir
 
     def localpath(self, url, ud, d):