From patchwork Tue Jan 7 09:17:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Herbrechtsmeier X-Patchwork-Id: 55103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D67FCE7719B for ; Tue, 7 Jan 2025 09:18:26 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.129]) by mx.groups.io with SMTP id smtpd.web11.16587.1736241499941436827 for ; Tue, 07 Jan 2025 01:18:20 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@weidmueller.com header.s=selector2 header.b=D6bn/0pD; spf=pass (domain: weidmueller.com, ip: 40.107.21.129, mailfrom: stefan.herbrechtsmeier-oss@weidmueller.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MhtZ2nV1N8Sr6VvM5jq2YISHe5uoJHwiijqFsi+PJTr4g/4Q8babC5wAdHZ3JJ961emjDpaasRF/YWvilW6Ca68IMe/C5rm8Bjn7L08Dt40XzwJj6EvIuOu4dPPX96907CibCBoz/vzDaO60/2Mc0vOmzQsfML5SrQ0ilrJBBk69dS7OrcMvKsDsdnTzkcdTkykvq2alutdNXKlkUri9rPHVKXwq47Vr4iICcQflJlEfQneOWJd64aDSDCRP3DPk39x7LTvyASXJZ5LE8raOaIYUhLOLD989BKRLfJ6y4lxkL0WI3FP5HafR8HA/hG3NAy9Rv2TUyS7CiW+qotHkSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eTPvKRjIRugd0DfnF+zHlcgXQw+aAS5AGA5VFuhyZQI=; b=sw473ajtTl0geQur+fDGeWkb4yfrC+uXHOvOJwHU8FSzSswNDiy+QRsga3RFKPWhA13wgNHxVzJnzvyI83L4ajtLzlu8upor25Yr30t7z464jskcyCeweFUXrxuT2XX/HKhEK0sDNqSSt9QfWMXRz18Kkt39pjezIZJMjICdicpLstbAwKMllC+8+rvY8wF7yIwGcSHk39p4jO77y6h1qjH4ttAHa8N/TGEs/3Lzh+OuB+CgU8Hd0huhc5ULzmZzvNBQfEN0RkT5m1Ukw8p1Z8JjeBHIpkGeDPqljGPYfM6k8ok/Qog2n+79PvDLnKjAy7v8SlzH2m4E7iPywzLcPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=weidmueller.com; dmarc=pass action=none header.from=weidmueller.com; dkim=pass header.d=weidmueller.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weidmueller.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eTPvKRjIRugd0DfnF+zHlcgXQw+aAS5AGA5VFuhyZQI=; b=D6bn/0pDy3XQgz7T6wBOP/TP2Fp0DlxXBd5lXxWxH0Et14BXBVsRxm2t+lQ0jFRWLVnt0i1ksJZhjVg/aCRzl2NVrw9U0akTvjAaCC25kBueml1dfT6Lpe7OaQAwBMQvvS4ZxS7v8MCOlmoWJXUz4CH7YsE+RktlQ+sTmqQ1c4Icae8fysd9HsEcTubB8dCwxq3lznGFSmEFXA55wo9VpQBygIdBoyWbnyn1iQmaea5sb1JDhSeqt+6uM2fbOficx3uQgDI+vakI1Y9qXR9JG31GEtq3QMF702HalvHWq4PSL7F4KtlqbLW0AR9UXM1YH5m5tHWcqq4AlbT5/0jmWg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=weidmueller.com; Received: from PAXPR08MB6969.eurprd08.prod.outlook.com (2603:10a6:102:1d8::23) by GV1PR08MB10607.eurprd08.prod.outlook.com (2603:10a6:150:16c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.18; Tue, 7 Jan 2025 09:18:13 +0000 Received: from PAXPR08MB6969.eurprd08.prod.outlook.com ([fe80::3b1:b329:1ed9:dad4]) by PAXPR08MB6969.eurprd08.prod.outlook.com ([fe80::3b1:b329:1ed9:dad4%3]) with mapi id 15.20.8314.015; Tue, 7 Jan 2025 09:18:13 +0000 From: Stefan Herbrechtsmeier To: bitbake-devel@lists.openembedded.org CC: Stefan Herbrechtsmeier Subject: [PATCH 1/5] tests: fetch: update npmsw tests to new lockfile format Date: Tue, 7 Jan 2025 10:17:53 +0100 Message-ID: <20250107091757.886-2-stefan.herbrechtsmeier-oss@weidmueller.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107091757.886-1-stefan.herbrechtsmeier-oss@weidmueller.com> References: <20250107091757.886-1-stefan.herbrechtsmeier-oss@weidmueller.com> X-ClientProxiedBy: FR4P281CA0015.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c8::7) To PAXPR08MB6969.eurprd08.prod.outlook.com (2603:10a6:102:1d8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR08MB6969:EE_|GV1PR08MB10607:EE_ X-MS-Office365-Filtering-Correlation-Id: 96b9c76a-e3a2-4fed-b65d-08dd2efc35ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 0H8czt4HNA9/0FDE99AJ/pYFMdo3AG7mTNJK6fVy5Iqck4sCyHn6So6XjN6LvfUEbfxPehoqyKjDpQ7ckX5AV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adIzDOXwx+Cj7xA1/gSN+uoKVY7aZ8ZH4isPwm0Mu8CqK8M1MRvpQInl0IK3bIGOzSfYqM63PxlwECleyuIwINy/BRoZO6j+GfQ74pUp6fmCaMBdBNFhg/I8JerTAV/hbxs6WuIjmjzsNXM/zjrAnTigH8g3aSrRheG/DWU4C9BfgWLP9PNsmu1fsVJb7MQpQL97d/0gPktpkH3WHvnpmsCJHK1sSvVY2b4OLyfnV+KIekfNsF3MkulcRt5NLbau0kcq5PA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR08MB6969.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AL2hn/CKuKNNZ9ilG3tMVibLevDGXvc/wZA9Xyp5pS2//6VNoyTtLAK+zM8en18SZ3w9f6elGyOtlNg6uAJl00fCNxsF9Vkt3o2KIiuKwr5fwmQ4nS/LwUNmYpCecGetsRoyk7NRXruNrtm2+mTTHeUOfPjj+XDXFGTkWsN0jUBU8Va5RICw2iZj9N/E/FbZWsV9B0rO2/MzRPNPhTxzi921R8Srz8few2I4QHwPGx+vHyqhfLPp9TT3mBb5D4Xy0Q01t4d5Ont1Uwaf9cd4Utj5D6NfahsB7zGW070n815KOWnURQ+yBqoW/xHTDKTwWopxV6fvVLiHO9uih20vCf305JQO42WU25rhWXIexqIqy/jq2hYkfSlff88w59IMzW1IkA1cxyPQICNnS4H3v5/X079y/DM20xoRwJXR2VVn2czvhhSlSJwCplKs/o8Vj1TCyAFH8ZJOB46BbrfpN4CXhPklsFy3OKnkSWDlBp5Xr2nGV9oBV1k7F76BoZYAh1chFKfvP43mp/FVjAVGW106YtSzKkBXRmDp17PiSbCssi+aY4+qEf2t/zxhNl6hZHNhOy0LjS2KGeTe2k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96b9c76a-e3a2-4fed-b65d-08dd2efc35ad X-MS-Exchange-CrossTenant-AuthSource: PAXPR08MB6969.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 09:18:12.6582 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e4289438-1c5f-4c95-a51a-ee553b8b18ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YTqhlgzj0zsGkKrmixJZx/HMc6zeubT4axwbr7GgQvMFS3sRSfzxjxnk2a4vnDdOEiSZzC8Ptb+8CGDpm83VFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB10607 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 07 Jan 2025 09:18:26 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16973 From: Stefan Herbrechtsmeier Update npmsw test cases to new lockfile format. The old lockfile format is required by npm 6 / Node.js 14 which is out of maintenance [2]. [1] https://docs.npmjs.com/cli/v6/configuring-npm/package-lock-json [2] https://nodejs.org/en/about/previous-releases Signed-off-by: Stefan Herbrechtsmeier --- lib/bb/tests/fetch.py | 135 +++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 81 deletions(-) diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py index 6dda0d381..b89348236 100644 --- a/lib/bb/tests/fetch.py +++ b/lib/bb/tests/fetch.py @@ -2843,23 +2843,25 @@ class NPMTest(FetcherTest): @skipIfNoNetwork() def test_npmsw(self): swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=', 'dependencies': { - 'content-type': { - 'version': 'https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz', - 'integrity': 'sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==', - 'dependencies': { - 'cookie': { - 'version': 'git+https://github.com/jshttp/cookie.git#aec1177c7da67e3b3273df96cf476824dbc9ae09', - 'from': 'git+https://github.com/jshttp/cookie.git' - } - } - } + 'content-type': "1.0.4" } + }, + 'node_modules/array-flatten/node_modules/content-type': { + 'version': '1.0.4', + 'resolved': 'https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz', + 'integrity': 'sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==', + 'dependencies': { + 'cookie': 'git+https://github.com/jshttp/cookie.git#aec1177c7da67e3b3273df96cf476824dbc9ae09' + } + }, + 'node_modules/array-flatten/node_modules/content-type/node_modules/cookie': { + 'resolved': 'git+https://github.com/jshttp/cookie.git#aec1177c7da67e3b3273df96cf476824dbc9ae09' } } }) @@ -2877,10 +2879,9 @@ class NPMTest(FetcherTest): @skipIfNoNetwork() def test_npmsw_git(self): swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'cookie': { - 'version': 'github:jshttp/cookie.git#aec1177c7da67e3b3273df96cf476824dbc9ae09', - 'from': 'github:jshttp/cookie.git' + 'packages': { + 'node_modules/cookie': { + 'resolved': 'git+https://github.com/jshttp/cookie.git#aec1177c7da67e3b3273df96cf476824dbc9ae09' } } }) @@ -2888,40 +2889,16 @@ class NPMTest(FetcherTest): fetcher.download() self.assertTrue(os.path.exists(os.path.join(self.dldir, 'git2', 'github.com.jshttp.cookie.git'))) - swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'cookie': { - 'version': 'jshttp/cookie.git#aec1177c7da67e3b3273df96cf476824dbc9ae09', - 'from': 'jshttp/cookie.git' - } - } - }) - fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d) - fetcher.download() - self.assertTrue(os.path.exists(os.path.join(self.dldir, 'git2', 'github.com.jshttp.cookie.git'))) - - swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'nodejs': { - 'version': 'gitlab:gitlab-examples/nodejs.git#892a1f16725e56cc3a2cb0d677be42935c8fc262', - 'from': 'gitlab:gitlab-examples/nodejs' - } - } - }) - fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d) - fetcher.download() - self.assertTrue(os.path.exists(os.path.join(self.dldir, 'git2', 'gitlab.com.gitlab-examples.nodejs.git'))) - @skipIfNoNetwork() def test_npmsw_dev(self): swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' }, - 'content-type': { + 'node_modules/content-type': { 'version': '1.0.4', 'resolved': 'https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz', 'integrity': 'sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==', @@ -2943,8 +2920,8 @@ class NPMTest(FetcherTest): @skipIfNoNetwork() def test_npmsw_destsuffix(self): swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' @@ -2958,8 +2935,8 @@ class NPMTest(FetcherTest): def test_npmsw_no_network_no_tarball(self): swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' @@ -2981,8 +2958,8 @@ class NPMTest(FetcherTest): self.d.setVar('BB_NO_NETWORK', '1') # Fetch again swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' @@ -2998,8 +2975,8 @@ class NPMTest(FetcherTest): def test_npmsw_npm_reusability(self): # Fetch once with npmsw swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' @@ -3020,8 +2997,8 @@ class NPMTest(FetcherTest): def test_npmsw_bad_checksum(self): # Try to fetch with bad checksum swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-gfNEp2hqgLTFKT6P3AsBYMgsBqg=' @@ -3033,8 +3010,8 @@ class NPMTest(FetcherTest): fetcher.download() # Fetch correctly to get a tarball swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' @@ -3072,8 +3049,8 @@ class NPMTest(FetcherTest): # Fetch again self.assertFalse(os.path.exists(ud.localpath)) swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' @@ -3100,8 +3077,8 @@ class NPMTest(FetcherTest): # Fetch again with invalid url self.assertFalse(os.path.exists(ud.localpath)) swfile = self.create_shrinkwrap_file({ - 'dependencies': { - 'array-flatten': { + 'packages': { + 'node_modules/array-flatten': { 'version': '1.1.1', 'resolved': 'https://invalid', 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' @@ -3114,29 +3091,25 @@ class NPMTest(FetcherTest): @skipIfNoNetwork() def test_npmsw_bundled(self): - for packages_key, package_prefix, bundled_key in [ - ('dependencies', '', 'bundled'), - ('packages', 'node_modules/', 'inBundle') - ]: - swfile = self.create_shrinkwrap_file({ - packages_key: { - package_prefix + 'array-flatten': { - 'version': '1.1.1', - 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', - 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' - }, - package_prefix + 'content-type': { - 'version': '1.0.4', - 'resolved': 'https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz', - 'integrity': 'sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==', - bundled_key: True - } + swfile = self.create_shrinkwrap_file({ + 'packages': { + 'node_modules/array-flatten': { + 'version': '1.1.1', + 'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz', + 'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=' + }, + 'node_modules/content-type': { + 'version': '1.0.4', + 'resolved': 'https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz', + 'integrity': 'sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==', + 'inBundle': True } - }) - fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d) - fetcher.download() - self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz'))) - self.assertFalse(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz'))) + } + }) + fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d) + fetcher.download() + self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz'))) + self.assertFalse(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz'))) class GitSharedTest(FetcherTest): def setUp(self):