Skip to contentSkip to conversation

bitbake/fetch: Add git submodules fetcher

PATCH New Richard Purdie 1 participant 1 message Mar 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake/fetch: Add git submodules fetcher

This adds very basic git submodule support to the fetcher. It can be used by replacing a git:// url prefix with a gitsm:// prefix, otherwise behaviour is the same as the git fetcher. Whilst this code should be functional, its not as efficient as the usual git fetcher due to the need to checkout the tree to fetch/update the submodule information. git doesn't support submodule operations on the bare clones the standard git fetcher uses which is also problematic.

This code does however give a starting point to people wanting to use submodules.

---

bitbake/lib/bb/fetch2/__init__.py +2 -0
index 4cfe089..1bf67dd 100644
@@ -1497,6 +1497,7 @@ class Fetch(object):
 
 from . import cvs
 from . import git
+from . import gitsm
 from . import local
 from . import svn
 from . import wget
@@ -1513,6 +1514,7 @@ methods.append(local.Local())
 methods.append(wget.Wget())
 methods.append(svn.Svn())
 methods.append(git.Git())
+methods.append(gitsm.GitSM())
 methods.append(cvs.Cvs())
 methods.append(svk.Svk())
 methods.append(ssh.SSH())
bitbake/lib/bb/fetch2/git.py +1 -1
index 63ff00b..052802e 100644
@@ -234,7 +234,7 @@ class Git(FetchMethod):
             def_destsuffix = "git/"
 
         destsuffix = ud.parm.get("destsuffix", def_destsuffix)
-        destdir = os.path.join(destdir, destsuffix)
+        destdir = ud.destdir = os.path.join(destdir, destsuffix)
         if os.path.exists(destdir):
             bb.utils.prunedir(destdir)
 
bitbake/lib/bb/fetch2/gitsm.py new file +78 -0

78 lines not on this page · raw message