bitbake: fetch2/npm.py: Allow shrinkwrap resolved relative URL which startswith 'http' (e.g http-proxy)
PATCH 1/1 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://"
--- bitbake/lib/bb/fetch2/npm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/npm.py +1 -1
@@ -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://')): # 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))
Signature · 1 line
2.14.4
Quoted 28 lines
-----Original Message-----
From: [email protected] [mailto:bitbake- [email protected]] On Behalf Of Parthiban Nallathambi
Sent: den 18 juli 2018 11:04
To: [email protected]
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 <[email protected]>--- bitbake/lib/bb/fetch2/npm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/fetch2/npm.py +0
-0
bitbake/lib/bb/fetch2/npm.py class Npm(FetchMethod): · line 237
Quoted 5 lines
bitbake/lib/bb/fetch2/npm.py +1
-1@@ -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://')):
Quoted 5 lines
bitbake/lib/bb/fetch2/npm.py +0
-1# 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
Hello Peter,
Quoted 39 lines · Peter Kjellerstedt
Quoted 28 lines
-----Original Message-----
From: [email protected] [mailto:bitbake- [email protected]] On Behalf Of Parthiban Nallathambi
Sent: den 18 juli 2018 11:04
To: [email protected]
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 <[email protected]>--- bitbake/lib/bb/fetch2/npm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/fetch2/npm.py +0
-0bitbake/lib/bb/fetch2/npm.py class Npm(FetchMethod): · line 237
Quoted 5 lines
bitbake/lib/bb/fetch2/npm.py +1
-1@@ -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:
Quoted 1 line
if ('resolved' not in data) or (not data['resolved'].startswith('http://') and not data['resolved'].startswith('https://')):
Thanks for pointing. I missed it. I will update and send the v2.
Quoted 9 lines
Quoted 6 lines
bitbake/lib/bb/fetch2/npm.py +0
-1# 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
Signature · 6 lines
Thanks, Parthiban Nallathambi DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 1/1 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://"
Changelog since v1:
- Use the proper conditional statement to avoid always success
--- bitbake/lib/bb/fetch2/npm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/npm.py +1 -1
@@ -226,7 +226,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://') 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))
Signature · 1 line
2.14.4
Ping on this patch!
Quoted 30 lines · Parthiban Nallathambi
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://"
Changelog since v1:
- Use the proper conditional statement to avoid always successSigned-off-by Parthiban Nallathambi <[email protected]>--- bitbake/lib/bb/fetch2/npm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/fetch2/npm.py +1
-1@@ -226,7 +226,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://') 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))
Signature · 2 lines
Thanks, Parthiban N
Ping on this patch!
Quoted 34 lines · Parthiban Nallathambi
Ping on this patch!
Quoted 30 lines · Parthiban Nallathambi
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://"
Changelog since v1:
- Use the proper conditional statement to avoid always successSigned-off-by Parthiban Nallathambi <[email protected]>---
bitbake/lib/bb/fetch2/npm.py| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/fetch2/npm.py +0
-0@@ -226,7 +226,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://') 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))
Signature · 6 lines
Thanks, Parthiban N DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-22 Fax: (+49)-8142-66989-80 Email: [email protected]