diff options
author | Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com> | 2024-08-22 09:53:15 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-23 09:48:48 +0100 |
commit | ec86853a2691dd903428e484d0ae3f321734f60d (patch) | |
tree | 869d81dc7bb4a1f348d382ee515e40ed89cf9b67 | |
parent | 524e6b65a64c0310918cda9eaf5c1b6dd819dd0f (diff) | |
download | poky-ec86853a2691dd903428e484d0ae3f321734f60d.tar.gz |
bitbake: fetch2/npmsw: allow packages not declaring a registry version
We fetch npm dependencies from the npm-shrinkwrap.json file. They can
point to a package on the NPM registry with a version field, or to a
git/http/file URL with the resolved field. Such packages are allowed not
to declare a registry version field because they may not have been
published to the NPM registry. The previous implementation refuses to
fetch such packages and throws an error.
The resolved field contains the exact source, including the revision,
wich we can use to pass as SRC_URI to the git/http/file fetcher. The
integrity field is also mandatory for HTTP tarballs which will ensure
reproducibility. So even if the version field is not present, we are
still fetching a precise revision of the package.
Another commit published along this stack is also required in the npm
class to support these packages.
v5:
- improve commit message
v3:
- Split bitbake npmsw.py modification in another commit
Co-authored-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
(Bitbake rev: 209982b5a3efc8081e65b4326bf9b64eef7f0ba0)
Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/npmsw.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/npmsw.py b/bitbake/lib/bb/fetch2/npmsw.py index d8ed9df327..a5fa598deb 100644 --- a/bitbake/lib/bb/fetch2/npmsw.py +++ b/bitbake/lib/bb/fetch2/npmsw.py | |||
@@ -97,7 +97,7 @@ class NpmShrinkWrap(FetchMethod): | |||
97 | 97 | ||
98 | integrity = params.get("integrity", None) | 98 | integrity = params.get("integrity", None) |
99 | resolved = params.get("resolved", None) | 99 | resolved = params.get("resolved", None) |
100 | version = params.get("version", None) | 100 | version = params.get("version", resolved) |
101 | 101 | ||
102 | # Handle registry sources | 102 | # Handle registry sources |
103 | if is_semver(version) and integrity: | 103 | if is_semver(version) and integrity: |