<div dir="ltr">Thanks for noticing it. <div>I double checked the comments. I believe all of them are processed in v3.<div><div><br></div><div>Z</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 4 November 2015 at 12:44, Peter Kjellerstedt <span dir="ltr"><<a href="mailto:peter.kjellerstedt@axis.com" target="_blank">peter.kjellerstedt@axis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#943634">You seem to have missed a couple of comments.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#943634"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#943634">//Peter<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#943634"><u></u> <u></u></span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Zoltan Kuscsik [mailto:<a href="mailto:zoltan.kuscsik@linaro.org" target="_blank">zoltan.kuscsik@linaro.org</a>] <br><b>Sent:</b> den 4 november 2015 05:08<br><b>To:</b> Peter Kjellerstedt<br><b>Cc:</b> <a href="mailto:bitbake-devel@lists.openembedded.org" target="_blank">bitbake-devel@lists.openembedded.org</a><br><b>Subject:</b> Re: [bitbake-devel] [PATCH] bb.fetch2: added support for gclient<u></u><u></u></span></p></div></div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">Thanks Peter, all comments addressed in PATCHv2. <u></u><u></u></p></div><div><p class="MsoNormal">I also created a test for the patch:<u></u><u></u></p><div><div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><a href="https://github.com/kuscsik/meta-testing/tree/master/recipes-core/fetcher" target="_blank">https://github.com/kuscsik/meta-testing/tree/master/recipes-core/fetcher</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div><div><p class="MsoNormal">Br,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Z<u></u><u></u></p></div></div></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On 4 November 2015 at 01:36, Peter Kjellerstedt <<a href="mailto:peter.kjellerstedt@axis.com" target="_blank">peter.kjellerstedt@axis.com</a>> wrote:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><p class="MsoNormal">> -----Original Message-----<br>> From: <a href="mailto:bitbake-devel-bounces@lists.openembedded.org" target="_blank">bitbake-devel-bounces@lists.openembedded.org</a> [mailto:<a href="mailto:bitbake-" target="_blank">bitbake-</a><br>> <a href="mailto:devel-bounces@lists.openembedded.org" target="_blank">devel-bounces@lists.openembedded.org</a>] On Behalf Of Zoltan Kuscsik<br>> Sent: den 3 november 2015 17:11<br>> To: <a href="mailto:bitbake-devel@lists.openembedded.org" target="_blank">bitbake-devel@lists.openembedded.org</a><br>> Subject: [bitbake-devel] [PATCH] bb.fetch2: added support for gclient<br>><br>> Gclient is tool for updating source code from<br>> multiple SCM repository locations.<br>><br>> Signed-off-by: Zoltan Kuscsik <<a href="mailto:zoltan.kuscsik@linaro.org" target="_blank">zoltan.kuscsik@linaro.org</a>><br>> ---<br>> lib/bb/fetch2/__init__.py | 3 +-<br>> lib/bb/fetch2/gclient.py | 151<br>> ++++++++++++++++++++++++++++++++++++++++++++++<br>> 2 files changed, 153 insertions(+), 1 deletion(-)<br>> create mode 100644 lib/bb/fetch2/gclient.py<br>><br>> diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py<br>> index 288a1c8..5ca3bc7 100644<br>> --- a/lib/bb/fetch2/__init__.py<br>> +++ b/lib/bb/fetch2/__init__.py<br>> @@ -1529,7 +1529,6 @@ class Fetch(object):<br>> fn = d.getVar('FILE', True)<br>> if cache and fn and fn in urldata_cache:<br>> self.ud = urldata_cache[fn]<br>> -<br><br>Restore the empty line.<u></u><u></u></p><div><div><p class="MsoNormal"><br>> for url in urls:<br>> if url not in self.ud:<br>> try:<br>> @@ -1775,6 +1774,7 @@ from . import hg<br>> from . import osc<br>> from . import repo<br>> from . import clearcase<br>> +from . import gclient<br>><br>> methods.append(local.Local())<br>> methods.append(wget.Wget())<br>> @@ -1791,3 +1791,4 @@ methods.append(hg.Hg())<br>> methods.append(osc.Osc())<br>> methods.append(repo.Repo())<br>> methods.append(clearcase.ClearCase())<br>> +methods.append(gclient.Gclient())<br>> diff --git a/lib/bb/fetch2/gclient.py b/lib/bb/fetch2/gclient.py<br>> new file mode 100644<br>> index 0000000..de06eb5<br>> --- /dev/null<br>> +++ b/lib/bb/fetch2/gclient.py<br>> @@ -0,0 +1,151 @@<br>> +# ex:ts=4:sw=4:sts=4:et<br>> +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-<br>> +"""<br>> +BitBake "Fetch" gclient implementation<br>> +<br>> +gclient fetcher support the SRCU_URI in the following format:<u></u><u></u></p></div></div><p class="MsoNormal"> ^^^^^^^^<br>Correct the spelling of SRC_URI.<br><br>> +<br>> + SRC_URI = "gclient://some.host/path/;optionA=xxx,optionB=xy"<br>> +<br>> +Supported SRC_UIR options are:<br> ^^^^^^^<br>Correct the spelling of SRC_URI.<br><br>> +<br>> +- branch<br>> + The git branch of the root gclient project. The default is<br>> + "master".<br>> +<br>> +- tag<br>> + Git tag for gclient to retrieve.<br>> +<br>> +- protocol<br>> + The method to use for accessing the gclient core project. The default<br>> + is https.<br>> +<br>> +- project-name<br>> + Passing the --name command line argument to gclient. Not default is empty.<br><br>Change "Passing" to "Pass" and "Not" to "The".<u></u><u></u></p><div><div><p class="MsoNormal"><br>> +<br>> +- rev<br>> + Specify git commit id for gclient. Default is empty.<br>> +<br>> +- deps-file<br>> + Set the --deps-file command line argument for gclient.<br>> +<br>> +"""<br>> +<br>> +# Copyright (C) 2015 Zoltan Kuscsik <<a href="mailto:zoltan.kuscsik@linaro.org" target="_blank">zoltan.kuscsik@linaro.org</a>><br>> +#<br>> +# Based on git.py which is:<br>> +# Copyright (C) 2005 Richard Purdie<br>> +#<br>> +# This program is free software; you can redistribute it and/or modify<br>> +# it under the terms of the GNU General Public License version 2 as<br>> +# published by the Free Software Foundation.<br>> +#<br>> +# This program is distributed in the hope that it will be useful,<br>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>> +# GNU General Public License for more details.<br>> +#<br>> +# You should have received a copy of the GNU General Public License along<br>> +# with this program; if not, write to the Free Software Foundation, Inc.,<br>> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.<br>> +<br>> +import os<br>> +import bb<br>> +from bb import data<br>> +from bb.fetch2 import FetchMethod<br>> +from bb.fetch2 import runfetchcmd<br>> +import string<br>> +<br>> +class Gclient(FetchMethod):<br>> + """Class to fetch a module or modules using gclient"""<br>> +<br>> + def __fetch_url(self, ud):<br>> + return "%s://%s%s" % (ud.proto, ud.host, ud.path)<br>> +<br>> + def supports(self, ud, d):<br>> + """<br>> + Check to see if a given url can be fetched with repo.<u></u><u></u></p></div></div><p class="MsoNormal"> ^^^^<br>Repo? I thought this was for gclient...<br><br>> + """<br>> + return ud.type in ["gclient"]<br>> +<br>> + def urldata_init(self, ud, d):<br>> + """<br>> + Init gclient<br>> + """<br>> + ud.proto = ud.parm.get('protocol', 'https')<br>> +<br>> + ud.branch = ud.parm.get('branch', 'master')<br>> + ud.tag = ud.parm.get('tag','')<br>> + ud.rev = ud.parm.get('rev','')<br>> +<br>> + ud.deps_file = ud.parm.get('deps-file', '')<br>> + ud.project_name = ud.parm.get('project-name', '')<br>> +<br>> + if( ( ('tag' in ud.parm) + ('branch' in ud.parm) + ('res' in ud.parm)) > 1):<br><br>Rewrite as:<br><br> if ('tag' in ud.parm) + ('branch' in ud.parm) + ('res' in ud.parm) > 1:<br><br>> + raise bb.fetch2.ParameterError("Confliting revision setting SRC_URI. Setting only one of the options: 'branch', 'tag', 'res'.", ud.url)<br> ^^^^^^^^^^<br>Correct the spelling of "Conflicting". Change "revision setting SRC_URI"<br>to "revisions specified in SRC_URI" and "Setting only" to "Specify only".<br><br>> +<br>> + dldir = d.getVar("DL_DIR", True)<br>> +<br>> + gclient_src_name = 'gclient_%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.'))<br>> +<br>> + ud.syncdir = os.path.join(dldir, gclient_src_name)<br>> + ud.localfile = ud.syncdir<br>> +<br>> + if ud.tag:<br>> + ud.revision = "refs/tags/%s" % ud.tag<br> ^<br>Remove unnecessary space.<br><br>> + elif ud.rev:<br>> + ud.revision = ud.rev<br>> + else:<br>> + ud.revision = "refs/heads/%s" % ud.branch<br>> +<br>> + def download(self, ud, d):<br>> + """Fetch url"""<br>> +<br>> + if not os.path.exists(ud.localpath):<br>> + bb.utils.mkdirhier(ud.localpath)<br>> + os.chdir(ud.localpath)<br>> + gclient_url = self.__fetch_url(ud)<br>> +<br>> +<br>> + # Add optional parameters<br>> + extra_params=[]<br>> + if(ud.deps_file):<br><br>Rewrite as:<br><br> if ud.deps_file:<br><br>> + extra_params.append("--deps-file=%s" % ud.deps_file)<br>> +<br>> + if(ud.project_name):<br><br>Rewrite as:<br><br> if ud.project_name:<u></u><u></u></p><div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>> + extra_params.append("--name=%s" % ud.project_name)<br>> +<br>> + extra_args = string.join(extra_params, sep = " ")<br>> +<br>> + runfetchcmd("gclient config %s %s " % (gclient_url, extra_args), d)<br>> +<br>> + # Gclient parameters used<br>> + # -f - force sync<br>> + # -nohooks - skip hooks execution at this time<br>> + # --with_branch_heads - gclient can't find a commit ID if it is not in a branch<br>> + #<br>> + # Note: We should enable --no-history after some more testing<br>> +<br>> + runfetchcmd("gclient sync --with_branch_heads -f --nohooks --revision %s" % ud.revision, d)<br>> +<br>> + def unpack(self, ud, destdir, d):<br>> + """ Unpack the src to destdir """<br>> + destsuffix = "gclient/"<br>> + destdir = ud.destdir = os.path.join(destdir, destsuffix)<br>> + # Use rsync for copying. Creating a tar package here would be very<br>> + # time consuming.<br>> + runfetchcmd("rsync -av %s/ %s/" %(ud.syncdir, destdir), d)<br>> + return True<br>> +<br>> + def need_update(self, ud, d):<br>> + return True<br>> +<br>> + def clean(self, ud, d):<br>> + """ Clean the gclient directory """<br>> + bb.utils.remove(ud.localpath, True)<br>> +<br>> + def localpath(self, ud, dr):<br>> + return ud.syncdir<br>> +<br>> + def supports_srcrev(self):<br>> + return False<br>> --<br>> 1.9.1<u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><span><span style="color:#888888">//Peter</span></span><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><div><p class="MsoNormal"><span style="color:#888888">Zoltan Kuscsik<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:#888888"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:#888888">Senior Software Developer, Linaro Digital Home Group<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:#888888">email: <a href="mailto:zoltan.kuscsik@linaro.org" target="_blank">zoltan.kuscsik@linaro.org</a><u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt;color:#888888">IRC: zoli_ on </span><span style="color:#888888"><a href="http://irc.linaro.org/" target="_blank"><span style="font-size:9.5pt;color:#1155cc">irc.linaro.org</span></a><u></u><u></u></span></p></div></div></div></div></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div style="color:rgb(136,136,136)">Zoltan Kuscsik</div><div style="color:rgb(136,136,136)"><br></div><div style="color:rgb(136,136,136)">Senior Software Developer, Linaro Digital Home Group</div><div style="color:rgb(136,136,136)">email: <a href="mailto:zoltan.kuscsik@linaro.org" target="_blank">zoltan.kuscsik@linaro.org</a></div><div style="color:rgb(136,136,136)"><span style="font-size:12.8000001907349px">IRC: zoli_ on </span><a href="http://irc.linaro.org/" style="font-size:12.8000001907349px;color:rgb(17,85,204)" target="_blank">irc.linaro.org</a><br></div></div></div>
</div>