* fetch2/git: create bareclone option
@ 2012-02-23 21:08 Bruce Ashfield
2012-02-23 21:08 ` [PATCH] " Bruce Ashfield
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Ashfield @ 2012-02-23 21:08 UTC (permalink / raw)
To: bitbake-devel, richard.purdie
Hi all,
The web interface to the bitbake devel list seems to be down, so
I couldn't do my customary research into who/where to send a patch.
I'm sending this off anyway to see if there are any comments
that I need to address.
I worked on this via oe-core/yocto, but I've also tested it on my
local bitbake clone.
The patch header pretty much says it all. I've got some follow up
patches to my kernel work in yocto, but this part is standalone
and should be safe everywhere.
Cheers,
Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] fetch2/git: create bareclone option
2012-02-23 21:08 fetch2/git: create bareclone option Bruce Ashfield
@ 2012-02-23 21:08 ` Bruce Ashfield
2012-02-24 16:40 ` Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Ashfield @ 2012-02-23 21:08 UTC (permalink / raw)
To: bitbake-devel, richard.purdie
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.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
lib/bb/fetch2/git.py | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index fb0260a..4e46ec8 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -38,6 +38,12 @@ Supported SRC_URI options are:
who has its own routine to checkout code.
The default is "0", set nocheckout=1 if needed.
+- bareclone
+ Create a bare clone of the source code and don't checkout the source code
+ when unpacking. Set this option for the recipe who has its own routine to
+ checkout code and tracking branch requirements.
+ The default is "0", set bareclone=1 if needed.
+
"""
#Copyright (C) 2005 Richard Purdie
@@ -95,6 +101,11 @@ class Git(FetchMethod):
ud.rebaseable = ud.parm.get("rebaseable","0") == "1"
+ # bareclone implies nocheckout
+ ud.bareclone = ud.parm.get("bareclone","0") == "1"
+ if ud.bareclone:
+ ud.nocheckout = 1
+
branches = ud.parm.get("branch", "master").split(',')
if len(branches) != len(ud.names):
raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
@@ -220,7 +231,11 @@ class Git(FetchMethod):
if os.path.exists(destdir):
bb.utils.prunedir(destdir)
- runfetchcmd("git clone -s -n %s/ %s" % (ud.clonedir, destdir), d)
+ cloneflags = "-s -n"
+ if ud.bareclone:
+ cloneflags += " --mirror"
+
+ runfetchcmd("git clone %s %s/ %s" % (cloneflags, ud.clonedir, destdir), d)
if not ud.nocheckout:
os.chdir(destdir)
if subdir != "":
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fetch2/git: create bareclone option
2012-02-23 21:08 ` [PATCH] " Bruce Ashfield
@ 2012-02-24 16:40 ` Richard Purdie
0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2012-02-24 16:40 UTC (permalink / raw)
To: Bruce Ashfield; +Cc: bitbake-devel
On Thu, 2012-02-23 at 16:08 -0500, Bruce Ashfield wrote:
> 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.
>
> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
> ---
> lib/bb/fetch2/git.py | 17 ++++++++++++++++-
> 1 files changed, 16 insertions(+), 1 deletions(-)
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-24 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23 21:08 fetch2/git: create bareclone option Bruce Ashfield
2012-02-23 21:08 ` [PATCH] " Bruce Ashfield
2012-02-24 16:40 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.