Author: ayoung
Date: Tue Mar 20 02:21:22 2012
New Revision: 9664
URL: http://svn.slimdevices.com/jive?rev=9664&view=rev
Log:
Enhance git support for subdirs and modules
Take some ideas from fetch2 (later release of poky) to enable migration of
some slim repos from Subversion to git.
1. Add support for 'module' parameter. Causes subpath of repo to be checked out
and result to be placed in base path of module path (instead of default 'git).
2. Add support for 'repopath' parameter. Effectivly prepended to module path
if present.
Doing these changes this way enables us to change only the base SCN specs (such
as SQUEZEOS_SVN or SQUEEZEPLAY_SCN) rather than having to make other changes
to every recipe based on these changes.
3. Add locking around manipulation of repo to protect against concurrent access
that is possible with the repopath and module parameters.
Modified:
7.8/trunk/squeezeos/poky/bitbake/lib/bb/fetch/git.py
Modified: 7.8/trunk/squeezeos/poky/bitbake/lib/bb/fetch/git.py
URL:
http://svn.slimdevices.com/jive/7.8/trunk/squeezeos/poky/bitbake/lib/bb/fetch/git.py?rev=9664&r1=9663&r2=9664&view=diff
==============================================================================
--- 7.8/trunk/squeezeos/poky/bitbake/lib/bb/fetch/git.py (original)
+++ 7.8/trunk/squeezeos/poky/bitbake/lib/bb/fetch/git.py Tue Mar 20 02:21:22
2012
@@ -53,9 +53,27 @@
ud.tag = tag
if not ud.tag or ud.tag == "master":
- ud.tag = self.latest_revision(url, ud, d)
-
- ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host,
ud.path.replace('/', '.'), ud.tag), d)
+ ud.tag = self.latest_revision(url, ud, d)
+
+ if 'repopath' in ud.parm:
+ ud.subdir = "%s" % (ud.parm['repopath'])
+ else:
+ ud.subdir = ""
+
+ if 'module' in ud.parm:
+ if ud.subdir != "":
+ ud.subdir = os.path.join(ud.subdir, ud.parm['module'])
+ else:
+ ud.subdir = ud.parm['module']
+ else:
+ ud.subdir = ""
+
+ if ud.subdir != "":
+ tagDir = "%s_%s" % (ud.subdir, ud.tag)
+ else:
+ tagDir = ud.tag
+
+ ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host,
ud.path.replace('/', '.'), tagDir.replace('/', '.')), d)
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
@@ -79,6 +97,9 @@
coname = '%s' % (ud.tag)
codir = os.path.join(repodir, coname)
+
+ """ A single repodir can be used for multiple checkouts. Protect
against corruption. """
+ lf = bb.utils.lockfile("%s.%s" % (repofile, '.lock'))
if not os.path.exists(repodir):
if Fetch.try_mirror(d, repofilename):
@@ -106,10 +127,19 @@
if os.path.exists(codir):
bb.utils.prunedir(codir)
+ if ud.subdir != "":
+ readpathspec = ":%s" % (ud.subdir)
+ subdir = os.path.basename(ud.subdir)
+ else:
+ readpathspec = ""
+ subdir = "git"
+
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("git read-tree %s%s" % (ud.tag, readpathspec), d)
+ runfetchcmd("git checkout-index -q -f --prefix=%s -a" %
(os.path.join(codir, subdir, "")), d)
+
+ bb.utils.unlockfile(lf)
os.chdir(codir)
bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git
checkout")
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins