summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2011-01-19 00:22:13 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-02 17:05:48 +0000
commit3a3fc6b071f09970e7f79fb4f1a8f0013917371e (patch)
treeddb61d528463955a157afbf1e0471bf941536251 /bitbake
parentd1ed18812394ffea9d90fc48f2d806df78a9e3e0 (diff)
downloadpoky-3a3fc6b071f09970e7f79fb4f1a8f0013917371e.tar.gz
bb.fetch2: Add git unpack
The git download method clones the git repository to the local machine. The unpack process can be optimised to be a local to local machine clone or a direct readtree operation to the destination using git.will clone git repo to local, so git unpack can be simplified to only checkouting the code to the work dir. For fullclone case, we also need to manually copy all the ref info, which is needed by the later do_kernel_checkout(). Rather than use hardlinks, we reference the repository using alternatives since the download directory may be on a different filesystem. [Change to use -s by Richard Purdie] Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/git.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 08daa20313..0a1818f825 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -194,6 +194,31 @@ class Git(Fetch):
194 os.chdir(ud.clonedir) 194 os.chdir(ud.clonedir)
195 bb.utils.prunedir(codir) 195 bb.utils.prunedir(codir)
196 196
197 def unpack(self, ud, destdir, d):
198 """ unpack the downloaded src to destdir"""
199
200 subdir = ud.parm.get("subpath", "")
201 if subdir != "":
202 readpathspec = ":%s" % (subdir)
203 else:
204 readpathspec = ""
205
206 destdir = os.path.join(destdir, "git/")
207 if os.path.exists(destdir):
208 bb.utils.prunedir(destdir)
209
210 if 'fullclone' in ud.parm:
211 runfetchcmd("git clone -s -n %s %s" % (ud.clonedir, destdir), d)
212 if os.path.exists("%s/.git/refs/remotes/origin" % ud.clonedir):
213 runfetchcmd("cp -af %s/.git/refs/remotes/origin/* %s/.git/refs/remotes/origin/" %(ud.clonedir, destdir), d)
214 if os.path.exists("%s/.git/packed-refs" % ud.clonedir):
215 runfetchcmd("cp -af %s/.git/packed-refs %s/.git/" %(ud.clonedir, destdir), d)
216 else:
217 os.chdir(ud.clonedir)
218 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, readpathspec), d)
219 runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, destdir), d)
220 return True
221
197 def supports_srcrev(self): 222 def supports_srcrev(self):
198 return True 223 return True
199 224