From: Robert Yang <liezhi.yang@windriver.com>
To: Mark Hatle <mark.hatle@windriver.com>,
"Lisicki, Raphael" <raphael.lisicki@siemens.com>,
"bitbake-devel@lists.openembedded.org"
<bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH 4/5] fetch2/gitsm: Add clean function
Date: Tue, 19 Mar 2019 14:41:51 +0800 [thread overview]
Message-ID: <f3c170d1-b0db-fd6c-b00a-7e8b37990af8@windriver.com> (raw)
In-Reply-To: <d0f5f424-36b0-b266-f6cc-c5085cc39586@windriver.com>
Hi Mark,
On 3/15/19 11:44 PM, Mark Hatle wrote:
> On 3/14/19 9:50 PM, Robert Yang wrote:
>> Hi,
>>
>> On 3/14/19 8:34 PM, Lisicki, Raphael wrote:
>>> I have not fully understand the logic but I am wondering what happens here is a submodule is located in two different repositories? Wouldn't a clean of one module delete submodules of the other one as well?
>>
>> Here are more explanations about the logic, for example, repo_A has two
>> submodules repo_B and repo_C, then after do_fetch,
>> they will be"
>> DL_DIR/repo_A
>> DL_DIR/repo_B
>> DL_DIR/repo_C
>>
>> Without this patch, do_cleanall only removes DL_DIR/repo_A, but leaves
>> repo_B and repo_C there, this patch makes it remove repo_B and C.
>
> The issue Raphael is mentioning is when you have multiple projects that use the
> same submodules. I.e.:
>
> recipeA:
> DL_DIR/repo_A
> DL_DIR/repo_B
> DL_DIR/repo_C
>
> recipeB:
> DL_DIR/repo_D
> DL_DIR/repo_C
>
> If you do a clean of A, you will end up removing repo_C which both items end up
> using.
>
> I don't know any way to resolve this, since the dependency is implicit, not
> explicit -- so the system won't have any idea that the same thing is used in
> multiple places.
>
>>
>> For your question, if repo_B is submodule of both repo_A and repo_D, it
>> is like foo and foo-native use the same git source, when you run
>> "bitbake foo -cccleanall", both foo and foo-native's source will be
>> removed since they use the same source, the similar to gitsm, so it is not
>> a problem, the source will be re-downloaded automatically when needed.
>
> I'm not sure if this situation will work, since the recipeB will have a stamp
> that says the download is complete, even though part of it is now missing.
It's a generic issue when the same sources are use across recipes, e.g.:
# Cleanup everything
$ bitbake gnu-config gnu-config-native -ccleanall
# Fetch
$ bitbake gnu-config gnu-config-native -cfetch
# Cleanup the git repo
$ bitbake gnu-config -ccleanall
# Unpack gnu-config-native
$ bitbake gnu-config-native -cunpack
ERROR: gnu-config-native-20181128+gitAUTOINC+058639be22-r0 do_unpack: Unpack
failure for URL: 'git://git.savannah.gnu.org/config.git'. No up to date source
found: clone directory not available or not up to date:
/buildarea1/lyang1/rebase-work/test_fetch/downloads/git2/git.savannah.gnu.org.config.git;
shallow clone not enabled
ERROR: gnu-config-native-20181128+gitAUTOINC+058639be22-r0 do_unpack:
ERROR: gnu-config-native-20181128+gitAUTOINC+058639be22-r0 do_unpack: Function
failed: base_do_unpack
So the users should handle it themselves in such a case.
// Robert
>
> --Mark
>
>> // Robert
>>
>>>
>>> Best regards
>>> Raphael
>>>
>>>> -----Original Message-----
>>>> From: bitbake-devel-bounces@lists.openembedded.org <bitbake-devel-
>>>> bounces@lists.openembedded.org> On Behalf Of Robert Yang
>>>> Sent: Thursday, March 14, 2019 10:28 AM
>>>> To: bitbake-devel@lists.openembedded.org
>>>> Subject: [bitbake-devel] [PATCH 4/5] fetch2/gitsm: Add clean function
>>>>
>>>> The git's clean can only remove parent git repo from DL_DIR, but doesn't
>>>> remove
>>>> submodules, this patch fixes the problem.
>>>>
>>>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>>>> ---
>>>> bitbake/lib/bb/fetch2/gitsm.py | 15 +++++++++++++--
>>>> 1 file changed, 13 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
>>>> index b21fed2..bb61093 100644
>>>> --- a/bitbake/lib/bb/fetch2/gitsm.py
>>>> +++ b/bitbake/lib/bb/fetch2/gitsm.py
>>>> @@ -76,8 +76,8 @@ class GitSM(Git):
>>>> for name in ud.names:
>>>> try:
>>>> gitmodules = runfetchcmd("%s show %s:.gitmodules" %
>>>> (ud.basecmd, ud.revisions[name]), d, quiet=True, workdir=workdir)
>>>> - except:
>>>> - # No submodules to update
>>>> + except Exception as esc:
>>>> + logger.info("No submodules found: %s" % workdir)
>>>> continue
>>>>
>>>> for m, md in parse_gitmodules(gitmodules).items():
>>>> @@ -164,6 +164,17 @@ class GitSM(Git):
>>>> Git.download(self, ud, d)
>>>> self.process_submodules(ud, ud.clonedir, download_submodule, d)
>>>>
>>>> + def clean(self, ud, d):
>>>> + def clean_submodule(ud, url, module, modpath, d):
>>>> + try:
>>>> + newfetch = Fetch([url], d, cache=False)
>>>> + newfetch.clean()
>>>> + except Exception as e:
>>>> + logger.warn('gitsm: submodule clean failed: %s %s' %
>>>> (type(e).__name__, str(e)))
>>>> +
>>>> + self.process_submodules(ud, ud.clonedir, clean_submodule, d)
>>>> + Git.clean(self, ud, d)
>>>> +
>>>> def unpack(self, ud, destdir, d):
>>>> def unpack_submodules(ud, url, module, modpath, d):
>>>> url += ";bareclone=1;nobranch=1"
>>>> --
>>>> 2.7.4
>>>>
>>>> --
>>>> _______________________________________________
>>>> bitbake-devel mailing list
>>>> bitbake-devel@lists.openembedded.org
>>>> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>
>
next prev parent reply other threads:[~2019-03-19 6:36 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 [this message]
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
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=f3c170d1-b0db-fd6c-b00a-7e8b37990af8@windriver.com \
--to=liezhi.yang@windriver.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=mark.hatle@windriver.com \
--cc=raphael.lisicki@siemens.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox