Hi,
The attached patch adds support for FETCHCMD_git indirection via
bitbake.conf to the git fetcher (like that is all ready supported for SVN.
CVS, etc).
I have been using this patch for months at work to get through a proxy by
using socksify [1].
John
[1] FETCHCMD_git = "socksify git" instead of the usual FETCHCMD_git =
"/usr/bin/env git"
Index: lib/bb/fetch/git.py
===================================================================
--- lib/bb/fetch/git.py (revision 1118)
+++ lib/bb/fetch/git.py (working copy)
@@ -61,6 +61,7 @@
def go(self, loc, ud, d):
"""Fetch url"""
+ git = data.expand('${FETCHCMD_git}', d)
if os.access(os.path.join(data.getVar("DL_DIR", d, True), ud.localfile), os.R_OK):
bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists (or was stashed). Skipping git checkout." % ud.localpath)
@@ -87,10 +88,10 @@
# Remove all but the .git directory
if not self._contains_ref(ud.tag, d):
runfetchcmd("rm * -Rf", d)
- runfetchcmd("git fetch %s://%s%s %s" % (ud.proto, ud.host, ud.path, ud.branch), d)
- runfetchcmd("git fetch --tags %s://%s%s" % (ud.proto, ud.host, ud.path), d)
- runfetchcmd("git prune-packed", d)
- runfetchcmd("git pack-redundant --all | xargs -r rm", d)
+ runfetchcmd("%s fetch %s://%s%s %s" % (git, ud.proto, ud.host, ud.path, ud.branch), d)
+ runfetchcmd("%s fetch --tags %s://%s%s" % (git, ud.proto, ud.host, ud.path), d)
+ runfetchcmd("%s prune-packed" % git, d)
+ runfetchcmd("%s pack-redundant --all | xargs -r rm" % git, d)
os.chdir(repodir)
mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
@@ -103,8 +104,8 @@
bb.mkdirhier(codir)
os.chdir(repodir)
- runfetchcmd("git read-tree %s" % (ud.tag), d)
- runfetchcmd("git checkout-index -q -f --prefix=%s -a" % (os.path.join(codir, "git", "")), d)
+ runfetchcmd("%s read-tree %s" % (git, ud.tag), d)
+ runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (git, os.path.join(codir, "git", "")), d)
os.chdir(codir)
bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git checkout")
@@ -117,7 +118,8 @@
return True
def _contains_ref(self, tag, d):
- output = runfetchcmd("git log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % tag, d, quiet=True)
+ git = data.expand('${FETCHCMD_git}', d)
+ output = runfetchcmd("%s log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % (git, tag), d, quiet=True)
return output.split()[0] != "0"
def _revision_key(self, url, ud, d):
@@ -130,7 +132,8 @@
"""
Compute the HEAD revision for the url
"""
- output = runfetchcmd("git ls-remote %s://%s%s %s" % (ud.proto, ud.host, ud.path, ud.branch), d, True)
+ git = data.expand('${FETCHCMD_git}', d)
+ output = runfetchcmd("%s ls-remote %s://%s%s %s" % (git, ud.proto, ud.host, ud.path, ud.branch), d, True)
return output.split()[0]
def _build_revision(self, url, ud, d):
@@ -145,6 +148,7 @@
We will have to get the updated revision.
"""
+ git = data.expand('${FETCHCMD_git}', d)
gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
@@ -169,7 +173,7 @@
if not self._contains_ref(ud.tag, d):
self.go(None, ud, d)
- output = runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % ud.tag, d, quiet=True)
+ output = runfetchcmd("%s rev-list %s -- 2> /dev/null | wc -l" % (git, ud.tag), d, quiet=True)
os.chdir(cwd)
sortable_revision = "%s+%s" % (output.split()[0], ud.tag)
_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev