From patchwork Tue Sep 16 21:19:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 70382 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 D7CFBCAC5A5 for ; Tue, 16 Sep 2025 21:19:47 +0000 (UTC) Received: from AM0PR83CU005.outbound.protection.outlook.com (AM0PR83CU005.outbound.protection.outlook.com [52.101.69.30]) by mx.groups.io with SMTP id smtpd.web11.7529.1758057585467794402 for ; Tue, 16 Sep 2025 14:19:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=ph7FTQiD; spf=pass (domain: axis.com, ip: 52.101.69.30, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IctoQaW8/jzAOrROshBv/Y386C+b6OJeesXa97j2PYogUd9lk/tmneJk5QaiXEyGVD5YXMYJ8ZRN/bhdCzNBMzwyeKWWcLEsf0QrQHSXNqakNE4MAs/weiWPz1NT4Wki+Tjbp31aIzTfarpc2JLfG3aMklj+KZo5nFP6DQvMULjCoyVXuEA5xZxJNyfkTiPFM5XX6yuTuVFyNMQRVT5c1hvKz3ptjVTfaqvuiQdcqkYxjcNECqa/TtS/NkJMQzsOMTEH5MAhJH3thwMqf1Cz8cb37rOlhgNDfkRFHxIoqFHW89vWtjQE+qBPoMSumnzJ3vlpnRAU6X+CCGs13J0JNQ== 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=tMCKCMlXpKpisLfyzcRYyjTLoUgGiIy++iItjM7qSiE=; b=slR9RmYlIwAiJumZigoT+vcstVElGerXBJniYMGS7NbnN6KynuWH0dl8trqOWEsMxXzx4El6NjMNN13+8PfTSS9e9f2/8iWxF8VQuLVbhy9AFzZcW1wI9wCNt48wM8knROzp5pO/GCZA0zRGiwmdk6KPaShDuzfdI5ihXjFqxGCdy4z8DytWGicLrH+kJBSKYeop5Vg4CTjPXbNclmecjYvZk5iYIgxe1Y9XKEuz61gXb1VyYuJOQJ/+4rJ4aLvHJ7jEZrgO6ICo5p0G0kGgKu9i8TRM26TQREuDrG38eeIy0oGyqdMFkvxTVvq9RRagukHJnMEKkoWMU0o5taa5+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tMCKCMlXpKpisLfyzcRYyjTLoUgGiIy++iItjM7qSiE=; b=ph7FTQiDwsqz1cwWqjVpC2B3ezW1avueO6eZFdKaLE4agvdPbKf1ok1kSo2SdaCPuVLHw6g/D78ojfZlnL1OCHHEmUXqYCCHJ+y61nmZTLPbX/PxqOTk6TZk4/qxwqqdeOXDBJX9HiNFwBm6zgF8xN/9jpZAl/zUFAbQhzRJYTI= Received: from AM4PR0302CA0035.eurprd03.prod.outlook.com (2603:10a6:205:2::48) by AS2PR02MB9906.eurprd02.prod.outlook.com (2603:10a6:20b:609::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.13; Tue, 16 Sep 2025 21:19:39 +0000 Received: from AMS0EPF000001AE.eurprd05.prod.outlook.com (2603:10a6:205:2:cafe::aa) by AM4PR0302CA0035.outlook.office365.com (2603:10a6:205:2::48) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.22 via Frontend Transport; Tue, 16 Sep 2025 21:19:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by AMS0EPF000001AE.mail.protection.outlook.com (10.167.16.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 21:19:39 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Tue, 16 Sep 2025 23:19:38 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 16 Sep 2025 23:19:38 +0200 Received: from pc56063-2339.se.axis.com (pc56063-2339.se.axis.com [10.92.3.2]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 111FB5D0 for ; Tue, 16 Sep 2025 23:19:38 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id 75D5112024B; Tue, 16 Sep 2025 23:19:37 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv2 1/5] tests/parse: Use with statement to avoid ResourceWarning Date: Tue, 16 Sep 2025 23:19:30 +0200 Message-ID: <20250916211934.253650-1-pkj@axis.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AE:EE_|AS2PR02MB9906:EE_ X-MS-Office365-Filtering-Correlation-Id: 617e63c1-ec09-43ae-d15c-08ddf566bebb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: 7yB0+DZ3FZENwhOHU3T1vN7jjRGhd3vxdSy1qksaJzYRuHM971KiQwe7O0CtXwFijvPoajXroa1rMsdBBN0K80QqSpxaaU7XYcBRcbZ82Lnilu7UE9KBrxyTeOo6rH+5GfZcfkSNGeqrRzYXg/NkJcqCfhA0NCHoSwfl6CElO46WuATLHbNhAwBLPxMmp1z/PqPfdD29t6KgQMI8IyoFERHKT+O5W/GbCTFFmVjIzpYtIU9wPDeX/utdLNtTOfhMkPlzYZJrMMPrkEGpNrXgI2++gO8bWXsx0deVN8Cl5ld9BwKgcLkcL24gPycwYQ/kFYVbeJBrvHMPHgeP8ktzfqqCd1yzkYeOmmWKBsL5o6qQHkZ0QKphInYDKm5kw9TVLjNL/+JN0RmE9jdcViKtoQEBTRpQjR9KxRc/T5Qp5kcMzsn5F0/85ri/g3dYKwf705WuAPlmDTiw879KGoOqnQaQjNW/M+PJWLJvESrZejmX4y8eO5bt+jgY6QQggEd4BtOBYOucTloc+J66u7bcjpbhzePXa/p/uyrZ9ykdjfcRmgMjyRjvkrHTZzEbp8dNVtjigVvM6VzZx76/lDQ9BdT9kpcX+lFk0240BNgqKYaEYgoJGqo9m6x3txR3mjPfnxq6Sax5ZqizzxlgjZYmkq1NSe+39IUIkHjxFul5Uks01NHs1Dw3deBaEMuT5wJsXBjahg9h7ZfSi8sTqJzuCTWSgmDybHH4G796EsYKmymPiCA5SzwqahA5NiiJbzUqmBxMS/3S45zf7+lgv9yyyfT9O05NJ28PocVKOD0j6GidAtEfe8wPGRGzIRcq5mvE7rpkOfmsg61nCwMsyw3KgmOwhijhiit/zNaJCEQdlEW3nYdKL9aTfH6+n9y8fdChYM0KSlae0ymZbSVwy+8562kHnegRaT4EuWX6SuwJG8nkwnp+A4WbFxvJS1fMvU3ceMNkKB+A/HoQDbOJikrT3AvqdkGKtkT4VspgyRRiMCVSYLLUAcB4IGTOvFqLH1nzZd7z8r/fNSB8jb3Pqg78H+wIAyr5WuQ+KZLinpYPUy8TceCD9RtpXizTfxQw67sAQEAHh0IyqAVinDmQjH4SswWeLDXd3nBD3YWJVoPeCGtbphz+zyLv3QTjR1cHR96pWwEuvIlR9QQoqFQWAfAyJ74fJWgA7U+XKEnQTtNGXMZLI/7sgK3Jtz6dqoovCKnM3n0tAjqVkakWqF4WwaU5Ei5ek4hE+BmfPthVKSfEBxxCcTHxUGEZuzA+ss/cDWED/U0NNMAzyg+6PXVV9kVRE+26Pj7ee+XW2m8KTQLeObTkvb8/LRvGK5HDNQjpSANJZ5fXlbs754XT+YPCAtoZiMR3acVitT/vIbC5uPQIwZvd9Gwa7UGlGicQ0B6PU4JqPbWgpNsRsrZ4WuEoxpFphMUJr64831dTaYdT2JSJ0K1N+cTV93Lk7kFnJuDmMh9daCb7Z2L4Mt03bHxp0erbsM4L0/wLtF3I1m9XzugLNbPQsWlIyaOFNkF8i9Yt48lA X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2025 21:19:39.1515 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 617e63c1-ec09-43ae-d15c-08ddf566bebb X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001AE.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR02MB9906 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, 16 Sep 2025 21:19:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18046 Signed-off-by: Peter Kjellerstedt --- PATCHv2: No change. bitbake/lib/bb/tests/parse.py | 95 ++++++++++++++++------------------- 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index e3cba67ad4..b272739f56 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -39,7 +39,6 @@ C = "3" os.chdir(self.origdir) def parsehelper(self, content, suffix = ".bb"): - f = tempfile.NamedTemporaryFile(suffix = suffix) f.write(bytes(content, "utf-8")) f.flush() @@ -47,17 +46,17 @@ C = "3" return f def test_parse_simple(self): - f = self.parsehelper(self.testfile) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.testfile) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertEqual(d.getVar("A"), "1") self.assertEqual(d.getVar("B"), "2") self.assertEqual(d.getVar("C"), "3") def test_parse_incomplete_function(self): testfileB = self.testfile.replace("}", "") - f = self.parsehelper(testfileB) - with self.assertRaises(bb.parse.ParseError): - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(testfileB) as f: + with self.assertRaises(bb.parse.ParseError): + d = bb.parse.handle(f.name, self.d)[''] unsettest = """ A = "1" @@ -69,8 +68,8 @@ unset B[flag] """ def test_parse_unset(self): - f = self.parsehelper(self.unsettest) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.unsettest) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertEqual(d.getVar("A"), None) self.assertEqual(d.getVarFlag("A","flag"), None) self.assertEqual(d.getVar("B"), "2") @@ -113,8 +112,8 @@ A[flag_default_twice] ??= "default flag first" A[flag_default_twice] ??= "default flag second" """ def test_parse_defaulttest(self): - f = self.parsehelper(self.defaulttest) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.defaulttest) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertEqual(d.getVar("A"), "set value") self.assertEqual(d.getVarFlag("A","flag_set_vs_question"), "set flag") self.assertEqual(d.getVarFlag("A","flag_set_vs_default"), "set flag") @@ -136,8 +135,8 @@ exportD = "d" """ def test_parse_exports(self): - f = self.parsehelper(self.exporttest) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.exporttest) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertEqual(d.getVar("A"), "a") self.assertIsNone(d.getVarFlag("A", "export")) self.assertEqual(d.getVar("B"), "b") @@ -149,7 +148,6 @@ exportD = "d" self.assertEqual(d.getVar("exportD"), "d") self.assertIsNone(d.getVarFlag("exportD", "export")) - overridetest = """ RRECOMMENDS:${PN} = "a" RRECOMMENDS:${PN}:libc = "b" @@ -158,8 +156,8 @@ PN = "gtk+" """ def test_parse_overrides(self): - f = self.parsehelper(self.overridetest) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.overridetest) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertEqual(d.getVar("RRECOMMENDS"), "b") bb.data.expandKeys(d) self.assertEqual(d.getVar("RRECOMMENDS"), "b") @@ -173,8 +171,8 @@ EXTRA_OECONF:append = " c" """ def test_parse_overrides2(self): - f = self.parsehelper(self.overridetest2) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.overridetest2) as f: + d = bb.parse.handle(f.name, self.d)[''] d.appendVar("EXTRA_OECONF", " d") d.setVar("OVERRIDES", "class-target") self.assertEqual(d.getVar("EXTRA_OECONF"), "b c d") @@ -186,8 +184,8 @@ PN = "bc" """ def test_parse_combinations(self): - f = self.parsehelper(self.overridetest3) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.overridetest3) as f: + d = bb.parse.handle(f.name, self.d)[''] bb.data.expandKeys(d) self.assertEqual(d.getVar("DESCRIPTION:bc-dev"), "A B") d.setVar("DESCRIPTION", "E") @@ -195,7 +193,6 @@ PN = "bc" d.setVar("OVERRIDES", "bc-dev") self.assertEqual(d.getVar("DESCRIPTION"), "C D") - classextend = """ VAR_var:override1 = "B" EXTRA = ":override1" @@ -218,15 +215,15 @@ python () { # def test_parse_classextend_contamination(self): self.d.setVar("__bbclasstype", "recipe") - cls = self.parsehelper(self.classextend_bbclass, suffix=".bbclass") - #clsname = os.path.basename(cls.name).replace(".bbclass", "") - self.classextend = self.classextend.replace("###CLASS###", cls.name) - f = self.parsehelper(self.classextend) - alldata = bb.parse.handle(f.name, self.d) - d1 = alldata[''] - d2 = alldata[cls.name] - self.assertEqual(d1.getVar("VAR_var"), "B") - self.assertEqual(d2.getVar("VAR_var"), None) + with self.parsehelper(self.classextend_bbclass, suffix=".bbclass") as cls: + #clsname = os.path.basename(cls.name).replace(".bbclass", "") + self.classextend = self.classextend.replace("###CLASS###", cls.name) + with self.parsehelper(self.classextend) as f: + alldata = bb.parse.handle(f.name, self.d) + d1 = alldata[''] + d2 = alldata[cls.name] + self.assertEqual(d1.getVar("VAR_var"), "B") + self.assertEqual(d2.getVar("VAR_var"), None) addtask_deltask = """ addtask do_patch after do_foo after do_unpack before do_configure before do_compile @@ -250,10 +247,8 @@ deltask do_fetch ${MYVAR} ${EMPTYVAR} deltask ${EMPTYVAR} """ def test_parse_addtask_deltask(self): - - f = self.parsehelper(self.addtask_deltask) - d = bb.parse.handle(f.name, self.d)[''] - + with self.parsehelper(self.addtask_deltask) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertSequenceEqual(['do_fetch2', 'do_patch2', 'do_myplaintask', 'do_mytask', 'do_mytask2', 'do_mytask5'], bb.build.listtasks(d)) self.assertEqual(['do_mytask'], d.getVarFlag("do_mytask5", "deps")) @@ -263,10 +258,9 @@ deltask ${EMPTYVAR} """ def test_parse_broken_multiline_comment(self): - f = self.parsehelper(self.broken_multiline_comment) - with self.assertRaises(bb.BBHandledException): - d = bb.parse.handle(f.name, self.d)[''] - + with self.parsehelper(self.broken_multiline_comment) as f: + with self.assertRaises(bb.BBHandledException): + d = bb.parse.handle(f.name, self.d)[''] comment_in_var = """ VAR = " \\ @@ -276,10 +270,9 @@ VAR = " \\ " """ def test_parse_comment_in_var(self): - f = self.parsehelper(self.comment_in_var) - with self.assertRaises(bb.BBHandledException): - d = bb.parse.handle(f.name, self.d)[''] - + with self.parsehelper(self.comment_in_var) as f: + with self.assertRaises(bb.BBHandledException): + d = bb.parse.handle(f.name, self.d)[''] at_sign_in_var_flag = """ A[flag@.service] = "nonet" @@ -289,8 +282,8 @@ C[f] = "flag" unset A[flag@.service] """ def test_parse_at_sign_in_var_flag(self): - f = self.parsehelper(self.at_sign_in_var_flag) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.at_sign_in_var_flag) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertEqual(d.getVar("A"), None) self.assertEqual(d.getVar("B"), None) self.assertEqual(d.getVarFlag("A","flag@.service"), None) @@ -299,9 +292,9 @@ unset A[flag@.service] def test_parse_invalid_at_sign_in_var_flag(self): invalid_at_sign = self.at_sign_in_var_flag.replace("B[f", "B[@f") - f = self.parsehelper(invalid_at_sign) - with self.assertRaises(bb.parse.ParseError): - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(invalid_at_sign) as f: + with self.assertRaises(bb.parse.ParseError): + d = bb.parse.handle(f.name, self.d)[''] export_function_recipe = """ inherit someclass @@ -453,13 +446,13 @@ A+ = "b" += "d" """ def test_parse_special_character_assignment(self): - f = self.parsehelper(self.special_character_assignment) - d = bb.parse.handle(f.name, self.d)[''] + with self.parsehelper(self.special_character_assignment) as f: + d = bb.parse.handle(f.name, self.d)[''] self.assertEqual(d.getVar("A"), " a") self.assertEqual(d.getVar("A+"), "b") self.assertEqual(d.getVar("+"), "c") - f = self.parsehelper(self.ambigous_assignment) - with self.assertRaises(bb.parse.ParseError) as error: - bb.parse.handle(f.name, self.d) + with self.parsehelper(self.ambigous_assignment) as f: + with self.assertRaises(bb.parse.ParseError) as error: + bb.parse.handle(f.name, self.d) self.assertIn("Empty variable name in assignment", str(error.exception)) From patchwork Tue Sep 16 21:19:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 70379 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 C8529CAC59D for ; Tue, 16 Sep 2025 21:19:47 +0000 (UTC) Received: from DU2PR03CU002.outbound.protection.outlook.com (DU2PR03CU002.outbound.protection.outlook.com [52.101.65.33]) by mx.groups.io with SMTP id smtpd.web11.7528.1758057584471179722 for ; Tue, 16 Sep 2025 14:19:44 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=JpDW/cdd; spf=pass (domain: axis.com, ip: 52.101.65.33, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xylA8HFZO4jKBlZ8/WxwrEVgYqZcS8PoLEGYY+9oTi6R6Htlic2/CzmM+KC37htkimDswlJX3BNwn5+9MRqIv/PeFH9Csyj1byJxkLGX1Gf2pmIeLew4gF6HYJAo/APzxIIT6PxgVlbEU8h1Ta1lrwyPRdGCjHY6BlEyuUPfeNTx+MoXJ56oJ/jJV+QtT7vAI1jiI5lWndNTxyDmfV3UORP/Zt9Ag+pxP2FBZPDNkkn2RNMu+sIEc7gECh2ZECihFREqxOd8bKla70S5woFfg8bFimt6jEqsk1Dcn7Ht0u7aYn4MTQWV/6JVKkvwSJC+UB5KUy/s+WtSEAsK04hxGg== 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=UebvSnGRT0LhWAbTqPt5hGk3DaiazlT/x2kSWBp+mQ8=; b=wvIdd11gZfE8ROxJkuWyE8BRHfDMkra8UKWyO6isPo51XbWos2VkoDtVZv7Ze8va9oiGxbdKjD+3VCRYg4xHPrYFesTT6IR5fWUrVxscPXm9SiFRhByGDnrDS9yGfV/UND7yaS3ubHwdrJh/7RW+upBblKkhqaCfNycPc8FVFzWzvw3yVjVHhvf7tsyAvm0dy6RUQvkSalWg6l3otcXVYkAgWKcZ+A9tTSqIJbVQhG1jDt1ugY0K9VRxNFyet4AM+TMTLHhJq8hGJ2qOY213c1zjf09mk4IdgNf/iN6/+iadn6Ixm/mILhEJXLeEvPCPknyFZYW1998Z4zZLWnCSJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UebvSnGRT0LhWAbTqPt5hGk3DaiazlT/x2kSWBp+mQ8=; b=JpDW/cddRbqzp2ZMUEgEvK4500vBlnyU57+oeYmuwNEv9RGepuQBf178qokVzvCdbtPVQ4Bclwfx9l9uHS2kXpXxV9vuXSBtVCcNTiio/zbRwC6ZjHwpy4wMgiU6SLTjNIzBUcMFVQb9FOuJKfiS13y/I8RRH4/R56U3qu3YK8Y= Received: from AM4PR0302CA0018.eurprd03.prod.outlook.com (2603:10a6:205:2::31) by DB9PR02MB6762.eurprd02.prod.outlook.com (2603:10a6:10:1f8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.22; Tue, 16 Sep 2025 21:19:38 +0000 Received: from AMS0EPF000001AE.eurprd05.prod.outlook.com (2603:10a6:205:2:cafe::73) by AM4PR0302CA0018.outlook.office365.com (2603:10a6:205:2::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9137.13 via Frontend Transport; Tue, 16 Sep 2025 21:19:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by AMS0EPF000001AE.mail.protection.outlook.com (10.167.16.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 21:19:38 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Tue, 16 Sep 2025 23:19:38 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 16 Sep 2025 23:19:38 +0200 Received: from pc56063-2339.se.axis.com (pc56063-2339.se.axis.com [10.92.3.2]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 12525290D for ; Tue, 16 Sep 2025 23:19:38 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id 785791200CB; Tue, 16 Sep 2025 23:19:37 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv2 2/5] tests/parse: Remove unnecessary calls to file.flush() Date: Tue, 16 Sep 2025 23:19:31 +0200 Message-ID: <20250916211934.253650-2-pkj@axis.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250916211934.253650-1-pkj@axis.com> References: <20250916211934.253650-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AE:EE_|DB9PR02MB6762:EE_ X-MS-Office365-Filtering-Correlation-Id: 131345a3-b2a8-42a2-0ae0-08ddf566be51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: HAAAudp1GNtFQMgeC3z2rjA3dh2JO+LKgcJ02vfOhLhs1JkCr9BfVzLA9ki+jtje3u5+Q44Z52JC8A4lzUc82hD32Xb8/mMplXGwpYZioCOEBd1jftSjr03DUVxFscn+qdkwHq7pe1NjdDlaViIxwbbxY0QefjGa/ON0K/vmYSrkdnANVKDSi7q5eddoTNABYP5ym6A9ydlFs43yd6YtfY1He/GKZ1GcxE4NrpM6KjEbFCFtssQq5jCpU49MW247OWpgtrYWTT59BwTNpdS/coiVym3XvKCZLw17Ttsr5j39QaYLl29CoDzwDtrfnTzhmB/QSXAXVK+Qgc/KFyRZE/TZrAsZOuGVH27c+ASGxhx4cSIxx3vXYEcEUV3T0LaJXABW2lImgRUCS35Xpvhy11xnoDdkvOaKwWL6l50Qr4jkry9qEFykaK3z+5YU6dK+PQF085S2COf0E1tbn6J5WFAJf1d35xhGesyitjJoibQf9DTCSNjDyoUG5PZYnjIFJEr5Bca8wm5Hu9bnruIA+igTwqKRc486l2CK+Gryf9CQU6aknVfYSImf1LWfxVn23EBNvYSLS3UFr0oK8Wd9ykSG1OMJ2IziarOgd6b+6Udw9W4QSHkbUgLTmtPbbA8kVAcnO7wFEW6SWnJlNCVf4RNAor0ahstjd2tXciJOLjMbspCAsUpJZKG4VeBfEB0JnHSyoPNg0iJp5auY6o0ve9BPnPYzafIhCIjpjnFwdOKkEqGPUDSkgJZuTmnHF+/nUY3THiogkBk4KflDXNpW0odXn+v7Y8+MZgaHg9Cncvfm5MpVXBtJZ2ZrULd36P0mFDQC6EQOkU9nIhteHCb3eBrwdhrHHg08ITZibwUF0ZdCDwwAuwYrvvzlCNzGcrGZkoGxwgvk+ACpNJKy42FRfdhRMQqmVjCenKNnI1EC/5hOJ/V5w7/C54/Uux8oxOwekdmIbaaZvGZD+617ZGH1xEgzRNG4dxdBuDxpwPYkHKP3SDgt1bS+VRqsiAiN6ke4LjeXz3z3i69lmIJXHNDgi4WiSrnXS2pMYbXnJbj+A08QNClwP8GsTxHg7AacK8afF5j2uarU0tQtmB89d3hlAOGvTBAkTUiEWx5JC4EK36XvOOmSYshAjKEMZ9VMtTVls4C1szwlU0FUwS9G4n69WpyOIIOSL5/k9dcWaOM+RKz7aVtAk5362twDKbmAFlCKV36W8JaE3UYdp7aKU0SBrWmCTdEELBIaWGAR+TBDy80hKkbLbjXMHDbaFvfCDelCHDjL0G6H2whagjSOiGB2d12AAOscLfTNuvyrqv1H+tnzvIMOzZwEZ/tyY84uOY7HA1NJmiiviBGJdplTjyAoaTuF0tl5/LAKRxwS5z9GNI+w+FA4pweSm3eJj7eyhtuzUo7juQsizh9nJAxPdneJt7dRD6/LqNMwO2085LrL9BgSAYBiMs8C7hec+QBhhFAQ3WqHBAxSD8haePYQsv53Ec45Na57sBsCtUSJFCj1de31cPEhzpwg9uFi4002YVr2 X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2025 21:19:38.4501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 131345a3-b2a8-42a2-0ae0-08ddf566be51 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001AE.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR02MB6762 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, 16 Sep 2025 21:19:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18044 There is no reason to call file.flush() as the last call within a file context manager since ending the context will close the file and thus flush it. Signed-off-by: Peter Kjellerstedt --- PATCHv2: No change. bitbake/lib/bb/tests/parse.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index b272739f56..431b0c7d3e 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -349,14 +349,11 @@ EXPORT_FUNCTIONS do_compile do_compilepython os.makedirs(tempdir + "/classes") with open(tempdir + "/classes/someclass.bbclass", "w") as f: f.write(self.export_function_class) - f.flush() with open(tempdir + "/classes/secondclass.bbclass", "w") as f: f.write(self.export_function_class2) - f.flush() with open(recipename, "w") as f: f.write(self.export_function_recipe) - f.flush() os.chdir(tempdir) d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] self.assertIn("someclass_do_compile", d.getVar("do_compile")) @@ -366,7 +363,6 @@ EXPORT_FUNCTIONS do_compile do_compilepython recipename2 = tempdir + "/recipe2.bb" with open(recipename2, "w") as f: f.write(self.export_function_recipe2) - f.flush() d = bb.parse.handle(recipename2, bb.data.createCopy(self.d))[''] self.assertNotIn("someclass_do_compile", d.getVar("do_compile")) @@ -377,10 +373,8 @@ EXPORT_FUNCTIONS do_compile do_compilepython with open(recipename, "a+") as f: f.write("\ninherit secondclass\n") - f.flush() with open(recipename2, "a+") as f: f.write("\ninherit secondclass\n") - f.flush() d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] self.assertIn("secondclass_do_compile", d.getVar("do_compile")) @@ -418,7 +412,6 @@ include \\ recipename = tempdir + "/recipe_unclosed.bb" with open(recipename, "w") as f: f.write(content) - f.flush() os.chdir(tempdir) with self.assertRaises(bb.parse.ParseError) as error: bb.parse.handle(recipename, bb.data.createCopy(self.d)) @@ -434,7 +427,6 @@ include \\ lines = self.export_function_unclosed_tab.split("\n") lines[3] = "}" in_file.write("\n".join(lines)) - in_file.flush() bb.parse.handle(recipename_closed, bb.data.createCopy(self.d)) special_character_assignment = """ From patchwork Tue Sep 16 21:19:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 70378 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 C3D55CAC592 for ; Tue, 16 Sep 2025 21:19:47 +0000 (UTC) Received: from OSPPR02CU001.outbound.protection.outlook.com (OSPPR02CU001.outbound.protection.outlook.com [40.107.159.2]) by mx.groups.io with SMTP id smtpd.web10.7463.1758057584996063867 for ; Tue, 16 Sep 2025 14:19:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=LmaZMO4S; spf=pass (domain: axis.com, ip: 40.107.159.2, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A6KLlCeSlzSNpihQKcth+PI3w73UuYy8jkRTySRZrnCXDgDI2b60A1JP2zjaLNQek0kFW2Mm5DoxlHxzsMGqhWov0EDKjxMDFruIYDL4ApK3JWp45S5TkExcn1Zn7LyAb874ldGR8WEorFyQhBSNqdzl9w1cyhYB2B9DjEa1KT76tTUWyJUJyWebMBw8in6udIHgxXPY+8idtiyWZwvhkhUW6inInVUOwmtyPWdwJ4KXJKjdB05SCRuCrjfqA6NLK3L57Mbglu/aE29CUNJrZlBWnYE9JS4W6bnJgeACKfuBApq50Wx06rJ5NtSXyKGwj9FWUwkekde3jFqRRq/plg== 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=Ap09tiQuDISk6nfA+dtbuknZbSmsxTXRstpHsKdft8s=; b=fZ9QQqoCr0hGDQYWgwUMygN2NWNs/lwqbxJH/Q7hWXIMd/cfCRimyiW+RdxMe0I8fAJ3cWDHyPNhFXvBvpi6p5xGfY0IpLJoeGI2er65N56xpL8yAxKhewXLrBw8hf6sTPpnxd1ENDsfa5g/G+xfSgGglqErYwNuF2yIrrwasrwT2G1WgwLmURfpjsGNfZynGzStKlitiCJ3LZsFx3s37iIDzBxXH27ZBXPCZS8UFSYMVdURqAn7nvOPla87e+MZyNBPV/pXQVva0BwJiNfh3gtGLMWTsytE6id7MZJYjbZBR5qVXc7hjsz7H+5ErEEvtoDlRF/0t1ve0WmefnWXLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ap09tiQuDISk6nfA+dtbuknZbSmsxTXRstpHsKdft8s=; b=LmaZMO4SdfFnapf6U+pvHwicELPCZcUt3SPF61cIm+I5WGvZsOY0RzzzQxUDGXlJy93UrdHGT+plnZ9MVn/LKHWC1EXx7SUMIieZyFDoilnxiHiKeirrQ95S1HZjVyOY68cm1DPerXmHrnl4TsM2YxlzOFhLo41naRSv9nZ3mEk= Received: from AM4PR0302CA0035.eurprd03.prod.outlook.com (2603:10a6:205:2::48) by AS2PR02MB9389.eurprd02.prod.outlook.com (2603:10a6:20b:59f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.13; Tue, 16 Sep 2025 21:19:39 +0000 Received: from AMS0EPF000001AE.eurprd05.prod.outlook.com (2603:10a6:205:2:cafe::a0) by AM4PR0302CA0035.outlook.office365.com (2603:10a6:205:2::48) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.22 via Frontend Transport; Tue, 16 Sep 2025 21:19:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by AMS0EPF000001AE.mail.protection.outlook.com (10.167.16.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 21:19:39 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Tue, 16 Sep 2025 23:19:38 +0200 Received: from se-mail01w.axis.com (10.20.40.7) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Tue, 16 Sep 2025 23:19:38 +0200 Received: from se-intmail02x.se.axis.com (10.4.0.28) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 16 Sep 2025 23:19:38 +0200 Received: from pc56063-2339.se.axis.com (pc56063-2339.se.axis.com [10.92.3.2]) by se-intmail02x.se.axis.com (Postfix) with ESMTP id 158D122AD for ; Tue, 16 Sep 2025 23:19:38 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id 7C41812024B; Tue, 16 Sep 2025 23:19:37 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv2 3/5] tests/parse: Add tests for include, require and include_all Date: Tue, 16 Sep 2025 23:19:32 +0200 Message-ID: <20250916211934.253650-3-pkj@axis.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250916211934.253650-1-pkj@axis.com> References: <20250916211934.253650-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AE:EE_|AS2PR02MB9389:EE_ X-MS-Office365-Filtering-Correlation-Id: 160d9be2-eade-4af9-a0b0-08ddf566beed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: bvuPO2kMll8oFBpCeGU+Q9KJBJgNLMdyqxuVXioCAh82chDTh52yjRDLESD2p94CXjf754AezhV7RuE/AZ63AJX/BGJBZBsZRYHQu4hB2ETv8bzrSd01o3xvu1FvZU48NDq1d+Fj8GCN4zDownrk/7v/QD+9i8R70CSFvCzfqn53CPwnzwYsP4ptFPGLaUmUX5/g0/m+8jzAx+rlepeYYkeM9IeFkZro52AIX/ERB6UyGuFU42Y2PU5nKxLxiPig+fG+u2uQKX0CxVFMMdih5VRLaYQ1DoCUj32sCLHxmCz6uZEWp54O27xf21ohnBELp3av0trs4nyi9G1dB6GY7C70vMS+n3jZIrxuiXs1OdGr6XGgEUNEgCZs7Feq96R4EyptbSDTf6wT2RVca9Syuh1gYyHbhuWs1puVqUD5RRtfk7ZZyfCIV4XcDoBqNVyK+1ATZ3zUY697hRJ5omfqcf3WWPLEcl55IkZ0yr40al6xQfjF0nOozw6jiu18SoedqNH/cOx917IDRBA81yivDuF49SMjlDSo8KJuWe1fC8jLQw5YkyXl6eAw6I2P+dy/kLwfuVOMtXnMkHIXqRFsOkDoEbaUOPbYbfOQZUHQCF+w3f9IE1A046rN0CLzDU/VgRsIIrXAR2h8A63fZlCN863pd7vbgUQerZ5BTsDC6wO1Piwuq8JEFjoRBRoKLXD7y1jjd5BX3/n1M1JjyCccLRpSaySDo5go8APAA4iixaKnOydBZEraWL9jTGWmbVtIO9uUFNPZCPkEtfMpuDuy7yYVQyGRBOftgJhrxN098udu0v9Lkg1xweHimcypb+mbGYxaDV3GRY3colvuYmwW7VKlgFGoa/yebisMSEVCDLyKNLnoThGwJy4O67nsLNiSWEcvPTOnc/pg1Tm55VB4YfXtqwq5H+MJ2XIx0DgXC/dnlJ4jcGxfEt9R1ZF4xa8byJ9+vfQc7NlUnxqewwRHynQQ04y8HWFB/i//Y96J2OCQ8eanPjG3XxOuO3KH12IupJ1z9pf9Oq7UTxn8aOHtpTCgwf7mtPZtBMybmGi8HpcVPXu3h1TUJZG0BeQqJeUg8PnECXp/f6XMI3YDEWRjn8DqRHpapzhx1dXwQsqEjv4clIcIiVFHRoZhsHxmk/ZZ3EoYf9vcOQQLet/Q7YromdMUUBhKugZkavWvBWKKWV9StCWHveDk7q8CryUZXsiH6jRJYq7mQEBg7DAMYamXB6DC36NYf6IBIVFkIoXbQEtDvGyb1mzpS0zvd46GkmzxNOqrbNH+PBkNMNEP4OctucpBb4T/Mu2zfn5zMUstzuWPAC/4X89WGKNNdCBMCI3PxsBwVsx5BNbMdVKRYBRNX/rrKSHXcY+27oS9R8KnROLkld7hVRP8I86Il2pydAg+Aj6GIXeQv0piFQ6s6VKeOsSIxEpl4TirMIbiaPOmJpjXB+LNuftzXWxVnb8ByYk4lr182Sz7uDLUWMqrYD50SOvAAvvIpuYzm+dJZoa7JeHR5YEMvOCbxodM1VNlWGrQ X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2025 21:19:39.4793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 160d9be2-eade-4af9-a0b0-08ddf566beed X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001AE.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR02MB9389 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, 16 Sep 2025 21:19:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18045 Simple tests for various ways to include and require configuration files. Signed-off-by: Peter Kjellerstedt --- PATCHv2: No change. bitbake/lib/bb/tests/parse.py | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index 431b0c7d3e..d3867ece98 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -448,3 +448,63 @@ A+ = "b" with self.assertRaises(bb.parse.ParseError) as error: bb.parse.handle(f.name, self.d) self.assertIn("Empty variable name in assignment", str(error.exception)) + + someconf1 = """ +EXTRA_OECONF:append = " foo" +""" + + someconf2 = """ +EXTRA_OECONF:append = " bar" +""" + + someconf3 = """ +EXTRA_OECONF:append = " foobar" +""" + + def test_include_and_require(self): + def test_helper(content, result): + with self.parsehelper(content) as f: + if isinstance(result, type) and issubclass(result, Exception): + with self.assertRaises(result): + d = bb.parse.handle(f.name, bb.data.createCopy(self.d))[''] + else: + d = bb.parse.handle(f.name, bb.data.createCopy(self.d))[''] + self.assertEqual(d.getVar("EXTRA_OECONF"), result) + + with tempfile.TemporaryDirectory() as tempdir: + os.makedirs(tempdir + "/conf1") + os.makedirs(tempdir + "/conf2") + + with open(tempdir + "/conf1/some.conf", "w") as f: + f.write(self.someconf1) + with open(tempdir + "/conf2/some.conf", "w") as f: + f.write(self.someconf2) + with open(tempdir + "/conf2/some3.conf", "w") as f: + f.write(self.someconf3) + + self.d.setVar("BBPATH", tempdir + "/conf1" + ":" + tempdir + "/conf2") + + test_helper("include some.conf", " foo") + test_helper("include someother.conf", None) + test_helper("include some3.conf", " foobar") + test_helper("include ${@''}", None) + test_helper("include " + tempdir + "/conf2/some.conf", " bar") + + test_helper("require some.conf", " foo") + test_helper("require someother.conf", bb.parse.ParseError) + test_helper("require some3.conf", " foobar") + test_helper("require ${@''}", None) + test_helper("require " + tempdir + "/conf2/some.conf", " bar") + + test_helper("include_all some.conf", " foo bar") + test_helper("include_all someother.conf", None) + test_helper("include_all some3.conf", " foobar") + + self.d.setVar("BBPATH", tempdir + "/conf2" + ":" + tempdir + "/conf1") + + test_helper("include some.conf", " bar") + test_helper("include some3.conf", " foobar") + test_helper("require some.conf", " bar") + test_helper("require some3.conf", " foobar") + test_helper("include_all some.conf", " bar foo") + test_helper("include_all some3.conf", " foobar") From patchwork Tue Sep 16 21:19:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 70381 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 D7916CAC59F for ; Tue, 16 Sep 2025 21:19:47 +0000 (UTC) Received: from DB3PR0202CU003.outbound.protection.outlook.com (DB3PR0202CU003.outbound.protection.outlook.com [52.101.84.14]) by mx.groups.io with SMTP id smtpd.web10.7466.1758057586109689718 for ; Tue, 16 Sep 2025 14:19:46 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=aYLHkU3h; spf=pass (domain: axis.com, ip: 52.101.84.14, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aV9Vmeag2v7MSOwV6/K3Nx272mR7ZclQxzsndNI9mvzQrnoQ/GpHNFGZJlM7L///vBibNjOkWTwFnLQPcD7IvfOfyaR+8he46yx0Mhhfd8HDFxYplQY1V31/AVxYXl5NX2TtSwUxqqJJ/x1ocXF2ZaPmOWPlFrDBmaJaIVFLjPgaxNnLHi2/dpffbPF9bmG7AaMPoKRxcOyETgXa/dsv63zB0p7IH3kqCEkFPW4/nOciasObR78IWihRaca9xPDCE9GmeBpfYA02IFj4K99QM8HaWGmP0DFDdsViKj8VbCPYnhBwk2DogM4qtnd7mDNXj99/W8w3GnuCz/SXYTnzzQ== 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=D49e6E97PV6beEewIFAw/obW8kQPwGPIPZ/r9vUklzA=; b=oDIoYzTvL2vGYoIM5vMilu/7PiWOVZsntkjsPlLc6xa2WyHN9EeiD61ylL+2k3cQWYCTuRF2NFp4XcPn57IgWkhlDcNvW6se5XTwjpQR3yWU6PIoRZXSczsw/m73ZXCoHhFgf8uM3dnmw0ZHApMAAM8uQuwq7gcc+h7LEBVq7HBQNJy4DbKGkuoZIEzWoPGkDkUfQ7URI5w6TOaF3kjFvuGG1HC+j5QlBlZvzTXYXC0rWD7SAIKgrQLRBzJWtTr8E906EKYXfrc/8kF2X49XI7ZW1k97QQW9FAThyW2QAV+KcFGDR9m1xj2bORe+AzyUP7kvZQIMMTx68pm598j5DA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D49e6E97PV6beEewIFAw/obW8kQPwGPIPZ/r9vUklzA=; b=aYLHkU3hMD5R8n0D0UzsrW80w3LQe4R1GnQMuwchdrHV/txVXnsIv9Q5pkt1AaJZBfgb8cuQmuLPwjW2y/SjtEJiHQSyrJrgIOzqns9nekVhhTqUULcAyIrqV5zhd/y+3jxtWpiozKAUcYsh9Do7w4THt0wjoR1x+cz9bxdC6r4= Received: from DB8PR03CA0018.eurprd03.prod.outlook.com (2603:10a6:10:be::31) by GVXPR02MB10835.eurprd02.prod.outlook.com (2603:10a6:150:14d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.21; Tue, 16 Sep 2025 21:19:40 +0000 Received: from DU2PEPF00028CFE.eurprd03.prod.outlook.com (2603:10a6:10:be:cafe::aa) by DB8PR03CA0018.outlook.office365.com (2603:10a6:10:be::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 21:19:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DU2PEPF00028CFE.mail.protection.outlook.com (10.167.242.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 21:19:38 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Tue, 16 Sep 2025 23:19:38 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 16 Sep 2025 23:19:38 +0200 Received: from pc56063-2339.se.axis.com (pc56063-2339.se.axis.com [10.92.3.2]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 16D61292D for ; Tue, 16 Sep 2025 23:19:38 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id 7E1BF12026C; Tue, 16 Sep 2025 23:19:37 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv2 4/5] parse: Make include_all support empty variable expansions Date: Tue, 16 Sep 2025 23:19:33 +0200 Message-ID: <20250916211934.253650-4-pkj@axis.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250916211934.253650-1-pkj@axis.com> References: <20250916211934.253650-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028CFE:EE_|GVXPR02MB10835:EE_ X-MS-Office365-Filtering-Correlation-Id: c584a353-9e4f-46f1-d56e-08ddf566be65 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: aBwbMjguWCmiXT2lBshV9tJD3Hs5PRVvHUMM76eYHBXQWKCt7hfTZlSIssvfb9VPpUB9R7fxKpdM4i6fX+P8L13Ug+FURq0YQUflyevSmyrT+ivFln2MImi6DCCanP3nbqYXPTZmIqaknn4gZwsE+PyTPZX6XV6Q2eIdeEYhqUt7c1M+FL+ybcBULrEwjadQBcgyCqXpMFV9EZvcWz8neqJAVRe/QnfewqWi9+OczUSdhRkMH07UrvXj6kZHNnCXt4pKo+yjp4mQl942k6p1xRXBpALtpUSNxYy/cKHY+/TpgxE2bydqNrzXGPElCfiYV98GJJTX6SZBBPWUgon5xXIvf5JM17pfdrAc0uH7Y4TwKwwyKQSBQ2U6tzQuEtINgwlBWxmKRQW4V/7Fpz7f4NAMHhnKoOLZePKsflSqKxKwnbJvUBKE7tkQp31O0E+QMz/Za/XibZxzj71vAVDEQm9ZgtG8RM5LOMAGaWBoE0Yl6H7Gs4NcWxyamMnmZD8OoAJyrI9HvHlN3+6fbvbBmOFfW33leMYHnqG+wOCXwh+9YATPZ8qKByD6hsXiWMo9g1ZW3Hj8J5EmTXRYbCAF9v665EbyMJBelYzY8xg2Jn1ih5A/NUEc4BKZGALXztJmHnAQYYWxzPegasu8dm05Fx5xvJsmiuDhwP2Zdya48zWRbwuX6qJBJ8XHJ6Fna5dx0rcdFE/EvurzLqjIs8XGG/uGsbHAW6hftC3zGr0lZ6Krw/rKacql59GnT/loij0l5f+pFQM5G2XCGV5a5nflPKm2rLND+Xmg3jz8I2hHg/HNDcJcnyuKzEyv5DTllpB//T+hZlI14ITkgxiKE94hkDi1LaHkai+lpU6W0w8bNGA+d3wWqtUla6C8m+iuaV9EjvqqbPLN234V2kGp6KJTm7SwBtcI20n+GTb1hsvTsmwFFhx/IxbJPd2FRRuzvmIKN2GPZJpR5l5kvyJSi3I4axzWiw1m4dt/ftbbaeUpbJLqhfvPHj9wec3IW6ULoHcqjZFlxYJgGeW65ITpfaVl7OKDXkygxhmVZrdM69nSy1dhfuw+TRLoIP87c5m5QqLZr9kAOXyFaZLwXr7eXwusms8Td9rwosU20d7hS46xf0WzTlvQ3zSrFUEaCfIVM3vsGFlP7/h2cbynXAVIPHGUsGUIB9RMm0aPqnyXbiE6A1SfqntMv+PXokPg3V04wcDbD6BJoiWUzxYKxbMH2dEmQnd5VZwGrVkSfHglUNrP+xcsEaV3TnQlcRu1/J4oJOE5OSwI8Wa+bkqfBxes/y6JVn4w2LNcxtC5xC4uEjLN3Tht09TRqfkS8FXcQEhN8aExiTmv4i/kU/5H+EnJv/nBpDut5BWuvF729GjLH4AQostSltzbrwr8uym36ZYZlvUiKF4rGaC33I2SO8H7BNOsC/Uznqj/ayJxLhU4F3GdmcIGlPhRKeTOwhhp5Gerz8hv2FKrQH34qWKjeAEwmihtOXGHrybLbkIbXJntTJg2ZR4ymDbo+Q4Eh1my4f+uEfbb X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2025 21:19:38.5755 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c584a353-9e4f-46f1-d56e-08ddf566be65 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028CFE.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR02MB10835 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, 16 Sep 2025 21:19:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18047 include and require support empty variable expansions, typically used with conditional expansions. However, include_all does not, and instead reports an error for the first path in BBPATH. Rewrite include_all so that its behavior matches include and require. Signed-off-by: Peter Kjellerstedt --- PATCHv2: No change. bitbake/lib/bb/parse/ast.py | 5 ++--- bitbake/lib/bb/parse/parse_py/ConfHandler.py | 8 ++++++-- bitbake/lib/bb/tests/parse.py | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 49a0788038..3250211e60 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -53,10 +53,9 @@ class IncludeAllNode(AstNode): Include the file and evaluate the statements """ s = data.expand(self.what_file) - logger.debug2("CONF %s:%s: including %s", self.filename, self.lineno, s) + logger.debug2("CONF %s:%s: including all %s", self.filename, self.lineno, s) - for path in data.getVar("BBPATH").split(":"): - bb.parse.ConfHandler.include(self.filename, os.path.join(path, s), self.lineno, data, False) + bb.parse.ConfHandler.include(self.filename, s, self.lineno, data, False, all=True) class ExportNode(AstNode): def __init__(self, filename, lineno, var): diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 9ddbae123d..af3af2ccee 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -56,7 +56,7 @@ def init(data): def supports(fn, d): return fn[-5:] == ".conf" -def include(parentfn, fns, lineno, data, error_out): +def include(parentfn, fns, lineno, data, error_out, all=False): """ error_out: A string indicating the verb (e.g. "include", "inherit") to be used in a ParseError that will be raised if the file to be included could @@ -67,7 +67,11 @@ def include(parentfn, fns, lineno, data, error_out): # "include" or "require" accept zero to n space-separated file names to include. for fn in fns.split(): - include_single_file(parentfn, fn, lineno, data, error_out) + if all: + for path in data.getVar("BBPATH").split(":"): + include_single_file(parentfn, os.path.join(path, fn), lineno, data, error_out) + else: + include_single_file(parentfn, fn, lineno, data, error_out) def include_single_file(parentfn, fn, lineno, data, error_out): """ diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index d3867ece98..2f77c90f60 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -499,6 +499,7 @@ EXTRA_OECONF:append = " foobar" test_helper("include_all some.conf", " foo bar") test_helper("include_all someother.conf", None) test_helper("include_all some3.conf", " foobar") + test_helper("include_all ${@''}", None) self.d.setVar("BBPATH", tempdir + "/conf2" + ":" + tempdir + "/conf1") From patchwork Tue Sep 16 21:19:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 70380 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 CA4FDCAC598 for ; Tue, 16 Sep 2025 21:19:47 +0000 (UTC) Received: from GVXPR05CU001.outbound.protection.outlook.com (GVXPR05CU001.outbound.protection.outlook.com [52.101.83.18]) by mx.groups.io with SMTP id smtpd.web11.7530.1758057586507908028 for ; Tue, 16 Sep 2025 14:19:46 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=U/96pXa9; spf=pass (domain: axis.com, ip: 52.101.83.18, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aiFdW8Uaeb/bb+yUIJY/CkjUUVwGoie3Jn5fnhRVjGK24d5zjvzbA8RvdKaFvdPxbPu46/tpqGUqH8Di1EbGMcu+WRTps8W/VP9SlF3cSydjV9Ktx9X2WoY58wbr5Ruo2cdtMcQjgS8pv7PI5B0JHNA6CIer91Aj4OGZ5/1CjLmn6dqxwuWrY6pg3XsiXfprgF0+7ig0yczBM1FPXED0p7/MHGXFccsVskppPg/IciSmDpyI5h8ChCH0ee8tJ1as0BeI0lL8oRtJprMTK6MCbGri5iMZesa/ABsTNykSQnBDgTc2bk+nlBuxTKdqqaAR1GCZ89+bE/v1bCvd3qX4Hw== 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=LpAHA75Bw55NJb/quO4TcU+FN5WhlToqpC1o41DsilA=; b=jk7k1f0P+tHcC16doZhe4GjQBIIeZTe0aybg3l1vLzOEwYa5Rt9vgFUriEvDQvDra9EskXXz9/9WyfRLtGzT5b5DYxOzbh6S2Pkda0gcJWdVIAQTpqSWTnelonr+ZGR8Ik0lU1sO9DckcGjp/24S62UwngM/vkIA0q6XB8sPMyTl5CVdbgsz8RuHPTwSXuFK1s1q6GCUOgK5cgvGHllethuB2zBQ7Uf8IPwqvo3KMj5oxyLfbmw0pabdLQtTwGlZ71IOakl6D2gsI3a2yHHXSxLvO5A2qOrU40/CmmvxcpQCJsV5l9PqNU1gDHRmgGxhwsHiGoz2WU5ep858gWsobQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LpAHA75Bw55NJb/quO4TcU+FN5WhlToqpC1o41DsilA=; b=U/96pXa9x4qNMcqLIyH/WEdp3QyK4V3MA07MQTmsZcihJJiBANLQfk2A23FMdmfG3pxXkTWYARtLZLfCM1LJPqP9VPpv5SWeGdcY7yBXWvgRHOnu+iucMeVUdFC4ULDkV7vC/YxfIUIpP40snwhiNRSTsmXmGwW2zXW6X51eKeU= Received: from DB8PR03CA0026.eurprd03.prod.outlook.com (2603:10a6:10:be::39) by PAWPR02MB9927.eurprd02.prod.outlook.com (2603:10a6:102:2e2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.22; Tue, 16 Sep 2025 21:19:41 +0000 Received: from DU2PEPF00028CFE.eurprd03.prod.outlook.com (2603:10a6:10:be:cafe::b7) by DB8PR03CA0026.outlook.office365.com (2603:10a6:10:be::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.22 via Frontend Transport; Tue, 16 Sep 2025 21:19:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DU2PEPF00028CFE.mail.protection.outlook.com (10.167.242.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 21:19:40 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Tue, 16 Sep 2025 23:19:38 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 16 Sep 2025 23:19:38 +0200 Received: from pc56063-2339.se.axis.com (pc56063-2339.se.axis.com [10.92.3.2]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 1CAFD293C for ; Tue, 16 Sep 2025 23:19:38 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id 83DEF12024B; Tue, 16 Sep 2025 23:19:37 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv2 5/5] parse: Make include_all raise a parse error for absolute paths Date: Tue, 16 Sep 2025 23:19:34 +0200 Message-ID: <20250916211934.253650-5-pkj@axis.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250916211934.253650-1-pkj@axis.com> References: <20250916211934.253650-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028CFE:EE_|PAWPR02MB9927:EE_ X-MS-Office365-Filtering-Correlation-Id: a485c611-e697-470a-c51c-08ddf566bfa1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: /gWGDSYzwp49GPnyk0wicUXtXKv60u4WaSEcefAIzVbDWlwTpnckwsO9Bl0WkN6wA0AjxelO3yRNRX2CfSC3k4xoLJy6859kT7m+FrLcUatAulNq01/6jBPs2fgHsbu05uDQuG1WJuYb5SJsS5QPVhpLNgS2WJNa8oMDfiZPE8TTG3LTMrxy/ukXPDLDlXxn5+w7rGSfJP2jGCWAbv04r96TT+4UgBcfbeYIRV3DXIz+5iaHVJk24Otmm8BuqN6arStg60vsOd/xW4hL8sUhBij+62aC/3W33/TvN94Vxt+5jhCcKary+uStPCcJcVRx1WTfw1nEBwoHRafn0bVMEQJUddWLeteADkhpz3ho1bVuukNSsV4ruwHmLBLdXYcyHbWbE0+OfeSRnyehGsUZKLU0OZB8v+qsGvIPVBb6V+9Bl9iZrFvU2DIkb6OQnSelrTeOEFMcWEktCPtCEs+W9uI7wBg+Ikr/j8hkFRh8mYVPJ6Aa9lMhupXPQbduiHGUWJmN4g1Y94WCFT271oQh0Zwy90pIGs3RZuJ+fexUKdlQ9CVnz6b132jW6petYZ1cIO7Es5dGXYTdErHvFeAHG3zLUI59hwxRSKm0vIGDjLLL8VjZi8caEJEw7R47AxWj9+tNlCbspDSjQDlApEbHHGC7waw8IUAKaCC0n7qZSYEYfkazAKij8jAB6SyaQQPCnEv+wYkxFxMit8zfr1JNxRKAF1Mv+tgMTvhffuU52t9Cr/K4tq8XYyG7UjcA94w9x+5VixTqqP7pGhQoX+govmwALLx4i9SFRPYiSi9tYun8wBRCyABWpgah+R4hd76ssFpZa66mxzPrhIHq1SiCfWcvnZA8E4cUqm3Ldp1D9Ll3K6IhmyULptJMHexe2IfUosX5WRfEqJAImivn/8IP63jnh2riqJam6eyRv3dxUQZMspbF5Kf8nH8l0lu0E2/XKTRs+ZSVflJAQGfXVEXXnj+oE3pMvHv0q0UHkNDEDNqZsjjmd0IyQjd/tjP1zswJ8hIWY/7FbVbpgFRO9pYovkL1LknggqbsdJEXqSvkVeJMWHB6Fede5uspJUEsp6ME7QV0lu+Gmm0GDofBaQX5huU1UCK3NejCxL5gvKFcuAxJVTpOngZqN1vcFW53w7eWitBtCJWc4Ki0D0/Q73G8KkMc31ie4caNHfSxN7QXTuOxTc2vM4ttullULcV1bvjktFg2jkSak8Pa55EqOS1TIlAbL8IGhgGV6mrCZvjpbybP+Y5MisYd0zGXuMVrfpN4ifP86Bty7Td9HjogsYAvUgONXup6r2LUTI2cMWpREXx9g7zi7UntIT9Q5vmR5eLKhKjeMTask7U9ouI/rZtX86M6Gs7diRwuBOdUjJaCATKt+nKHrfe62RhTANR37foUT+6T4mXdzoiOgXB9CUPWoXJ5vdEgAET8C3MNmePAjM+y8FqHV/MTgaO6jPNNA49Dn9LoCcf18OqffIR29h9Sp3aZedD4eGJiGBBlBc03i5mMmsJHLo/cU1AWfKwWRZSt X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2025 21:19:40.6459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a485c611-e697-470a-c51c-08ddf566bfa1 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028CFE.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR02MB9927 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, 16 Sep 2025 21:19:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18048 It makes no sense to use an absolute path with include_all. Signed-off-by: Peter Kjellerstedt --- PATCHv2: Raise an error instead if an absolute path is used with include_all. bitbake/lib/bb/parse/parse_py/ConfHandler.py | 3 +++ bitbake/lib/bb/tests/parse.py | 1 + 2 files changed, 4 insertions(+) diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index af3af2ccee..d876f6c1ff 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -68,6 +68,9 @@ def include(parentfn, fns, lineno, data, error_out, all=False): # "include" or "require" accept zero to n space-separated file names to include. for fn in fns.split(): if all: + if os.path.isabs(fn): + raise ParseError("Incorrect use of include_all with an absolute path %s" % fn, parentfn, lineno) + for path in data.getVar("BBPATH").split(":"): include_single_file(parentfn, os.path.join(path, fn), lineno, data, error_out) else: diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index 2f77c90f60..d6bc5a38bf 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -500,6 +500,7 @@ EXTRA_OECONF:append = " foobar" test_helper("include_all someother.conf", None) test_helper("include_all some3.conf", " foobar") test_helper("include_all ${@''}", None) + test_helper("include_all " + tempdir + "/conf2/some.conf", bb.parse.ParseError) self.d.setVar("BBPATH", tempdir + "/conf2" + ":" + tempdir + "/conf1")