[poky] [RFC PATCH 10/21] bb.fetch2: add git unpack

Yu Ke ke.yu at intel.com
Mon Jan 24 06:32:54 PST 2011


git download will clone git repo to local, and git unpack just do a clone with referrence to the original repo

Signed-off-by: Yu Ke <ke.yu at intel.com>
---
 bitbake/lib/bb/fetch2/git.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 438756a..ca9d925 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -193,6 +193,22 @@ class Git(Fetch):
         os.chdir(ud.clonedir)
         bb.utils.prunedir(codir)
 
+    def unpack(self, ud, destdir, d):
+        """ unpack the downloaded src to destdir"""
+        subdir = ud.parm.get("subpath", "")
+        if subdir != "":
+            readpathspec = ":%s" % (subdir)
+        else:
+            readpathspec = ""
+
+		if 'fullclone' in ud.parm:
+			runfetchcmd("cp -pPR %s %s" % (os.path.join(ud.clonedir, ".git"), destdir), d)
+		else:
+			os.chdir(ud.clonedir)
+	        runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, readpathspec), d)
+		    runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, os.path.join(destdir,"git/")), d)
+        return True
+
     def supports_srcrev(self):
         return True
 
-- 
1.7.0.4




More information about the poky mailing list