From patchwork Fri Dec 20 11:26:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Herbrechtsmeier X-Patchwork-Id: 54459 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 AC8C8E77188 for ; Fri, 20 Dec 2024 11:26:51 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.114]) by mx.groups.io with SMTP id smtpd.web11.149745.1734693993938884026 for ; Fri, 20 Dec 2024 03:26:42 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@weidmueller.com header.s=selector2 header.b=tlmbFOax; spf=pass (domain: weidmueller.com, ip: 40.107.22.114, mailfrom: stefan.herbrechtsmeier-oss@weidmueller.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AKpWZ9S+RH8ffwbOpm+XLckqb54pcZttJB9bf+WzHWX5Td8+5YBxhhS5H6n9nXKUwpBanLhobIUW/GmoxSsYEU2cIDIEodmas+fjhRjCSYCCY6NHxyHmO6Ea1ZVbo9yCIZh9TAZ+Ij8ikzMYu0rFbpgN+9LdwVUcOTcyKKv0G0ndEZt3WvaYyIIkOrIP0Pm2ACC3lBizAqW0CB0TMkrH6sFCMPEnM8y9Ss5PgSeZubeargpDRZgTaLkMbI+0TBNYI6mjaMcuT/Na/l5spkivbPIcd/X2FEFL6j/w3RwVfInG+r/CT8r0Ww+IdF/QhYFKYUUFxpoZVrVgb8Z9TWZOAA== 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=jusmXzbEL2xi/yTDZ7sX+cOybecyn5mJcQGTzq32W1c=; b=aW1oX1mb5z27nfjOqp+fELd8U1tTe9MEVlmEm8knoR83r0g0X7S7T57yB0v+12j/KbS7FcZEn/BDmr3Y5CgcQgHoWbE+Oll+Vuj+lVnDHLaytuH6HRJ2dV76HOaoERrYSqHaTyRU1Q13tQUZs77yInK2CPsaFRpNeZ4b2o91OIhaKt7C84Cd9G71Mxui0JwWmspPfr9aOwE/Mi/MRsmpl+NE1vjaYcZp3wba2I7KX1rECgbM5TsAZsG0WStcXkW2DUvJAUVF3ysaqJWOcpDLuuPmKo7PfpSy/Xcc3iiCUmLHWhujY3PUShtB0HbT7Dy5FTOQgrXahe3D5s+tYfGyrA== 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=jusmXzbEL2xi/yTDZ7sX+cOybecyn5mJcQGTzq32W1c=; b=tlmbFOaxqba8kc3XvyXtSTAk1dF3lJGCUtuuX/g5amNM2oZQOTnjFXS2AYKDfsxop+0hj7cw0/D2Uch2rY4jVjXLupriLanhv+BD1lVKZByAh4zU+/v/WGyHqrsnw00MppN3tJqLZhUH0W6Q1vmMP6kGi2/usMRP9oM/I9WpOZ7ssTB4bEUaMBm0Up6fExOrMoiS2SUuD4mJ8FiNz6o245ALcmJ62K7AgnfTR3sY3/8uO5T5m4xJYlRrD3MlMQqKFoLvAL+/aqr1URUQMh2/qRu4f7OSIL/sFxGI59d+x6AiYiO0KP1vhidAJMnhObYNMyyo2GyaxooJ/NzhkJrGeQ== 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 AM8PR08MB5684.eurprd08.prod.outlook.com (2603:10a6:20b:1dc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.16; Fri, 20 Dec 2024 11:26:32 +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:32 +0000 From: Stefan Herbrechtsmeier To: bitbake-devel@lists.openembedded.org CC: Stefan Herbrechtsmeier Subject: [RFC PATCH 21/21] tests: fetch: add test cases for cargolock Date: Fri, 20 Dec 2024 12:26:12 +0100 Message-ID: <20241220112613.22647-22-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_|AM8PR08MB5684:EE_ X-MS-Office365-Filtering-Correlation-Id: f168832f-9c2a-478f-6295-08dd20e926de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: Z/k0wDjBgto+yCzQKdYxcFkbGEszZUGc5Gm9TZZC0pPdoKJoOXDhH9uDagA+BwGqHiG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3GRK49VZ5ZJ5FoUGrnUTyjCV5ovRx51k5XcaK4HadKPm3mocVm7HcPCa8PVDR0ohHhcHvLqxOgaM/TE+4p1UGrPcMc5j2fayVyLjLXnsB3d8/542yQu9drvPJ7ReNp7ABh10dwfY1UXQJtgWOkw1+niyjszVwZKr2qiWFlC98/RszY5ceg1Dk76vwkJTd6MpqGFGbqC5lxBFZA0LaKx+HWTpejP50fBbLpwDgXuNWb/op8RzgA8EPUZPVQv2q0/T3schLQz6D9WLTUPZAgwHV4Pw== 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)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ETcggvnqcTVs7/tP6MYXjhFTZyDYRIQBvSZ90GHrYFpK8kG6DXV06u2m9cNvrhpNlPoH4xL4KcAW8I5QKtq4FHuQU4LquiTCIw4eVeuaDl9U9GXs0SlHdb829yP/srkTverNSBiz3j1SHreQ9p2Vxu7OZi3m3M/pXWtsVA0hxX1QgMLN8cVxTJojrCVJH26cgSr9nSsr87yGsfoo0UXXWVSBECpeP8BPnMs4YTqRJC/Hr0oxyBzLv5ezLrF8AC0le7NUPBOA3ejs4vZJGLGPngujt9X3I9gdH4Xap/sczTLcjZqqwpUOtw57ir7Nvgpp4FvbsTpp9c3ZqEgrsuwc+QcSiUk0giBSmfeefaFkWxmDX9c5vJKjMu5Vubxr986s2glg1dRVPnrpR62GNFzp3TsFDFAIcWIrH8Nr4jD4kZOg+j2HPDC1frlV3T/cyfm31FwYXIo6pn7rvf3SSDSvZWjACYE6W43asUg0D8fPrBCtXadV1vdSGZmWmKrtqwgLnoRwPo5DM0O7urGbD+JiY8YhkEU0EG0kVYmLb1kjjVSDOvMotuaONYp4Wg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mueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: f168832f-9c2a-478f-6295-08dd20e926de 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:30.8972 (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: sQ+d3w/ACy0LdfLBBYxq0mjCdHgbnQ/5kfNC03MsUFi/vur6h+uzf3Itt3AyqafNhav1MRx2zW6tf0jUd8jS4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5684 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:51 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16941 From: Stefan Herbrechtsmeier Signed-off-by: Stefan Herbrechtsmeier --- lib/bb/tests/fetch.py | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py index 30c821a67..37146c087 100644 --- a/lib/bb/tests/fetch.py +++ b/lib/bb/tests/fetch.py @@ -3495,3 +3495,78 @@ class GoSumTest(FetcherTest): self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "azblob/go.sum"))) self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "azblob/pkg/mod/cache/download/golang.org/x/net/@v/v0.0.0-20220425223048-2871e0cb64e4.zip"))) self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "azblob/pkg/mod/cache/download/golang.org/x/net/@v/v0.0.0-20220425223048-2871e0cb64e4.mod"))) + +class CargoLockTest(FetcherTest): + def setUp(self): + super().setUp() + self.localsrcdir = os.path.join(self.tempdir, "localsrc") + os.makedirs(self.localsrcdir) + self.d.setVar("FILESPATH", self.localsrcdir) + + def create_cargo_lock_file(self, data): + import tomllib + filename = "Cargo.lock" + with open(os.path.join(self.localsrcdir, filename), "w") as f: + for package in data.get("package", []): + f.write("\n[[package]]\n") + for key in package.keys(): + f.write(f'{key} = "{package[key]}"\n') + return filename + + @skipIfNoNetwork() + def test_cargolock(self): + filename = self.create_cargo_lock_file({ + "package": [ + { + "name": "regex", + "version": "1.4.0", + "source": "registry+https://github.com/rust-lang/crates.io-index", + "checksum": "36f45b719a674bf4b828ff318906d6c133264c793eff7a41e30074a45b5099e2" + }, { + "name": "regex", + "version": "1.5.0", + "source": "git+https://github.com/rust-lang/regex.git#9f9f693768c584971a4d53bc3c586c33ed3a6831" + } + ] + }) + fetcher = bb.fetch.Fetch([f"cargolock://{filename}"], self.d) + fetcher.download() + self.assertTrue(os.path.exists(os.path.join(self.dldir, "regex-1.4.0.crate"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "regex-1.4.0.crate.done"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "git2/github.com.rust-lang.regex.git"))) + fetcher.unpack(self.unpackdir) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "Cargo.lock"))) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "cargo_home/bitbake/regex-1.4.0/Cargo.toml"))) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "cargo_home/bitbake/regex-1.5.0/Cargo.toml"))) + + @skipIfNoNetwork() + def test_cargolock_https(self): + urls = [ + "cargolock+https://download.gnome.org/sources/librsvg/2.58/librsvg-2.58.2.tar.xz;" + "striplevel=1;subdir=librsvg-2.58.2;" + "sha256sum=18e9d70c08cf25f50d610d6d5af571561d67cf4179f962e04266475df6e2e224" + ] + fetcher = bb.fetch.Fetch(urls, self.d) + fetcher.download() + self.assertTrue(os.path.exists(os.path.join(self.dldir, "librsvg-2.58.2.tar.xz"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "librsvg-2.58.2.tar.xz.done"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "adler-1.0.2.crate"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "adler-1.0.2.crate.done"))) + fetcher.unpack(self.unpackdir) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "librsvg-2.58.2/Cargo.toml"))) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "librsvg-2.58.2/cargo_home/bitbake/adler-1.0.2/Cargo.toml"))) + + @skipIfNoNetwork() + def test_cargolock_git(self): + urls = [ + "cargolock+git://gitlab.gnome.org/GNOME/librsvg.git;protocol=https;" + "nobranch=1;rev=ef5c94d8362c35573d7eb651cf9a07c6df9df6da" + ] + fetcher = bb.fetch.Fetch(urls, self.d) + fetcher.download() + self.assertTrue(os.path.exists(os.path.join(self.dldir, "git2/gitlab.gnome.org.GNOME.librsvg.git"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "adler-1.0.2.crate"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "adler-1.0.2.crate.done"))) + fetcher.unpack(self.unpackdir) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "git/Cargo.toml"))) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "git/cargo_home/bitbake/adler-1.0.2/Cargo.toml")))