[bitbake-devel] [PATCH] bitbake: fetch2/npm.py: Allow shrinkwrap resolved relative URL which startswith 'http' (e.g http-proxy)

Peter Kjellerstedt peter.kjellerstedt at axis.com
Wed Jul 18 14:01:51 UTC 2018


> -----Original Message-----
> From: bitbake-devel-bounces at lists.openembedded.org [mailto:bitbake-
> devel-bounces at lists.openembedded.org] On Behalf Of Parthiban
> Nallathambi
> Sent: den 18 juli 2018 11:04
> To: bitbake-devel at lists.openembedded.org
> Subject: [bitbake-devel] [PATCH] bitbake: fetch2/npm.py: Allow
> shrinkwrap resolved relative URL which startswith 'http' (e.g http-
> proxy)
> 
> shrinkwrap resolved relative URL can start with http. For example,
> "resolved: http-proxy/-/http-proxy-${PV}.tgz" is still relative URL
> to npm registry, but starts with http.
> 
> Current if statement compares the startswith 'resolved' to 'http',
> which makes impossible to use npm download. Condtional comparison
> now strictly checks for "http://" and "https://"
> 
> Signed-off-by: Parthiban Nallathambi <pn at denx.de>
> ---
>  bitbake/lib/bb/fetch2/npm.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
> index ba7fa43a82..5e7fc2f769 100644
> --- a/bitbake/lib/bb/fetch2/npm.py
> +++ b/bitbake/lib/bb/fetch2/npm.py
> @@ -234,7 +234,7 @@ class Npm(FetchMethod):
>                          self._getshrinkeddependencies(obj, data['dependencies'][obj], data['dependencies'][obj]['version'], d, ud, lockdown, manifest, False)
>                          return
>          outputurl = "invalid"
> -        if ('resolved' not in data) or (not data['resolved'].startswith('http')):
> +        if ('resolved' not in data) or (not data['resolved'].startswith('http://')) or (not data['resolved'].startswith('https://')):

That is wrong (the above will always evaluate to true as long as 
'resolved' exists in data since both expressions testing the prefix 
obviously cannot be false at the same time). The correct expression 
should be:

        if ('resolved' not in data) or (not data['resolved'].startswith('http://') and not data['resolved'].startswith('https://')):

>              # will be the case for ${PN}
>              fetchcmd = "npm view %s@%s dist.tarball --registry %s" % (pkg, version, ud.registry)
>              logger.debug(2, "Found this matching URL: %s" % str(fetchcmd))
> --
> 2.14.4

//Peter




More information about the bitbake-devel mailing list