From patchwork Fri Dec 20 11:26:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Herbrechtsmeier X-Patchwork-Id: 54450 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 7BCC2C3DA4A for ; Fri, 20 Dec 2024 11:26:41 +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:40 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@weidmueller.com header.s=selector2 header.b=NTrdkvnI; 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=KXlUIjGP2ZyO+zSLq0on+K2zqRZL96k2VR+OR+oFNXn7K4iAPnBUAV8+UR4gv9X05oXCn29c94Ma9YQCPKDG7nnwZ83M4J7CV0sGQQNMnJz5COU/eS/QBZCFXkiuMP9iCFizVJA1D3cLi18cvr1xuyYJoYlBO5vT17dD+5pKdHn95bUpwIigevpj0liCJWeQvt783ZaxB2a8BxgxBCzRc7g7FuKEI1hBMKKJCNsDEhqQn4A77wGUIHn76mIOGNv9Jn0pI63fpmkYkdLZLfAZzMzBlB7USoVFEcR48yCQweD/VymA8UUudSon0VAQ1epyekAYz8KNmYMhg5mSOZwiug== 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=eLENERgwmHO7EYBIoxAN9UBOjHA8RShHsMMjX0MMi1A=; b=o7LZc3E4EXKREJ+C4fVe2bNNwWWAiDt6cgQm/3Tr4ZKIBiJnsZxXOi6VJQzW/qOj/YeHBmBl8uhxhGeQeKUYs7GStxSes5RmgdtlGJBAYXOjJ8J39eR2qgAEkZMX5GXKoLCZe5oxQ9QtVsMxp9b6vFYoLdGf45ED5Lrzd+5R3P8Bpop3j/GC6qN0WG10FZwEsDMhMoFJFTxNG9h/XwtjKTM5a9KT0RYwQtz5PGYZ7oEV0gtNI4xGy8QktGR9eJCysytsPXZciPVw2rXmZVC1SA6sQdObL3/i6JtlZ7lkcEBpwgWyXE6pESFSu8NlI9HmJ/cmApmszpZWkMJQq5Bqaw== 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=eLENERgwmHO7EYBIoxAN9UBOjHA8RShHsMMjX0MMi1A=; b=NTrdkvnIyysR4PEliaM06auU36+y2BvftokwUJq2s4gIGwBnLzHCA0xbzIj/AecV/45Of6B5xVhgJ82gqhs4k/4kpMdVL7tpo+oP8CMmKgQTsmQSMf/GfDYZAEXrnz7PkwXvTpRlsjSRuVVn+kwg3IuUsa5auHty9zZ0Q7QJ3ZUNbYQmEW9/02lEwZ9PeArBGb92YV64a9YXZ8dGRI8GWdRKBoN874MfPzPFVDFLLskHVn6JrgXDlPnlcgnp0lV36wBhI7/cq96/TajnXJhnc3kL1JwoXtPy5+VH3T5Nmq+mni8hA66/6L1zowJX4SnD4vtHi608FcSU4LdKteBzjw== 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:31 +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:31 +0000 From: Stefan Herbrechtsmeier To: bitbake-devel@lists.openembedded.org CC: Stefan Herbrechtsmeier Subject: [RFC PATCH 19/21] tests: fetch: add test cases for gosum Date: Fri, 20 Dec 2024 12:26:10 +0100 Message-ID: <20241220112613.22647-20-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: 238f62ed-c9e3-4a4c-964e-08dd20e92683 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: 2alrcqpwAHmOyeKcHUxyRwBl372NEK0TeC5RTzBPz0/+wWtb0vOSVdN6zeqVDvcN/VsvrFiRdB7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gnahTgN61jzxqLgN+eg8W7v9zoMWyGGds3+pU1c/RrktMUzACVuiw8O7HURQA0rPMPgIRYEvGS79+IZ0sI2zPpjvgVGlcUoHScH4JM4XBBNQhqQsTV48qz4ZbZQcurHEdTk6otywTGwwTXpzJP5trcVhwYNsQqO9uiSCdtiuRZDKvC45MpQ3pJKan3y+Nlid8vhgdKOKXRTf/beBKOmntL4BMG9V4H89yNXUK+yFGYGSPA+t1ogDGTcS6AsD8hdz5dPh268Xqdulc2nbAg== 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: fWgw/y5eV4jeiR6Bnmev0xaM8U6/dV8IJfL8Dfbd21t1eptKONK1qdXO6m+sHWunxwmlWVj2aWUrMcsuF6jFr9fNVKnup/vYF7NRRll3z46GXk0uc4A6zuFGoGzldYneCFEAEGTqUbdL7n+dvD1ZEt2hbLoe23qUBofnmBv/VxjJ8kOT0Ye1+n5mQ3TJM9NGySMYGTNlXAWdFMZ/GNDbeIzCPncBEe3fbSOv5Dteh6Yz2HrN8JVcP7dalCzrzydFmZKRgDlaY2e0uMrbfW3DgAEDUFh+MMBI+9+BBPpQIU9yTh4uO1by7CP/G+rE4gNYnsF0DqwBMX3acOmfle16a7aHyoSQyqsCgC1XGQSi2D6fK5TdEX2ydSEIsP1tjzad7ggJO8ZkqvCpqnhK8bUAYk1OEvGMVZzEax00qe5zkkjBGG2j8llSiT2azffv0ZKbMK7ySXlumR8l9Q+PKFpOEabHyQTyLtzqq+0JiCUVRJVTsZazSQ2x8x2sD/0eZ5+p4sUmL6hceZyv3J3B2XQbgaxyvtTKX9CGSLsRBHhacFrfaHmVy2bEF7DGdQ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idmueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: 238f62ed-c9e3-4a4c-964e-08dd20e92683 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.3116 (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: krhEqhsGFuOs0+3lJWYyXwodt/ohXCBxO2iOpQGkXALV9iRV1XROCq2M8Zjel3YO+AYBFzL2FHx/nN+XUj1CTA== 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:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16939 From: Stefan Herbrechtsmeier Signed-off-by: Stefan Herbrechtsmeier --- lib/bb/tests/fetch.py | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py index 437571f1c..30c821a67 100644 --- a/lib/bb/tests/fetch.py +++ b/lib/bb/tests/fetch.py @@ -3439,3 +3439,59 @@ class DependencyTest(FetcherTest): self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "dummy/dummy.txt"))) self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "dummy/bitbake-1.0"))) self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "dummy/git"))) + +class GoSumTest(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_go_sum_file(self, data): + filename = "go.sum" + with open(os.path.join(self.localsrcdir, filename), 'w') as f: + for module_path, version, hash in data: + f.write(f"{module_path} {version} {hash}\n") + return filename + + @skipIfNoNetwork() + def test_gosum(self): + filename = self.create_go_sum_file([ + ( + "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob", + "v1.0.0", + "h1:u/LLAOFgsMv7HmNL4Qufg58y+qElGOt5qv0z1mURkRY=" + ), ( + "gopkg.in/ini.v1", + "v1.67.0/go.mod", + "h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=" + ) + ]) + fetcher = bb.fetch.Fetch(["gosum://" + filename], self.d) + fetcher.download() + self.assertTrue(os.path.exists(os.path.join(self.dldir, "github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.zip"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.zip.done"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "gopkg.in/ini.v1/@v/v1.67.0.mod"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "gopkg.in/ini.v1/@v/v1.67.0.mod.done"))) + fetcher.unpack(self.unpackdir) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "go.sum"))) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "pkg/mod/cache/download/github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.zip"))) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "pkg/mod/cache/download/github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.mod"))) + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, "pkg/mod/cache/download/gopkg.in/ini.v1/@v/v1.67.0.mod"))) + + @skipIfNoNetwork() + def test_gosum_git(self): + urls = [ + "gosum+git://github.com/Azure/azure-sdk-for-go.git;protocol=https;" + "nobranch=1;subpath=sdk/storage/azblob;" + "rev=ec928e0ed34db682b3f783d3739d1c538142e0c3" + ] + fetcher = bb.fetch.Fetch(urls, self.d) + fetcher.download() + self.assertTrue(os.path.exists(os.path.join(self.dldir, "git2/github.com.Azure.azure-sdk-for-go.git"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "golang.org/x/net/@v/v0.0.0-20220425223048-2871e0cb64e4.zip"))) + self.assertTrue(os.path.exists(os.path.join(self.dldir, "golang.org/x/net/@v/v0.0.0-20220425223048-2871e0cb64e4.zip.done"))) + fetcher.unpack(self.unpackdir) + 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")))