From patchwork Fri Dec 20 11:25:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Herbrechtsmeier X-Patchwork-Id: 54442 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 483BEE7718B for ; Fri, 20 Dec 2024 11:26:41 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.118]) by mx.groups.io with SMTP id smtpd.web11.149744.1734693993154756588 for ; Fri, 20 Dec 2024 03:26:35 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@weidmueller.com header.s=selector2 header.b=rvUaJ610; spf=pass (domain: weidmueller.com, ip: 40.107.20.118, mailfrom: stefan.herbrechtsmeier-oss@weidmueller.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HSMd+QmbxzHR1cUPQk7XlTQz9rWS68ASE3ZhJaftQNrsWGEA7LEQoMchQ6fmU/OSL2Z96LUf2xt7gkWx4IQ3tFVhv7dbFpnwBT5JbhqyP/SZq3IhHhLNKdAf8LaqGYwSVXVKInPwM46NvIDirjTadbEVAFdntGk3YYZ/0bcLf9Stu9R8CWGoJ4Bd36+X9i22EM0OOi2IswPA6xuy+SdWR+/lcUF4utrRPzOYH935N5YGFsifiPZQGOcEeSfUPw3y+XCpwJPh6/GPjofGMroouFoFrW8+F2p7qvYSZDW5Ya/kNz25VUo9n7IPP1v0yEC7Ww/Kg8FQIMvJZjfhCmwHww== 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=u1j27tXk80XQR2BBUG7IwWACHzvJsYupHr+MO5wUL9sMGcu+JOymLqM/IoH8IWL4o3Z9Ma/jSE6fyL2pZifOcPX64XC2D7UhFb6da+YdwfQM9krPfdoCOxccA+TyO3VhHFB3PTl69eRJqFVFFvZs+JQA1Yw++6lCPGDttPUuuRBL6dJlebuI461e0MbGwzDbfrrs4XMagIDu79jkbw6HcswrmYUFtsPybPCJQ1c9PVJmrbU34t/Z2OKUQTPJmTEHk6h6O35OL0GXrg5mcb+fXXdVvfd0V3bNuf+jBNTj30//RIDDHH/RSv/PwPrW5xYfRu3N0dlS8E775EFOC3pYeA== 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=rvUaJ6102i8PJSx0+iAlPhSm5yF+OViYAW1vnte5KjlMDJ9FgqEVjgIhUeZ5ER6nZPCdr2uKovY+ltPtBFaDDiMNLleDuEEt2C3R+H8XRbNRn3053QSWzojKEnZ7xnBNQ7E5Me/OuKEtqFYBa4dTHxTHeOgL6QnauuSUhsFmOT3eUxRwUcQO/YsBmeJyLvFdppxGii7RjR1+vVd6Ibb1CU7pH4BjKw0NCDk0lfMwnSIRFjae7Q/3jV8ODY8BLh5mdC+xQu/SpJAqHnKoJ7tuUM8HVHpjBmkguxyFDk/v+lWMQM3rVTcBGWPN49ekgBZ33vFLlhvgu6fS3VAx0TMBuw== 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 DU0PR08MB8256.eurprd08.prod.outlook.com (2603:10a6:10:410::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Fri, 20 Dec 2024 11:26:25 +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.8272.013; Fri, 20 Dec 2024 11:26:25 +0000 From: Stefan Herbrechtsmeier To: bitbake-devel@lists.openembedded.org CC: Stefan Herbrechtsmeier Subject: [RFC PATCH 01/21] tests: fetch: update npmsw tests to new lockfile format Date: Fri, 20 Dec 2024 12:25:52 +0100 Message-ID: <20241220112613.22647-2-stefan.herbrechtsmeier-oss@weidmueller.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220112613.22647-1-stefan.herbrechtsmeier-oss@weidmueller.com> References: <20241220112613.22647-1-stefan.herbrechtsmeier-oss@weidmueller.com> X-ClientProxiedBy: FR0P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::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_|DU0PR08MB8256:EE_ X-MS-Office365-Filtering-Correlation-Id: 412751f3-9efc-4887-3d59-08dd20e92312 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: CDv0kHn4W5CgaDnmynLTTBxz9yz1YHMHJHkk8JzFwvue7wv8FM6cSN/YCHpA3sz47YBgxe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b+L+HGZhgKm1LIKxjBf4XCrc8dS5g6Fc7pIGWUFFqQ19XzFFnypNCdFjgSEWG8XiinyEEBdd6JS29Fp+tx4zeX0705QqDvb2PQB/UuIyBxB16FyxW+f/Ap23Qe8zLxh9l3izUGy/RcSyLHWKx+Yav0xBWWsuhAkTEV95nqGK73KsizJrStmkDI9k9JZ9IqNo+jbzs1i+y/dlUoNpCz/nDoygl0nxlTgrKUi/7aYt1oHOKDSSmHg5Fq+A7JEqYGVzsvTUW9vgr/NoohVBrcg== 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)(366016)(52116014)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zKXgLSFdqAd4DXgqm2co+jDFq5GFX5L4pH5HpC5GFt48mYAE836vudmGDNh/RqiXYYf5q/XtwLk2JXHNNPL7kHxlEF/bYnXcjef8lwOxIzJUKCfsE2hCuK03isArAu3jgf8dSMXRHpfnqpL3eMw3EAo8SL3zjDSxXdH6lKZuYGbbjjZCNhc1uRtlmslonjNbRK/JhvhUULtGDLkfkvFQNTIHu/vDERAkQkVqQiPqlVUewIwQsCkygSbFnWplypVyqXxZpKwV1CY6GeEZyoaJusHakNpmAemQ3dPaaOhPTdewSac2ReOgSKoUt//DPJmTPADVlX9vuTCyXMhd5UXU8A1g/yswSzhYjNAJ3LMZsWsoMUjezHr/6o6+vpNyAPoW5O4VU7paErwenx9wcecjHwaNpWBW/u7xDIYuxXnWAMiHBfaSXu6KICL6asr5sJ7eXxV/nn5OoSAEiXRJ4hoP7w/f/J0tQ59gn16x9KEEmusgCHCQqjemjSTVHyO5xk1NDovM7VTb73X+TH5B42rontQ69VDuqB0yKo8IrCDtheGyQsunHc1Nv1+/6uuCTNT+0Ehph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Tenant-Network-Message-Id: 412751f3-9efc-4887-3d59-08dd20e92312 X-MS-Exchange-CrossTenant-AuthSource: PAXPR08MB6969.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2024 11:26:24.5661 (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: KUtyVsNzbMkNt8wmTwHYqu6Ymixq+CJIxIyd+5NFbAve/+zxjLzPU0G5Sx5sdk/Y2N9qiPNhK5FLregm4N4Z/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8256 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 ; Fri, 20 Dec 2024 11:26:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16930 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):