diff options
author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2024-12-09 11:31:58 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-12-20 16:18:59 +0000 |
commit | f1745ce249da7b862e1976bbeda45ac7d781efd2 (patch) | |
tree | acaf54e57ec17e89a9e832f7d25f6344c1bb42d3 | |
parent | 02f8ea68657c159486940be9d59391745c517858 (diff) | |
download | poky-f1745ce249da7b862e1976bbeda45ac7d781efd2.tar.gz |
bitbake: tests: fetch: add npmsw test case for bundled dependencies
The npm package lock and shrinkwrap file list bundled dependencies which
are supplied together with the parent dependency. The bundled
dependencies are marked by a flag. The flag and thereby test depends on
the lock file version. The old lock file version uses a `bundled` flag
and stores dependencies in the `dependencies` list. The new lock file
version uses an `inBundle` flag and stores dependencies in the
`packages` list.
(Bitbake rev: 34fd8ea6abe755e04220fe70b082aa620ae15f86)
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 3eaaa83620..6dda0d3813 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -3112,6 +3112,32 @@ class NPMTest(FetcherTest): | |||
3112 | fetcher.download() | 3112 | fetcher.download() |
3113 | self.assertTrue(os.path.exists(ud.localpath)) | 3113 | self.assertTrue(os.path.exists(ud.localpath)) |
3114 | 3114 | ||
3115 | @skipIfNoNetwork() | ||
3116 | def test_npmsw_bundled(self): | ||
3117 | for packages_key, package_prefix, bundled_key in [ | ||
3118 | ('dependencies', '', 'bundled'), | ||
3119 | ('packages', 'node_modules/', 'inBundle') | ||
3120 | ]: | ||
3121 | swfile = self.create_shrinkwrap_file({ | ||
3122 | packages_key: { | ||
3123 | package_prefix + 'array-flatten': { | ||
3124 | 'version': '1.1.1', | ||
3125 | 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', | ||
3126 | 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' | ||
3127 | }, | ||
3128 | package_prefix + 'content-type': { | ||
3129 | 'version': '1.0.4', | ||
3130 | 'resolved': 'https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz', | ||
3131 | 'integrity': 'sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==', | ||
3132 | bundled_key: True | ||
3133 | } | ||
3134 | } | ||
3135 | }) | ||
3136 | fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d) | ||
3137 | fetcher.download() | ||
3138 | self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz'))) | ||
3139 | self.assertFalse(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz'))) | ||
3140 | |||
3115 | class GitSharedTest(FetcherTest): | 3141 | class GitSharedTest(FetcherTest): |
3116 | def setUp(self): | 3142 | def setUp(self): |
3117 | super(GitSharedTest, self).setUp() | 3143 | super(GitSharedTest, self).setUp() |