summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2012-02-23 16:08:42 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-24 16:40:08 +0000
commit408fd37529a1f1c6e21a9ee1969d4b625188f7fd (patch)
treed865f3e16069e9cf1608c0f2d316aeef6206c545 /bitbake
parent72ce5c4cde612515451226a1b10f5b348a4a6a4c (diff)
downloadpoky-408fd37529a1f1c6e21a9ee1969d4b625188f7fd.tar.gz
fetch2/git: create bareclone option
For similar reasons as the nocheckout option, packages that need enhanced control over the checkout and branch creation on a repository may want a complete mirror/bareclone created of the repository when performing the unpack. This is useful/required when a local respository is being used, but local tracking branches have not been created for all branches that a given recipe needs to manipulate. The standard git clone operations will create remote branches for the branches that are local to the source repository, but branches that are remote do not translate to the destination repository. Doing a mirror/bare clone of the source, makes all branches available to the repository. This is a particular use case, but the ability to do a bare clone creates great flexibility in recipe space, with no impact to recipes that don't need this functionality. To implement this, a new option 'bareclone' is craeted which creates a mirror copy of the repository and leaves it bare in the unpacking phase. A recipe that uses this option must both checkout and debare the repository itself. (Bitbake rev: 82482aae6f311c994275fb0b6b32d954bbfc78c3) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/git.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index fb0260a42a..4e46ec8f30 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -38,6 +38,12 @@ Supported SRC_URI options are:
38 who has its own routine to checkout code. 38 who has its own routine to checkout code.
39 The default is "0", set nocheckout=1 if needed. 39 The default is "0", set nocheckout=1 if needed.
40 40
41- bareclone
42 Create a bare clone of the source code and don't checkout the source code
43 when unpacking. Set this option for the recipe who has its own routine to
44 checkout code and tracking branch requirements.
45 The default is "0", set bareclone=1 if needed.
46
41""" 47"""
42 48
43#Copyright (C) 2005 Richard Purdie 49#Copyright (C) 2005 Richard Purdie
@@ -95,6 +101,11 @@ class Git(FetchMethod):
95 101
96 ud.rebaseable = ud.parm.get("rebaseable","0") == "1" 102 ud.rebaseable = ud.parm.get("rebaseable","0") == "1"
97 103
104 # bareclone implies nocheckout
105 ud.bareclone = ud.parm.get("bareclone","0") == "1"
106 if ud.bareclone:
107 ud.nocheckout = 1
108
98 branches = ud.parm.get("branch", "master").split(',') 109 branches = ud.parm.get("branch", "master").split(',')
99 if len(branches) != len(ud.names): 110 if len(branches) != len(ud.names):
100 raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url) 111 raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
@@ -220,7 +231,11 @@ class Git(FetchMethod):
220 if os.path.exists(destdir): 231 if os.path.exists(destdir):
221 bb.utils.prunedir(destdir) 232 bb.utils.prunedir(destdir)
222 233
223 runfetchcmd("git clone -s -n %s/ %s" % (ud.clonedir, destdir), d) 234 cloneflags = "-s -n"
235 if ud.bareclone:
236 cloneflags += " --mirror"
237
238 runfetchcmd("git clone %s %s/ %s" % (cloneflags, ud.clonedir, destdir), d)
224 if not ud.nocheckout: 239 if not ud.nocheckout:
225 os.chdir(destdir) 240 os.chdir(destdir)
226 if subdir != "": 241 if subdir != "":