All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: Mark Hatle <mark.hatle@windriver.com>,
	<bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH 5/5] fetch2: Add gitsm's function process_submodules()
Date: Fri, 15 Mar 2019 11:37:23 +0800	[thread overview]
Message-ID: <40a095c7-c69e-2b9e-711c-05847227509d@windriver.com> (raw)
In-Reply-To: <339b2a82-b650-0781-7311-71ef931978bd@windriver.com>

Hi Mark,

On 3/14/19 10:46 PM, Mark Hatle wrote:
> On 3/14/19 4:28 AM, Robert Yang wrote:
>> So that bbclass can call it as fetcher.process_submodules(), otherwise, the
>> bbclass has to handle submodules itself.
> 
> Are there any general equivalent to submodules in any other SCM?
> 
> I think SVN has something similar, but I'm not sure if it requires special
> fetching or processing activities.  I don't think other SCMs do.

Yes, I agree with that.

> 
> Why is this needed, for do_clean/do_cleanall?

We have an internal bbclass (fetcher_helper.bbclass) to collect all SRC_URI, and
add the sources into corresponding download layer. I can get the submodule's
SRC_URI in fetcher_helper.bbclass as I had already done, but I think that
others (e.g., tinfoil.py) may also have the similar requirements, so I think
that we'd better export the API in bitbake/lib/bb/fetch2/__init__.py,
then we can use it as:

fetcher = bb.fetch2.Fetch(src_uri, d)
fetcher.process_submodules(ud, ud.clonedir, customized_function)


Otherwise, we have to handle submodules manually as I had done in 
fetcher_helper.bbclass.


> 
> Theoretically it should be up to the fetch implementation itself to walk
> everything and do the clean operation.  (another comment below)
> 
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   bitbake/lib/bb/fetch2/__init__.py | 25 +++++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>>
>> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
>> index 64d7526..78bea1f 100644
>> --- a/bitbake/lib/bb/fetch2/__init__.py
>> +++ b/bitbake/lib/bb/fetch2/__init__.py
>> @@ -1807,6 +1807,31 @@ class Fetch(object):
>>               if ud.lockfile:
>>                   bb.utils.unlockfile(lf)
>>   
>> +    def process_submodules(self, ud, workdir, function, urls=None):
>> +        if not urls:
>> +            urls = self.urls
>> +
>> +        for url in urls:
>> +            if url not in self.ud:
>> +                self.ud[url] = FetchData(url, d)
>> +            ud = self.ud[url]
>> +            ud.setup_localpath(self.d)
>> +
>> +            if not ud.localfile and ud.localpath is None:
>> +                continue
>> +
>> +
>> +            if ud.lockfile:
>> +                lf = bb.utils.lockfile(ud.lockfile)
>> +
>> +            ud.method.process_submodules(ud, workdir, function, self.d)
> 
> Since most fetchers won't have this implemented, shouldn't you check if the
> function is available, and if not simply continue (nothing to do)?

Yes, make sense, fixed it in the pull repo:

+    def process_submodules(self, ud, workdir, function, urls=None):
+        if not hasattr(ud.method, 'process_submodules'):
+            bb.warn('process_submodules() is not implented.')
+            return
[snip]


// Robert


> 
>> +            if ud.donestamp:
>> +                bb.utils.remove(ud.donestamp)
>> +
>> +            if ud.lockfile:
>> +                bb.utils.unlockfile(lf)
>> +
>> +
>>   class FetchConnectionCache(object):
>>       """
>>           A class which represents an container for socket connections.
>>
> 
> 


  reply	other threads:[~2019-03-15  3:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14  9:28 [PATCH 0/5] fetch2: Fixes for git and gitsm Robert Yang
2019-03-14  9:28 ` [PATCH 1/5] fetch2/git: Fix clean to remove clonedir Robert Yang
2019-03-14  9:28 ` [PATCH 2/5] fetch2: Add get_mirrorname() Robert Yang
2019-03-21 23:42   ` Richard Purdie
2019-03-22  3:51     ` Robert Yang
2019-03-14  9:28 ` [PATCH 3/5] fetch2: Print SCMs list when SRCREV_FORMAT is not set Robert Yang
2019-03-14  9:28 ` [PATCH 4/5] fetch2/gitsm: Add clean function Robert Yang
2019-03-14 12:34   ` Lisicki, Raphael
2019-03-15  2:50     ` Robert Yang
2019-03-15 15:44       ` Mark Hatle
2019-03-19  6:41         ` Robert Yang
2019-03-14 14:41   ` Mark Hatle
2019-03-15  2:52     ` Robert Yang
2019-03-15 15:46       ` Mark Hatle
2019-03-15  3:48     ` Robert Yang
2019-03-14  9:28 ` [PATCH 5/5] fetch2: Add gitsm's function process_submodules() Robert Yang
2019-03-14 14:46   ` Mark Hatle
2019-03-15  3:37     ` Robert Yang [this message]
2019-03-15 15:55       ` Mark Hatle
2019-03-19  3:47         ` Robert Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40a095c7-c69e-2b9e-711c-05847227509d@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=mark.hatle@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.