diff options
author | Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com> | 2024-08-12 14:28:26 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-23 09:51:36 +0100 |
commit | 1053035cbca82f177e6cf8a2d467786de7aa146c (patch) | |
tree | a5e0aa1c943bac9f9c30cd4ba202d455d2460a88 /meta | |
parent | ec86853a2691dd903428e484d0ae3f321734f60d (diff) | |
download | poky-1053035cbca82f177e6cf8a2d467786de7aa146c.tar.gz |
npm: accept unspecified versions in package.json
Our current emulation mandates that the package.json contains a version
field. Some packages may not provide it when they are not published to
the registry. The actual `npm pack` would allow such packages, so
should we.
This patch adds a default value to allow building such packages.
This applies for instance to this package which doesn't declare a
version:
- https://github.com/cockpit-project/cockpit/blob/23701a555a5af13f998ee4c7526d27fdb5669d63/package.json#L2
v3:
- Split bitbake npmsw.py modification in another commit
Co-authored-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
(From OE-Core rev: 470c4c027c2b8bbecf23aa63650a22a312de9aa6)
Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes-recipe/npm.bbclass | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/classes-recipe/npm.bbclass b/meta/classes-recipe/npm.bbclass index 91da3295f2..a73ff29be8 100644 --- a/meta/classes-recipe/npm.bbclass +++ b/meta/classes-recipe/npm.bbclass | |||
@@ -72,8 +72,10 @@ def npm_pack(env, srcdir, workdir): | |||
72 | j = json.load(f) | 72 | j = json.load(f) |
73 | 73 | ||
74 | # base does not really matter and is for documentation purposes | 74 | # base does not really matter and is for documentation purposes |
75 | # only. But the 'version' part must exist because other parts of | 75 | # only. But the 'version' part must exist because other parts of |
76 | # the bbclass rely on it. | 76 | # the bbclass rely on it. |
77 | if 'version' not in j: | ||
78 | j['version'] = '0.0.0-unknown' | ||
77 | base = j['name'].split('/')[-1] | 79 | base = j['name'].split('/')[-1] |
78 | tarball = os.path.join(workdir, "%s-%s.tgz" % (base, j['version'])); | 80 | tarball = os.path.join(workdir, "%s-%s.tgz" % (base, j['version'])); |
79 | 81 | ||