From patchwork Thu Oct 12 20:25:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 32060 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 A898ACDB46E for ; Thu, 12 Oct 2023 20:26:04 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.42]) by mx.groups.io with SMTP id smtpd.web10.23204.1697142359008806766 for ; Thu, 12 Oct 2023 13:25:59 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=P2P7bjzZ; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.107.220.42, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QQ3gihS4LvkvY0P5pSO06HRlcwe74EsUUreIUqLGR6cPyQCBfOU/YoP4xb0L0hD/1LmHH8dx70gwOgiLYfVM131jD7gHyD5O9dEc/NK6H/wqhuZjqMPDIxW2bRln+GnK3/kqq6u0rQmF/JJviSM3iygvSXXSQgfZ0f9LiTtBDHGHjz0NMBGfjyW40IWjK8C2t6EN7XcnOJ4mqmK0LBqyqZa6NT1fIy77p8Ya4APKXgHMv/kqTzhP4CYpTZIuigh/lMpDsqdWEd/Hl397/b0uOKQPmgNuucWid8A4eEimfIPKibXVzk7MLVJ380lT8rY5mQDfWs2QGyTs/PbI6vhaxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=N7VQAMteQzqZfCadRqtWOFWY3PDFmF3FdEiIgMmRXPU=; b=NdjNl2uq+5kkaw4Z+ApnycsTpyG/5H/YrlDwQPJzkFktf5HwwFWMktiN2muPbd9TQ5SAKVl6QkEvZatvigDOJMX73ZnIs4V6+kU+mWeYnqNH6GmpDrjRshF/drinorV11/V4ImgB1vYElEEoYBuzihi0uIL/BGtnKeibmO7HqR+1+gYzwy+832rwb2lSOr/iQ7qOraMCnWu3r7Oj1hNVPEq4YlHtn0VCc72nVLAYpqE8OG0NskNlhoIl6u6zgAgLy9aScd0SlLr89Iytvh+auAs9JreoddEfcnYGQFxUtEwyULl0jHHh92c/sZ3CKXU+UvEiyfFdbRxBrdbNKYpNAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.41) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N7VQAMteQzqZfCadRqtWOFWY3PDFmF3FdEiIgMmRXPU=; b=P2P7bjzZodTkzAATgavk/vSy4yrP17Art4xv14DzMkRmB9/WsqqpimsNsEblaeCexcyVhUlsXhnv5MWvZ6lRJk3sMX4S03NPKyMaC2oFOdlYBOW5N4JBKwTnao5bxpvPIg4X7yJofpc+7is62yo0u/Sgg17iUPVnvsveEVkhADtCKaRUiSH3s1of+MPR6Vok9ulhZS1rP9Nqg79gNntaphVHWNMGrnkTxGRheJrY0bdelJMobBXdA9IGt/vsGdQMv2nC/cdosbToam5qpt+/QdHmcMKbDF71q2y+9qoLdGWFNNQZQOTf5Fx8iJkyxiym2ys4MuQE3d1bdh0ZelFJCw== Received: from MW4PR04CA0196.namprd04.prod.outlook.com (2603:10b6:303:86::21) by SA1PR12MB7125.namprd12.prod.outlook.com (2603:10b6:806:29f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.41; Thu, 12 Oct 2023 20:25:55 +0000 Received: from MW2NAM12FT050.eop-nam12.prod.protection.outlook.com (2603:10b6:303:86:cafe::94) by MW4PR04CA0196.outlook.office365.com (2603:10b6:303:86::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Thu, 12 Oct 2023 20:25:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.41) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.41 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.41; helo=edgeappmail.agilent.com; pr=C Received: from edgeappmail.agilent.com (192.25.218.41) by MW2NAM12FT050.mail.protection.outlook.com (10.13.180.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.15 via Frontend Transport; Thu, 12 Oct 2023 20:25:54 +0000 Received: from chris-virtual-machine.localdomain (192.25.126.5) by edgeappmail.agilent.com (192.25.218.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Thu, 12 Oct 2023 14:26:51 -0600 From: To: CC: , , Chris Laplante Subject: [PATCH 1/3] kernel-yocto, devtool-source.bbclass: fix 'devtool modify' for kernels Date: Thu, 12 Oct 2023 16:25:33 -0400 Message-ID: <20231012202535.2902235-1-chris.laplante@agilent.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW2NAM12FT050:EE_|SA1PR12MB7125:EE_ X-MS-Office365-Filtering-Correlation-Id: ad4661a4-9156-427f-8408-08dbcb616f39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TvLgIq1f4LNiaUCF3VMN7TWQc9iS4kGcrCs9QnPYWsmGAI2i08qjZ1BIuMuoAAhsZirGaemVCfq25OyhAKaPCfJOIYo32iTsgwVinT75j4was4zrwWdUsVwnZXgDjMZETgnWKChnp85AkznCM1PBNOtV5YpigQz7omaJBQfNBZZRGh9XXeTmKd3DjkVPv7wKBc+/vPjk5JfHE2HrfRia6F0RG0+9AQY0YyHd4KdlTLShtRki4cHH9NaaO5NZ1oK1AK3x4rJNRu+uGJ3VymIwdN+PaAb6gUJo30pDaO+jT/4Om2pDr/XI8YJV/h56qSBFLfQV2iBSLUej14+NaEceFOVTzBjPObUl0gKkJC/CQJaOnFvd/FccBQnEo5VizItnDOSS/6/LaEa3fhIvVQkMUl6KArCq9pRy/wH38Y1JrGDZSRcxhnRL+C3GZr9AgN6mOebic80soUuMupIemVgfkv7UcZZRp2wEo+0Aw7Kj9wzEEAwfXvFcgHB/BcmjS/JuUcfbJFeFvP8Yixfz4RcOnSPD2Di/DBQ3X00ZA2Wo6u50OR3KRZrU5xY8qhVMKQV0adDKoK/OemcUt/0bVo9gKPGS9oqN4Tbk1TDW1zbhazE4NA/HvWL5CqXISr/zArNCfvw7IQR+MAC1OKHoSjEgg3srV8+hqj0JrKUuxEmEKe2KX7Y+S2shA44FXlXnUUG58RuQzIJrHouuklhTkG5pc/H2UYY1/l77PbdQNeZzZNVs4CGePBimBfnCLiejOJVS X-Forefront-Antispam-Report: CIP:192.25.218.41;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edgeappmail.agilent.com;PTR:exch.smtp.agilent.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(136003)(396003)(39860400002)(230922051799003)(64100799003)(451199024)(82310400011)(1800799009)(186009)(46966006)(36840700001)(40470700004)(4326008)(6666004)(107886003)(1076003)(8676002)(40460700003)(26005)(36860700001)(82740400003)(36756003)(356005)(86362001)(7636003)(426003)(54906003)(83380400001)(2876002)(478600001)(8936002)(2616005)(2906002)(40480700001)(70206006)(316002)(41300700001)(47076005)(6916009)(956004)(5660300002)(336012);DIR:OUT;SFP:1101; X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 20:25:54.0269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad4661a4-9156-427f-8408-08dbcb616f39 X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.41];Helo=[edgeappmail.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-MW2NAM12FT050.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7125 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 ; Thu, 12 Oct 2023 20:26:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/189023 From: Chris Laplante Fixes a couple of different issues that all conspired to break 'devtool modify' for many use cases with kernel-yocto recipes. To explain, we need to consider the basic flow of how 'devtool modify' works for a recipe using kernel-yocto.bbclass: ┌──────────────────┐ │do_kernel_checkout│ ├──────────────────┘ │ Sets up ${S} │ devtool_post_unpack: sets up 'devtool' branch ▼ ┌────────────────────┐ │do_validate_branches│ ├────────────────────┘ │ Checks out the machine branch (derived from ${KBRANCH}) and performs validation ▼ ┌──────────────────┐ │do_kernel_metadata│ ├──────────────────┘ │ Generates the config and patch series. │ ▼ ┌────────┐ │do_patch│ └────────┘ Applies patches from patch series. The first issue becomes clear when visualizing the flow above. The 'devtool' branch is checked out during 'do_kernel_checkout', but then 'do_validate_branches' stomps on it by checking out its machine branch. So fix (1) is to add a postfunc to 'do_validate_branches' to checkout the 'devtool' branch again. Next, we need to look at the flow and consider how things work when SRC_URI override branches are involved. Consider: SRC_URI:append:fake-machine = " file://0001-my-patch.patch" SRC_URI:append:fake-machine-2 = " file://0001-my-patch.patch" Assuming neither overrides are active, we'd expect a 'devtool' branch that just points to the initial rev, then 'devtool-override-fake-machine' and 'devtool-override-fake-machine-2' branches that each point to the same commit for 0001-my-patch. Setting aside the matter of how the override branch set is determined, the flow looks like this: ┌──────────────────┐ │do_kernel_checkout│ ├──────────────────┘ │ Sets up ${S} │ devtool_post_unpack: sets up 'devtool' branch ▼ ┌────────────────────┐ │do_validate_branches│ ├────────────────────┘ │ Checks out the machine branch (derived from ${KBRANCH} and performs validation ▼ ┌──────────────────┐ │do_kernel_metadata│ ├──────────────────┘ │ Generates the config and patch series. │ ▼ ┌────────┐ │do_patch│ └────────┘ Applies patches from patch series. devtool_post_patch: ┌─► for each extra override... ──┐ │ ▼ │ create devtool-override- branch │ │ │ ▼ │ set OVERRIDES/FILESOVERRIDES │ │ │ ┌───▼────┐ │ │do_patch│ │ └───┬────┘ │ │ └────────────────────────────────┘ In the loop, we set OVERRIDES & FILESOVERRIDES such that SRC_URI contains the correct patches for each override. But when we call 'do_patch', it is still using the patch series file that was generated during the call to 'do_kernel_metadata'. So the correct patches are not applied. The solution to this issue is to insert a call to 'do_kernel_metadata' in between setting OVERRIDES & FILESOVERRIDES and the call to 'do_patch'. We do need to slightly tweak 'do_kernel_metadata' to be able to clear out the previous 'fence post' files, otherwise in the example above, the 0001-my-patch.patch would only be applied to the first override branch that is processed. [YOCTO #14723] Signed-off-by: Chris Laplante --- meta/classes-recipe/kernel-yocto.bbclass | 4 ++++ meta/classes/devtool-source.bbclass | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass index 4ac977b122..a5fb6e42f3 100644 --- a/meta/classes-recipe/kernel-yocto.bbclass +++ b/meta/classes-recipe/kernel-yocto.bbclass @@ -332,6 +332,10 @@ do_patch() { if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then kgit_extra_args="--commit-sha author" fi + if [ "${_DEVTOOL_RUNNING_DO_KERNEL_METADATA}" = "1" ]; then + # see devtool-source.bbclass for explanation + kgit-s2q --clean + fi kgit-s2q --gen -v $kgit_extra_args --patches .kernel-meta/ if [ $? -ne 0 ]; then bberror "Could not apply patches for ${KMACHINE}." diff --git a/meta/classes/devtool-source.bbclass b/meta/classes/devtool-source.bbclass index a02b1e9b0e..b037c5612b 100644 --- a/meta/classes/devtool-source.bbclass +++ b/meta/classes/devtool-source.bbclass @@ -57,6 +57,7 @@ python() { if is_kernel_yocto: unpacktask = 'do_kernel_checkout' d.appendVarFlag('do_configure', 'postfuncs', ' devtool_post_configure') + d.appendVarFlag('do_validate_branches', 'postfuncs', ' devtool_post_validate_branches') else: unpacktask = 'do_unpack' d.appendVarFlag(unpacktask, 'postfuncs', ' devtool_post_unpack') @@ -187,6 +188,16 @@ python devtool_post_patch() { except bb.process.ExecutionError: pass + is_kernel_yocto = bb.data.inherits_class('kernel-yocto', d) + def kernel_pre_patch(localdata): + if is_kernel_yocto: + # Need to run do_kernel_metadata first, since it is what generates the patch series that is applied + # by the do_patch task. Also, we set a variable to tell do_kernel_metadata that it needs to cleanup + # the kgit-s2q.last fence post files first. Otherwise if you have two override branches that apply the + # same patch, it will only get applied for the first branch. + localdata.setVar('_DEVTOOL_RUNNING_DO_KERNEL_METADATA', '1') + bb.build.exec_func('do_kernel_metadata', localdata) + extra_overrides = d.getVar('DEVTOOL_EXTRA_OVERRIDES') if extra_overrides: extra_overrides = set(extra_overrides.split(':')) @@ -206,6 +217,7 @@ python devtool_post_patch() { localdata = bb.data.createCopy(d) localdata.setVar('OVERRIDES', ':'.join(no_overrides)) localdata.setVar('FILESOVERRIDES', ':'.join(no_overrides)) + kernel_pre_patch(localdata) bb.build.exec_func('do_patch', localdata) rm_patches() # Now we need to reconcile the dev branch with the no-overrides one @@ -225,6 +237,7 @@ python devtool_post_patch() { # Run do_patch function with the override applied localdata.setVar('OVERRIDES', ':'.join(no_overrides + [override])) localdata.setVar('FILESOVERRIDES', ':'.join(no_overrides + [override])) + kernel_pre_patch(localdata) bb.build.exec_func('do_patch', localdata) rm_patches() # Now we need to reconcile the new branch with the no-overrides one @@ -239,3 +252,12 @@ python devtool_post_configure() { tempdir = d.getVar('DEVTOOL_TEMPDIR') shutil.copy2(os.path.join(d.getVar('B'), '.config'), tempdir) } + +python devtool_post_validate_branches() { + # do_validate_branches took us off of the 'devtool' branch, so re-checkout the branch + devbranch = d.getVar('DEVTOOL_DEVBRANCH') + tempdir = d.getVar('DEVTOOL_TEMPDIR') + with open(os.path.join(tempdir, 'srcsubdir'), 'r') as f: + srcsubdir = f.read() + bb.process.run(f'git checkout {devbranch}', cwd=srcsubdir) +} From patchwork Thu Oct 12 20:25:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 32062 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 AEEB0C46CA1 for ; Thu, 12 Oct 2023 20:26:04 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.43]) by mx.groups.io with SMTP id smtpd.web10.23203.1697142359003397605 for ; Thu, 12 Oct 2023 13:25:59 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=iDNdL/aL; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.107.223.43, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMtJvYJeWdblhOYMk3uM7BIYZQI4+FuKEaQLk1i3ANT/ou92xCdIdKY8Sci5Tg3xr8PWIv7oz4H5GA+TGzvLmcmAf5g4ts+ICz3fVzmhilpU2JN/Wk7YOlf2fUZSmqCLFbdSO9nHSZgED2fC1anv9E6AHAM1fXAvk9dufZWjM2toMU8xqJEKe34zSQFeG25+x0fa8LYiwY18TkRpqagGVSvdEIWZ4KqI/CFPDbLY3TU3A8dtf+wC3Kt9SlWC9wkQL/GA8MJ3xSWDuf+URmDuMmL+SBd2ZwFkgBkhMfjPpQ/y1MzWXJGQHj/LZUysUVhW1yPePVeu0ZJwBlK221S+Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xTu5edR2ImkIeJVTBdqcLycD6oObFti8CDmcx1oygRY=; b=lYW3ax+IwtZJQuOQqQ/yu+ohX1Knl6O7lVAXj0LQMH3SbZjOcddPyQSKEz38gXkwzagpoIjGbucHhMgJwauTsVvwzLcTHpvZ1cR1T6pPZl6kDAL9/ebwXXy0DFSRzbDFFxVubEFew6H/MCkMY5hIeGNvooVzbMdsDzABvuqlUKfmZEcwN/RAxL6N8vkFa6m5RRFWcxyzVqQS81UnRMitRhCAGc7QwWc5bKk9W6KogzuK/iQHjK8zqvgWYn2Lvc2RLfHhmvkuTFTcfddT+xlVR0eT/aIe9MAZjx7DyOjjZKN1fCiaC6LZLBiyx5M+DgfsPzKl2qbRxc3JIeudTCmQzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.41) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xTu5edR2ImkIeJVTBdqcLycD6oObFti8CDmcx1oygRY=; b=iDNdL/aL+p70ejlDyD3TTgTWGmX1CLKzGQQWpqSH0YH55iPNcgYOq2gUVPUst04h/49vVqJlEsg6BaUwkhnRBn4HD3dw7VFHxbbFW35aNpMlIn+DUc4RVaU9ZcmebL6CMuGAd55xWW8+veXLGROel8ba3zRLXHd1Sn2ooNolhvuBPaAkbu5HNhEhJFTHR0JR8Ja/nRta89Efvru/yE5IDDQgvHLnFK73wtqdoCTXvGyqdzMBZgwydw8OQjxvSbwDESXx14eau84zxtyEkM4Jxs7c3GRZ1JM1ADY4PP6IterHLKrGCktGTGdcyJy27lllxOb/X3rAhaiKInH0uSux5g== Received: from MW4PR04CA0187.namprd04.prod.outlook.com (2603:10b6:303:86::12) by CH0PR12MB5348.namprd12.prod.outlook.com (2603:10b6:610:d7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Thu, 12 Oct 2023 20:25:56 +0000 Received: from MW2NAM12FT050.eop-nam12.prod.protection.outlook.com (2603:10b6:303:86:cafe::93) by MW4PR04CA0187.outlook.office365.com (2603:10b6:303:86::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Thu, 12 Oct 2023 20:25:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.41) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.41 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.41; helo=edgeappmail.agilent.com; pr=C Received: from edgeappmail.agilent.com (192.25.218.41) by MW2NAM12FT050.mail.protection.outlook.com (10.13.180.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.15 via Frontend Transport; Thu, 12 Oct 2023 20:25:55 +0000 Received: from chris-virtual-machine.localdomain (192.25.126.5) by edgeappmail.agilent.com (192.25.218.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Thu, 12 Oct 2023 14:26:52 -0600 From: To: CC: , , Chris Laplante Subject: [PATCH 2/3] oeqa/selftest/devtool: strengthen test_devtool_virtual_kernel_modify test Date: Thu, 12 Oct 2023 16:25:34 -0400 Message-ID: <20231012202535.2902235-2-chris.laplante@agilent.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012202535.2902235-1-chris.laplante@agilent.com> References: <20231012202535.2902235-1-chris.laplante@agilent.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW2NAM12FT050:EE_|CH0PR12MB5348:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b1b0f5e-a0a2-4185-7a23-08dbcb617031 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eWj6iti2pkmSTPuzg1h7lv50db+2jOwIRAXfAnCZNmVBtEYiTZZXY1tHpQvORUPixsoDaAiDT/ZyxQ7RM8zSMJAu5EdKXh8vuvs6vCQHQlgFOEXZUhoVZBuo8bGWkPGhNKcaSr26zBfPQTd4cJZXyja5F7Bmz8NxTtucWuxnVyC1iDn6SFnHbJofaSUeIUcAOoExQgziH9Sl64YhLl5F4iD8+hjZTyKgsF/OPzpZe/wvLypMR5Af1mJJB7jsuDqoRjX5NHTBt96wKuY62Wos8i11xK30dS3USzPTPhbmXI5BMFpnOw0PvLARacwgmbklNSBQDXtvwWvWHsitq0u4sTd6xpUJlEXR8wIJpyK04hQtBFjOhp9m/xtEsFniyAJv/PHUgV9iueAHMNjbSq6Nj/qo3DhBjiXKrMpMcEOAyUPQG/AtJb/jv/man2L+2ZMzflgzneCzW5wyv7lNJadG1wQx0g56PLyGD3hp4j7vIvdbYGrK6kPoNXHOmTD5OtZK6yibH1mdtX2YT9wYmLqCcO8Q1JIdkTsE0cWCEr3nLWdIMUOKL4xWHG8fxrtIfTmo7pPOa+wYlBfLdEzEjfvYjxHaVrmmAWgSqyhpzRnRByBdt9dRyZKbSLxEIHoPi6n+LQeN5GJ/paFk10BxZLJ9XSOSSA7OaQV1rAkTGOgUQ4UH0PtD9fOI+oqZsrz1Lq+gvd/dMTKSAUfEWqb7cExahWgOly2EDQSSDJ9hqKa7ax5VXmjiCTbOv1mrm2GUE6uu X-Forefront-Antispam-Report: CIP:192.25.218.41;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edgeappmail.agilent.com;PTR:exch.smtp.agilent.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(346002)(396003)(136003)(230922051799003)(1800799009)(64100799003)(451199024)(186009)(82310400011)(40470700004)(46966006)(36840700001)(40480700001)(478600001)(6666004)(47076005)(8936002)(40460700003)(54906003)(316002)(6916009)(70206006)(356005)(82740400003)(7636003)(2906002)(41300700001)(8676002)(36756003)(5660300002)(2876002)(4326008)(86362001)(4744005)(36860700001)(26005)(2616005)(956004)(1076003)(83380400001)(107886003)(336012)(426003);DIR:OUT;SFP:1101; X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 20:25:55.6520 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b1b0f5e-a0a2-4185-7a23-08dbcb617031 X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.41];Helo=[edgeappmail.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-MW2NAM12FT050.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5348 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 ; Thu, 12 Oct 2023 20:26:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/189022 From: Chris Laplante Call _check_src_repo to confirm that the 'devtool' branch is setup as we expect. This would have caught the basic case of the bug (i.e. where override branches are not involved). Signed-off-by: Chris Laplante --- meta/lib/oeqa/selftest/cases/devtool.py | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index b577f6d62a..a5ef0329df 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -2166,6 +2166,7 @@ class DevtoolUpgradeTests(DevtoolBase): bitbake('%s -c clean' % kernel_provider) #Step 4.1 runCmd('devtool modify virtual/kernel -x %s' % tempdir) + self._check_src_repo(tempdir) self.assertExists(os.path.join(tempdir, 'Makefile'), 'Extracted source could not be found') #Step 4.2 configfile = os.path.join(tempdir,'.config') From patchwork Thu Oct 12 20:25:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 32061 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 B016ECDB47E for ; Thu, 12 Oct 2023 20:26:04 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.46]) by mx.groups.io with SMTP id smtpd.web10.23205.1697142360756539926 for ; Thu, 12 Oct 2023 13:26:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=AuKjo11a; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.107.101.46, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=deCL5BLVeYMatYM9DNmXg2sXJycjKVJSDqKs1nlOB+EEB0ukYcP7TM9mNgilgqBnfnvYc02QBS2FiEG39OdseaEYT29ITMP2c9pzAePxwcW5N8EVvgB/hTXkWRI1aJsPCYy9NsZdTQVhS4Wf41IwbkoefDMK3bNPT8zfq1jKDSqVk5i/ZoeRGbrGpAE3aNRGoXWLibGAvcU8yUMXhWrCVplJaI5WmleE9lddxUIIVNj7QX7FE9UIj+tQRSnOJyQjhd223JUg3aJXJk4j12uTNeicPRfbB/osYuJqRYalI5ngbN6CY53a1qQXwAkvjJxyElPKolle5GRtAf/d/IJVFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=nJRTOjmQAj5dDhXk/aq6Eq/1ldDSBGEVoGFMK7IHqh0=; b=dkRFNRQLBtsazYgUxOpAmQMje2s+WYCmeti9t0TdbI+CY8mgUTg8MS0PHTp+SfiVGOYnyu0EQ+7PGn9CgV71mVpSvhj08uqkFXHt415qUv/5vUAv20TxnCI3rt7X/VhVpSZKukgHxBSQLqnGSKmDRfqBVkLOlsgN/bkTDAxWBghG4xhQq0SyYNxbzCfzxscCioWQIQqLcdO269AklhJaSqS80tFf0F+7Nr42S/zWWzsG8FbHPmt6+7V1dadmd1+gFNgj9U4WcG1hhatQo62PkyTO+Ua0H+MzmW4yWFWh8lHcSs9rh0T/8wNBGFX06ZeiRSzuvxJnwMgxULftF4b5/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.41) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nJRTOjmQAj5dDhXk/aq6Eq/1ldDSBGEVoGFMK7IHqh0=; b=AuKjo11aA+waYdqx3g1tUZcl+6FtibQRV69vRq0pNAHlkYSNAwjxCZ5WJYr3BPRAZIssYAiQ4ifqC2rZBYEbWR3qmDZ2i1s5hyv1Z8c2GOZjzY8JmZxVsGcYSEbikccEd/VJn1B3KYbV305ftzVBan9/u/mm9a9GlDWZ1wkgbrEL4SKRxHA2FI8nzj3BUVKWyyFpo4F8ooVt3NJ2gE3+N8Ynnmerj/GByGYkmYLJbF1014YgFtvKGlssrgtT/cTeXC6G4iNfOvr5kas9eJAGscmmzkhGC+X56tmUo9LwtSNCBHk1xL5NTAkkGM8fsQGoFGbQGB41wjOxgk/dGt/hWA== Received: from MW4PR04CA0150.namprd04.prod.outlook.com (2603:10b6:303:84::35) by BL1PR12MB5851.namprd12.prod.outlook.com (2603:10b6:208:396::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Thu, 12 Oct 2023 20:25:58 +0000 Received: from MW2NAM12FT067.eop-nam12.prod.protection.outlook.com (2603:10b6:303:84:cafe::22) by MW4PR04CA0150.outlook.office365.com (2603:10b6:303:84::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.29 via Frontend Transport; Thu, 12 Oct 2023 20:25:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.41) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.41 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.41; helo=edgeappmail.agilent.com; pr=C Received: from edgeappmail.agilent.com (192.25.218.41) by MW2NAM12FT067.mail.protection.outlook.com (10.13.181.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.12 via Frontend Transport; Thu, 12 Oct 2023 20:25:57 +0000 Received: from chris-virtual-machine.localdomain (192.25.126.5) by edgeappmail.agilent.com (192.25.218.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Thu, 12 Oct 2023 14:26:52 -0600 From: To: CC: , , Chris Laplante Subject: [PATCH 3/3] oeqa/selftest/devtool: add test for YOCTO# 14723 Date: Thu, 12 Oct 2023 16:25:35 -0400 Message-ID: <20231012202535.2902235-3-chris.laplante@agilent.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012202535.2902235-1-chris.laplante@agilent.com> References: <20231012202535.2902235-1-chris.laplante@agilent.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW2NAM12FT067:EE_|BL1PR12MB5851:EE_ X-MS-Office365-Filtering-Correlation-Id: eedeef1f-e551-47b2-4f15-08dbcb617130 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L3PjwYgZEc+vAt3H1y5v87PEHLZS1FT0D/x5IjZqs5h9GmrgaVPQiF/hUgCmFjI7nwJ0BwHzfvvBTFcd6ukySA2hk69XouAs1YgpXQ89hb9V3XUVixGk3/z6eYHWhQmY3aVlptFh2opEhSNtg+laU0b81G4QtDVe+/SYNQjPNKxkzyrb0l8V7Y4jhpL7vDCK+TS5XbIhM6bXb4wYA9ZjKiGRVB+/qT5Y10+b8ZPwQq+fVOEF6sEQ2q7iUIwy6lSHQJNtjKsyHU9m3YtNKzwupqKl+PgTy8yddFgNL7c1mDU6aOjz4lVK6c+KUsexUrVbwSHhCAVRJ6uljDNjE44eLYsBPVDmx/03Ez6cne6E27K23TEk50aZTZHeTl5olMcYlktPLvVqW624e70gHnveQmIsxAXlkZy3yPAOCsYfCexSSKcmkfaFjXyCnnmZz2KTCtJCvgOGEDOHbfKQedE+nKvpuib1T0Of3COGqYgc5Dtf8UdY5POO6W+Ttp7aNTi4SPoQDRdArA/tDWJw4xDVYhHARleCRa9rOB9q/cvjCe5pqT5H+Ll1vM5Epl2XV6OzLA4/OOzJB2F73IlGvvBfOBFkyD2ebt2vWqmODz/1UGiSXwRAQDbgOqcScAejDMgy/FxAv4PujRpulVNFuGFQMwaFaNQW6eFBz5uAqHXOeb3hQ9Ek+grE2ve9sjjlUJVAu7AZwYNgOe5fXPFLglEQmW8jmuE+rGFQtQ2Sc0UFmv/IVUea2tmSdPC1ZTK79LPe X-Forefront-Antispam-Report: CIP:192.25.218.41;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edgeappmail.agilent.com;PTR:exch.smtp.agilent.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(64100799003)(1800799009)(451199024)(82310400011)(186009)(46966006)(40470700004)(36840700001)(40480700001)(1076003)(2906002)(26005)(54906003)(47076005)(336012)(426003)(83380400001)(82740400003)(7636003)(356005)(8936002)(4326008)(36860700001)(5660300002)(2616005)(478600001)(316002)(41300700001)(2876002)(8676002)(70206006)(107886003)(956004)(40460700003)(6666004)(6916009)(86362001)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 20:25:57.3221 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eedeef1f-e551-47b2-4f15-08dbcb617130 X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.41];Helo=[edgeappmail.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-MW2NAM12FT067.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5851 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 ; Thu, 12 Oct 2023 20:26:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/189024 From: Chris Laplante This relatively exhaustive test is designed to exercise the 'devtool modify' workflow for kernel recipes, with a focus on SRC_URI override branches. Signed-off-by: Chris Laplante --- meta/lib/oeqa/selftest/cases/devtool.py | 132 ++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index a5ef0329df..1072e23c21 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -2197,3 +2197,135 @@ class DevtoolUpgradeTests(DevtoolBase): #Step 4.5 runCmd("grep %s %s" % (modconfopt, codeconfigfile)) + + def test_devtool_modify_kernel_overrides(self): + """ + [YOCTO #14723] + + Test that patches in SRC_URI overrides round-trip correctly through devtool modify, especially when + appends/prepends are present. + """ + import typing + + # Perform some initial setup + kernel_provider = self.td['PREFERRED_PROVIDER_virtual/kernel'] + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake -c clean %s' % kernel_provider) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + + # Collect some information for later + machine = get_bb_var("MACHINE") + recipefile = get_bb_var('FILE', kernel_provider) + recipedir = os.path.dirname(recipefile) + res = re.search('recipes-.*', recipedir) + self.assertTrue(res, 'Unable to find recipe subdirectory') + recipesubdir = res[0] + + new_file_contents = "A new file" + + bitbake('%s -c clean' % kernel_provider) + + # We are going to call 'devtool modify' multiple times in this test, so we use a context manager for the temp + # dir rather than call 'track_for_cleanup', since we want the tempdirs destroyed between sub-tests. Also it's + # easier and clearer this way. + with tempfile.TemporaryDirectory(prefix='devtoolqa') as tempdir: + runCmd('devtool modify %s -x %s' % (kernel_provider, tempdir)) + self._check_src_repo(tempdir) + + tags = runCmd('git tag --points-at HEAD', cwd=tempdir).output.strip().splitlines() + self.assertSetEqual(set(tags), {"devtool-base", "devtool-patched"}) + + # Construct a patch to add a file + runCmd(f'echo "{new_file_contents}" > devtool-new-file', cwd=tempdir) + runCmd('git add devtool-new-file', cwd=tempdir) + # Need to add the Upstream-Status otherwise the patch will be rejected next time we 'modify'. + runCmd('git commit -m "Add a new file\n\nUpstream-Status: Inappropriate [OE self-test specific]"', cwd=tempdir) + self.add_command_to_tearDown('rm -rf %s' % os.path.join(self.testlayer_path, recipesubdir)) + runCmd('devtool finish %s meta-selftest' % kernel_provider) + + # Check patch was created + patchfile = os.path.join(self.testlayer_path, recipesubdir, kernel_provider, "0001-Add-a-new-file.patch") + self.assertExists(patchfile, "Patch file doesn't exist") + + # Check bbappend was created + appendfn = os.path.join(self.testlayer_path, recipesubdir, '%s_%%.bbappend' % kernel_provider) + self.assertExists(appendfn, "bbappend doesn't exist") + + def _assert_new_file_presence(exists: bool): + file_path = os.path.join(tempdir, "devtool-new-file") + if exists: + with open(file_path, "r") as f: + contents = f.read() + self.assertEqual(contents, f"{new_file_contents}\n") + else: + self.assertNotExists(file_path) + + # Check that the patch round-trips + with tempfile.TemporaryDirectory(prefix='devtoolqa') as tempdir: + result = runCmd(f'devtool modify {kernel_provider} -x {tempdir}') + self._check_src_repo(tempdir) + _assert_new_file_presence(True) + runCmd(f'devtool reset {kernel_provider}') + + def _modify_append_file(fn: typing.Callable[[str], str]): + with open(appendfn, "r+") as f: + contents = f.read() + contents = fn(contents) + f.seek(0) + f.write(contents) + f.truncate() + + # Modify bbappend to conditionally apply the patch + _modify_append_file(lambda contents: contents.replace('SRC_URI += "', f'SRC_URI:append:{machine} = " ')) + + # Check that the patch still applies and that all branches/tags are created as expected + with tempfile.TemporaryDirectory(prefix='devtoolqa') as tempdir: + result = runCmd(f'devtool modify {kernel_provider} -x {tempdir}') + self._check_src_repo(tempdir) + _assert_new_file_presence(True) + runCmd(f'devtool reset {kernel_provider}') + + # Change the bbappend such that the patch is applied for a non-active OVERRIDE + _modify_append_file(lambda contents: contents.replace(f'SRC_URI:append:{machine} = " ', f'SRC_URI:append:{machine}-fake = " ')) + + with tempfile.TemporaryDirectory(prefix='devtoolqa') as tempdir: + result = runCmd(f'devtool modify {kernel_provider} -x {tempdir}') + self._check_src_repo(tempdir) + + # File shouldn't exist on this branch... + _assert_new_file_presence(False) + current_branch = runCmd('git symbolic-ref --short HEAD', cwd=tempdir).output.strip() + self.assertEqual(current_branch, "devtool") + + tags = runCmd('git tag --points-at HEAD', cwd=tempdir).output.strip().splitlines() + self.assertSetEqual(set(tags), {"devtool-base", "devtool-patched"}) + + # It should exist on the 'devtool-override-${MACHINE}-fake' branch + runCmd(f'git checkout devtool-override-{machine}-fake', cwd=tempdir) + _assert_new_file_presence(True) + runCmd(f'devtool reset {kernel_provider}') + + # Finally, change the bbappend such that the patch is applied to two different OVERRIDES. + # Would get two branches created, devtool-override-${MACHINE}-fake and devtool-override-${MACHINE}-fake2, with + # the patch applied. This tests that patch series generation is working for multiple overrides branches. + # + # The 'devtool' branch will not have the patch applied because there are no active OVERRIDES. + _modify_append_file(lambda contents: contents.replace(f'SRC_URI:append:{machine}-fake = " ', f'SRC_URI:append:{machine}-fake2 = " file://0001-Add-a-new-file.patch"\nSRC_URI:append:{machine}-fake = " ')) + with tempfile.TemporaryDirectory(prefix='devtoolqa') as tempdir: + result = runCmd(f'devtool modify {kernel_provider} -x {tempdir}') + self._check_src_repo(tempdir) + + # File shouldn't exist on this branch... + _assert_new_file_presence(False) + current_branch = runCmd('git symbolic-ref --short HEAD', cwd=tempdir).output.strip() + self.assertEqual(current_branch, "devtool") + + tags = runCmd('git tag --points-at HEAD', cwd=tempdir).output.strip().splitlines() + self.assertSetEqual(set(tags), {"devtool-base", "devtool-patched"}) + + # It should exist on the 'devtool-override-${MACHINE}-fake' branch + for branch in [f"devtool-override-{machine}-fake", f"devtool-override-{machine}-fake2"]: + runCmd(f'git checkout {branch}', cwd=tempdir) + _assert_new_file_presence(True) + + runCmd(f'devtool reset {kernel_provider}')