diff mbox series

[1/2] fetch2: kill parameters in uri_find_decoded

Message ID 20230117153643.21716-1-pavel@zhukoff.net
State Accepted, archived
Commit 80421abd5bf3f1f751219c050fa93970cf1f2088
Headers show
Series [1/2] fetch2: kill parameters in uri_find_decoded | expand

Commit Message

Pavel Zhukov Jan. 17, 2023, 3:36 p.m. UTC
Fixes:
  File "/bitbake/./lib/bb/fetch2/__init__.py", line 446, in uri_replace
    if uri_decoded[loc][k] != uri_find_decoded[loc][k]:
KeyError: 'module'

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
---
 bitbake/lib/bb/fetch2/__init__.py | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Purdie Jan. 17, 2023, 11:13 p.m. UTC | #1
On Tue, 2023-01-17 at 16:36 +0100, Pavel Zhukov wrote:
> Fixes:
>   File "/bitbake/./lib/bb/fetch2/__init__.py", line 446, in uri_replace
>     if uri_decoded[loc][k] != uri_find_decoded[loc][k]:
> KeyError: 'module'
> 
> Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
> ---
>  bitbake/lib/bb/fetch2/__init__.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index 893ec6f6bd..b1cd6b25c2 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -469,6 +469,7 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
>                      basename = os.path.basename(mirrortarball)
>                      # Kill parameters, they make no sense for mirror tarballs
>                      uri_decoded[5] = {}
> +                    uri_find_decoded[5] = {}
>                  elif ud.localpath and ud.method.supports_checksum(ud):
>                      basename = os.path.basename(ud.localpath)
>                  if basename:

The fix looks reasonable but is there a test we should be adding to
cover this scenario?

Cheers,

Richard
Pavel Zhukov Jan. 18, 2023, 7:28 a.m. UTC | #2
Richard Purdie <richard.purdie@linuxfoundation.org> writes:

> On Tue, 2023-01-17 at 16:36 +0100, Pavel Zhukov wrote:
>> Fixes:
>>   File "/bitbake/./lib/bb/fetch2/__init__.py", line 446, in uri_replace
>>     if uri_decoded[loc][k] != uri_find_decoded[loc][k]:
>> KeyError: 'module'
>> 
>> Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
>> ---
>>  bitbake/lib/bb/fetch2/__init__.py | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
>> index 893ec6f6bd..b1cd6b25c2 100644
>> --- a/bitbake/lib/bb/fetch2/__init__.py
>> +++ b/bitbake/lib/bb/fetch2/__init__.py
>> @@ -469,6 +469,7 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
>>                      basename = os.path.basename(mirrortarball)
>>                      # Kill parameters, they make no sense for mirror tarballs
>>                      uri_decoded[5] = {}
>> +                    uri_find_decoded[5] = {}
>>                  elif ud.localpath and ud.method.supports_checksum(ud):
>>                      basename = os.path.basename(ud.localpath)
>>                  if basename:
>
> The fix looks reasonable but is there a test we should be adding to
> cover this scenario?
Mercurial test (second patch in the series) covers this but it will be
executed only if network enabled and mercurial installed so I've modified
existing git premirror local test to cover this change as well:

Subject: [PATCH] fetch2/tests: Add parameter to recipe_uri

>
> Cheers,
>
> Richard
diff mbox series

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 893ec6f6bd..b1cd6b25c2 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -469,6 +469,7 @@  def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
                     basename = os.path.basename(mirrortarball)
                     # Kill parameters, they make no sense for mirror tarballs
                     uri_decoded[5] = {}
+                    uri_find_decoded[5] = {}
                 elif ud.localpath and ud.method.supports_checksum(ud):
                     basename = os.path.basename(ud.localpath)
                 if basename: