[bitbake-devel] [PATCH 2/5] fetch2: Add get_mirrorname()

Robert Yang liezhi.yang at windriver.com
Fri Mar 22 03:51:54 UTC 2019



On 3/22/19 7:42 AM, Richard Purdie wrote:
> On Thu, 2019-03-14 at 17:28 +0800, Robert Yang wrote:
>> It can be used by both __init__.py and git.py.
>>
>> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
>> ---
>>   bitbake/lib/bb/fetch2/__init__.py | 5 ++++-
>>   bitbake/lib/bb/fetch2/git.py      | 2 +-
>>   2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
>> index f112067..5062bb2 100644
>> --- a/bitbake/lib/bb/fetch2/__init__.py
>> +++ b/bitbake/lib/bb/fetch2/__init__.py
>> @@ -889,6 +889,9 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None):
>>   
>>       return output
>>   
>> +def get_mirrorname(ud):
>> +    return ud.host.replace(':','.') + ud.path.replace('/', '.').replace('*', '.')
>> +
>>   def check_network_access(d, info, url):
>>       """
>>       log remote network access, and error if BB_NO_NETWORK is set or the given
>> @@ -910,7 +913,7 @@ def build_mirroruris(origud, mirrors, ld):
>>       replacements["HOST"] = origud.host
>>       replacements["PATH"] = origud.path
>>       replacements["BASENAME"] = origud.path.split("/")[-1]
>> -    replacements["MIRRORNAME"] = origud.host.replace(':','.') + origud.path.replace('/', '.').replace('*', '.')
>> +    replacements["MIRRORNAME"] = get_mirrorname(origud)
>>   
>>       def adduri(ud, uris, uds, mirrors, tarballs):
>>           for line in mirrors:
>> diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
>> index cf8bee7..45d7303 100644
>> --- a/bitbake/lib/bb/fetch2/git.py
>> +++ b/bitbake/lib/bb/fetch2/git.py
>> @@ -248,7 +248,7 @@ class Git(FetchMethod):
>>                       ud.unresolvedrev[name] = ud.revisions[name]
>>                   ud.revisions[name] = self.latest_revision(ud, d, name)
>>   
>> -        gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.'))
>> +        gitsrcname = bb.fetch2.get_mirrorname(ud)
>>           if gitsrcname.startswith('.'):
>>               gitsrcname = gitsrcname[1:]
>>   
> 
> I think your patch is highlighting a deeper problem here. The mirror
> name is something which the given fetcher module should be decoding and
> this shouldn't handled in __init__.py unless its some kind of default.
> 
> We probably need to look more deeply about why git fetcher knowledge is
> being used in the general case and fix that instead...

Make sense, I will work on it.

// Robert

> 
> Cheers,
> 
> Richard
> 
> 


More information about the bitbake-devel mailing list