From patchwork Fri Dec 12 19:08:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Osama Abdelkader X-Patchwork-Id: 76392 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 1E292D59D89 for ; Fri, 12 Dec 2025 19:08:53 +0000 (UTC) Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1126.1765566528296050768 for ; Fri, 12 Dec 2025 11:08:48 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IqWMrGik; spf=pass (domain: gmail.com, ip: 209.85.208.53, mailfrom: osama.abdelkader@gmail.com) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-644f90587e5so2689683a12.0 for ; Fri, 12 Dec 2025 11:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765566527; x=1766171327; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=irjqQWCwgc17nbPT2S8YbDMd0aYEXXOPJFYpP4W7Ui4=; b=IqWMrGiklCDVirpYqHCIvLbt8dmcwAQJLRcRfjt3AphlS4xLOYTQX8wlLrPdL8I7Ge edJBGUBlfBLllpeAJh4swzdPlxa/72k0ikZVGkKonI1cuNVNGHrbP4lhPapyW2FuE+1b /2zVKMvlITC16yM8TW0TFY0H9u0kojRAx+aN2fdH25Z0R4VwaXH12ezUGW+jsfDf35Fj MMQAlIiDgwojuaW+qJD8HSmRS60LBuAL2ZTl4F+hUN0zDCyJKG8k2Y5e9n0+iVq83WuP wJsD4iSYLH4Z+XTLpYukHc9fQOS12Kx+Ko63o7MnbOpoYs9+8I6603xE7+n7M4YdokBH JDww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765566527; x=1766171327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=irjqQWCwgc17nbPT2S8YbDMd0aYEXXOPJFYpP4W7Ui4=; b=B5ZzOmwZr+3PBCAme0hRsQc8bsqzAFdsFgJzLoIyAKIcA1fJmEG5lGSKBebB2x69zi ElYGmVWDq9Us9C0i1gV3XznmNhdRU4Mcqe61HhS26jqBk2GW2GygLrWLx4YgRTkuA1Mn 8fNTcVGgK5F9XdqQblQB8cHwTxH3CAKfApA7Eu6CbhLOZM4O+aok84RtP2lFtaqMQf6z hSQSmcBGcRu2f7AC9hi/f610BGUQHbu2yOaD+umz/tXFraGVzcrpQXjW3KJ9l8ZAuzqA DHfXQyJU2VC2DQQ09HvN9xEMzX9AuSs6Z4w4AR87UzybUgUocsbRelINAkehKePxpJUl jB0g== X-Gm-Message-State: AOJu0YzQcWcoVs6+Bw2rH73IrS0hLs1i5EUClbdkMHO2xgoerQMi6GCQ Qvu83hVTLpwUwU3Unh+J5bv58uhNuWDrDBFSMovz6BFJuH2r/1ppJMsfUIMcJA== X-Gm-Gg: AY/fxX4rQ3nIxoApOct4kjJ7BAyl8RsKymphx/iYCzgBVuVUn6lI8xkruRQh1NHH9Ud 1j2bXVfIi+22TQIa48M5lc/RAlcOPpiUPVFMHb8JvqzlWPOxk2RX3fcGGokZqXdYXOarRNLVWVW f/NXFg67miUYEGfjUCwa898YCRGSUii4BConSV4x44DSOKdxFG6zxGTH/9cVwCzCRUkE7kamU6r bhl5/XcJFeJkuW4hONfy2MiKgoSReHnO5YftqEcG31STBlPCtNC8wcCSK9mmZZ6ra1mu86I1ZuC g9ZirDFVcoeJXCGxEEM/anpcOGmBaKEn07een/6ZVbCtJzUWA9PmOsAGdv5Z0je/F4KWpkm3cb+ jlXDNcd1Syq1d1Pt54HTqz8XmtgysvYwJcsp8q6HxWpodSsICUaynEoaTniH/nbY5k6YSRQ/EqL hLoqBZYa6mbu14yzjSlG86kHq3mQ== X-Google-Smtp-Source: AGHT+IEhvLRqwNKKYNOwOnV+yTvRvgyhqNyDoWIhOsMZ/wSfbTGgiOhvX3IBzhUpux8QhIkgpWS7/A== X-Received: by 2002:a05:6402:2553:b0:645:d764:3fcb with SMTP id 4fb4d7f45d1cf-6499b1e3610mr3178904a12.28.1765566526549; Fri, 12 Dec 2025 11:08:46 -0800 (PST) Received: from osama.. ([2a02:908:1b4:dac0:1401:37b6:6a29:b0c5]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6498210de23sm6147003a12.28.2025.12.12.11.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 11:08:46 -0800 (PST) From: Osama Abdelkader To: bitbake-devel@lists.openembedded.org Cc: paul@pbarker.dev, Osama Abdelkader Subject: [PATCH 1/4] bitbake-layers: layerindex-fetch: Fix undefined stderr variable Date: Fri, 12 Dec 2025 20:08:03 +0100 Message-ID: <20251212190806.32476-2-osama.abdelkader@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251212190806.32476-1-osama.abdelkader@gmail.com> References: <20251212190806.32476-1-osama.abdelkader@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 12 Dec 2025 19:08:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18580 Fix undefined 'stderr' variable in error handling. The variable should be 'completed_proc.stderr' to properly display the error message from the git command. Signed-off-by: Osama Abdelkader --- lib/bblayers/layerindex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bblayers/layerindex.py b/lib/bblayers/layerindex.py index ba91fac669..0ffc95822b 100644 --- a/lib/bblayers/layerindex.py +++ b/lib/bblayers/layerindex.py @@ -58,7 +58,7 @@ class LayerIndexPlugin(ActionPlugin): cmd = base_cmd + ['branch'] completed_proc = subprocess.run(cmd, text=True, capture_output=True) if completed_proc.returncode: - logger.error("Unable to validate repo %s (%s)" % (repodir, stderr)) + logger.error("Unable to validate repo %s (%s)" % (repodir, completed_proc.stderr)) return None, None, None else: if branch != completed_proc.stdout[2:-1]: From patchwork Fri Dec 12 19:08:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Osama Abdelkader X-Patchwork-Id: 76391 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 1F399D59D8C for ; Fri, 12 Dec 2025 19:08:53 +0000 (UTC) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1160.1765566529873683751 for ; Fri, 12 Dec 2025 11:08:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EbNWsCrP; spf=pass (domain: gmail.com, ip: 209.85.208.51, mailfrom: osama.abdelkader@gmail.com) Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-649820b4b3aso2354884a12.3 for ; Fri, 12 Dec 2025 11:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765566528; x=1766171328; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W0JPzdKXc5KmqJpt7gwokOzzoC5/TkLLgG9eJg9GdHU=; b=EbNWsCrP3k9Pnmb0sKN3aBejxiLTpCEwqGnbpDNmZYmW1Ih3MkORHjt4YxAlrqruH+ xgDdjGlVB7M2Df4zM/R9Q5Vf7s0iHAgS32LKsF2N83bwYKtg0IkJ4aq3bhkXHDJ8w7MW pOMGZAaKxooB6YJ1iQtmNzehMIq9RwFZ83IkIfWkMKOnwuMmVJqePJk7k5GbzcZZM0HH olxihsGo5LTKTPRf1hcBZyGOuI4XEBNVs3X6VQUZW+Oo/vbRPDRetWa5aOIi7zVH2XqC pS57wjH4Od03EZ4TFGu6HjVR2ReR/R2rfNhjCmoXaNChhFe4CJvCjDPjgiwPnLm3GxJq GMsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765566528; x=1766171328; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=W0JPzdKXc5KmqJpt7gwokOzzoC5/TkLLgG9eJg9GdHU=; b=SQOT91kd2fmeWd/fNMPdoK+dDHt9pI2cEe8eZGTHVTSfPVZfWozZln72ymJUUYnkNg 4kejYXxSHNnC/YzQmKBTkhccg5sLip8w8IsQ14i0PgnDw16kdv8KgV3vyw38eArADqJ/ 0eOVwlwr4EDTYYw5tdqhSNhTUpKYV+dTbh+Cy5HrMaiv9GkjbdkAJ9L9OZIFMwvvnGUV ih9vbCsYuU3BzX2ht13HIKiBFEjS/Q/enbiqAX4A5sSkTozgctgPJY36ALkLE25xM9SM ELVsmvQbsfAV+Dn+W2bGfhm0YtR3aVRlJz/+E+8Ky32q7dyzD73SjqLYFIPy2Qs2wPYN OYJQ== X-Gm-Message-State: AOJu0YwyOjMB1cDQoNGACY3CL5Z2mWMJIGQdUroGN2OLkdxfEc7h2SqF oiM2tt3PnylaExFA9F5OG6ex2b55IwSMOHoFI7xdvFuZJhd+6V5fcgz9xwJJfg== X-Gm-Gg: AY/fxX7ctDl76pX4BneFNOv19q7xqEeXlGgpTFiVy0WFVqBs/YnuM9nfqqgJkco2f0r 7Ywl5J9GcBCF0gyQxaLZXYeLw8ttWV5BcLAp3FrowYkOF7lkeuk1bs5AsOw8RfHv/HFDWy8vb2v jw1pVDiQLdQr8Y7LtqQpPBqWE1Crfng4L7E1g0H0dhqEsaDW4w//nl7uOMptSbBb8yvHXHJiIxn IMl1Oe/DYKezgPnbccrbvg7Hxpb/lKLAAGLnJ2izOwvDnkMtOHiKwWAqgJL7zGW6fQ1FPJknZm+ a2ahaMwQGr6Gdgj3v3elxiuhg8a774ZD5T/SHB9Q4rcXV3sOgmnytgbqOztvNb/ueyzbbLTF4Mw 4tg3ATGD9MwmtJ7Pjc8lVQp8J/A42MLYgAb4HFv2tXGJ0jm7wT239pFt+aYfSIAv7+gWhy3Zjoe Bq3ItyREVJzOZw3lM= X-Google-Smtp-Source: AGHT+IHmku2k5qnupwBK5KfjWBtllrb7YWdfuWcOJA0eQcUNWeBvUNTqPBIa10/1KxLlvAzqPwyOJA== X-Received: by 2002:a05:6402:1ec4:b0:640:a9b1:870b with SMTP id 4fb4d7f45d1cf-6499b19b438mr2926308a12.14.1765566528218; Fri, 12 Dec 2025 11:08:48 -0800 (PST) Received: from osama.. ([2a02:908:1b4:dac0:1401:37b6:6a29:b0c5]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6498210de23sm6147003a12.28.2025.12.12.11.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 11:08:47 -0800 (PST) From: Osama Abdelkader To: bitbake-devel@lists.openembedded.org Cc: paul@pbarker.dev, Osama Abdelkader Subject: [PATCH 2/4] bitbake-layers: layerindex-fetch: Fix branch detection method Date: Fri, 12 Dec 2025 20:08:04 +0100 Message-ID: <20251212190806.32476-3-osama.abdelkader@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251212190806.32476-1-osama.abdelkader@gmail.com> References: <20251212190806.32476-1-osama.abdelkader@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 12 Dec 2025 19:08:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18581 Replace fragile parsing of 'git branch' output with the more reliable 'git rev-parse --abbrev-ref HEAD' command to get the current branch name. This avoids parsing issues and is the recommended way to get the current branch name. Signed-off-by: Osama Abdelkader --- lib/bblayers/layerindex.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bblayers/layerindex.py b/lib/bblayers/layerindex.py index 0ffc95822b..1c6511889d 100644 --- a/lib/bblayers/layerindex.py +++ b/lib/bblayers/layerindex.py @@ -55,13 +55,15 @@ class LayerIndexPlugin(ActionPlugin): switching branches if necessary and possible. """ base_cmd = ['git', '--git-dir=%s/.git' % repodir, '--work-tree=%s' % repodir] - cmd = base_cmd + ['branch'] + # Get current branch name + cmd = base_cmd + ['rev-parse', '--abbrev-ref', 'HEAD'] completed_proc = subprocess.run(cmd, text=True, capture_output=True) if completed_proc.returncode: logger.error("Unable to validate repo %s (%s)" % (repodir, completed_proc.stderr)) return None, None, None else: - if branch != completed_proc.stdout[2:-1]: + current_branch = completed_proc.stdout.strip() + if branch != current_branch: cmd = base_cmd + ['status', '--short'] completed_proc = subprocess.run(cmd, text=True, capture_output=True) if completed_proc.stdout.count('\n') != 0: From patchwork Fri Dec 12 19:08:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Osama Abdelkader X-Patchwork-Id: 76393 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 2F64BD59D8E for ; Fri, 12 Dec 2025 19:08:53 +0000 (UTC) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1128.1765566531598446146 for ; Fri, 12 Dec 2025 11:08:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AIr8rxcM; spf=pass (domain: gmail.com, ip: 209.85.218.52, mailfrom: osama.abdelkader@gmail.com) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-b79e7112398so299386066b.3 for ; Fri, 12 Dec 2025 11:08:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765566530; x=1766171330; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NsylsrwFUZoShH526iV6ncpDfhrJZAYWHjPtLHhFikA=; b=AIr8rxcM0ptx/kWAvofNSEHucj6cbkxBDh9LimPZg3aQYW4VP45F1Zrx14p6k7zVBk DAoqsl3UAJ+gLRUt0IS18HIcb/MRyhNOnzHmRTDsKbCYSMSqS/DkKzh0utDNvgcGEqbT Pe+lY9yZ5IRM1fcarI9KsCHWpihRpjS7p0tOj7uO+8bSeMLCvSgkVlF627mlm1KeIW9H WuH6X4vzyt2n4VhFVAnjdOusPZ8tl6Z2DfDAFjULHaR9wxfinThh0KQrq6SUe2M0PBEO 0gX4eAHBefvv6LfJWjg+/I9TgJNUqTQrCfDJmQyR5WNALhjTBLeIG/llGG0WeHX2fO7H 3ufQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765566530; x=1766171330; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NsylsrwFUZoShH526iV6ncpDfhrJZAYWHjPtLHhFikA=; b=TJl4yyoSVH+P4Zi3p3zQRQLJC04M9aMfpKNIskjQS202va7Rn3dj5hb4QHdVT2jUYA 7rsDGn1I1EeaKTmmS4+Gvz2Ny7xJzpfKbvbDvwJycXzSMe5l32nUVMGbqZavvgLr0AtM ZjTGSuGLrvOYlucP1JFudR1+cPAnDIDvRk9zsosvt5WA7QBCD9q0Mi0TToscIKaMo1gx V9TAbItqi19OrdTwI0faHYI+rHRncWQf/mYsHzko6ybraFDE6B6sQhpL8byvWBysWN7L NFDiWigkFT0sUpi0qrFD1VnigkgJohWtR9KORo30Ry749DvJvUByGzMBQHLGp+6FhRU2 pSjg== X-Gm-Message-State: AOJu0YzU8gE1hijG8qagQyT+tj9ePx9vpZj8WoxOP9hAe5mVgXRmv4p7 XRJy+988MuDM4wJk54gFrM8eSlGMwkDjKg+aatz3Vp/FEOpbdpzxuJ4p1WqGlg== X-Gm-Gg: AY/fxX6gio4aqNSIWf+WIrLBGWwtuqtBaHWc8QH0BfYFU7GgF5sitoIG5IZFOJH+xLv 5+Nlz8tCW/8LDHavRqGhVHesUIbX9GkfmR74GtdBPvoVnxAF1Ey/mHIXDyDR/DpWYraOijr/Ke6 Yh2huDnYQqwNvdAKMQwQM9ZQKT0bGdmZ8PeqmGYjjVNI4cR6ynTRYjzXUih5vBEFTxnK1tnO7Mv 3P37RIA78Md8FfR6Pq/Znkcl/m1zrH48zxOkiSkCj1Oe8cb9zepmMDsOK/mCVrf5NPUZapWX3jA x0x44dLS5lgq9IaH8jsAbAYBIPB38JVO2bpo30ADq45QNqDTperzv83HD1fkXdRA4kBg96Q+v9a Y/NqycmTaKEgQ7EpCr9xKL4okuVtrpBP4zE/3f3yWBgxeQF97uLwsoScrdEC+df0S5B/d/GPurD 55YFT3jnERPDi9qhU= X-Google-Smtp-Source: AGHT+IFQRe4pzciEtNymzbxoSXKvkkJ54ZAqAyAQHVssUQ7EbLI2DUThlquB/zwm34Ind+dxZEPLNA== X-Received: by 2002:a17:907:cd07:b0:b76:3c91:68d with SMTP id a640c23a62f3a-b7d238b9589mr241367466b.33.1765566529908; Fri, 12 Dec 2025 11:08:49 -0800 (PST) Received: from osama.. ([2a02:908:1b4:dac0:1401:37b6:6a29:b0c5]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6498210de23sm6147003a12.28.2025.12.12.11.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 11:08:49 -0800 (PST) From: Osama Abdelkader To: bitbake-devel@lists.openembedded.org Cc: paul@pbarker.dev, Osama Abdelkader Subject: [PATCH 3/4] bitbake-layers: layerindex-fetch: Respect --branch for already-configured layers Date: Fri, 12 Dec 2025 20:08:05 +0100 Message-ID: <20251212190806.32476-4-osama.abdelkader@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251212190806.32476-1-osama.abdelkader@gmail.com> References: <20251212190806.32476-1-osama.abdelkader@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 12 Dec 2025 19:08:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18582 When --branch is specified, prevent the early exit that skips branch verification. This ensures that even if a layer is already in bblayers.conf, the command will still check and switch to the requested branch if needed. This fixes the issue where the command would exit early with "You already have the requested layer(s)" without verifying the branch. [YOCTO #7852] Signed-off-by: Osama Abdelkader --- lib/bblayers/layerindex.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bblayers/layerindex.py b/lib/bblayers/layerindex.py index 1c6511889d..e0df630a7f 100644 --- a/lib/bblayers/layerindex.py +++ b/lib/bblayers/layerindex.py @@ -120,7 +120,8 @@ class LayerIndexPlugin(ActionPlugin): # Fast path, check if we already have what has been requested! (dependencies, invalidnames) = cookerIndex.find_dependencies(names=args.layername, ignores=ignore_layers) - if not args.show_only and not invalidnames: + if not args.show_only and not invalidnames and not args.branch: + # Only skip if no specific branch was requested logger.plain("You already have the requested layer(s): %s" % args.layername) return 0 From patchwork Fri Dec 12 19:08:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Osama Abdelkader X-Patchwork-Id: 76394 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 216B8D59D8D for ; Fri, 12 Dec 2025 19:09:03 +0000 (UTC) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1133.1765566535153013310 for ; Fri, 12 Dec 2025 11:08:55 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BiDbdC2S; spf=pass (domain: gmail.com, ip: 209.85.208.46, mailfrom: osama.abdelkader@gmail.com) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-64162c04f90so2852331a12.0 for ; Fri, 12 Dec 2025 11:08:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765566533; x=1766171333; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ph+daK79Ou00YTwOHIZNnlYG48ho0QoebMiBDmEhzPM=; b=BiDbdC2S8Qg/HdwffpVuZaLwT01xoDVgpLF2kq9NPauaVFGIDigkeixU10mOazhdGN WoIb0xvzbIiUdFdWkQWai70rgbB2aTptu6guGZtRP97df1c0eUwBPSR4tEcXsMWs3c47 0PPxVAJiKlxJinP5r5Y8fL7xz9THwl8G8U8yXNm9k2PcyuM3b/XIEgSPpckkdenRI37X R+IXJVsYO8zrw5ZyxConZVPZNvaAHDXjHWQ0FNkwQ/myriff36HJLvjuYrIhIPTzKTyj PURYzuVJf/1XH///f4Ffw4bltWn69zI6anmVu8nO9N3hSmVsyS5K2X3wHxBfpJoeMSAx MutA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765566533; x=1766171333; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ph+daK79Ou00YTwOHIZNnlYG48ho0QoebMiBDmEhzPM=; b=oavaIUuowvkPkhinzD/QLGL+hQ4JGLKeuzftwuFzbx29TIx0jHMzF7je+gU7gQoig7 E6xrCe2rqTsqNkJLcXI7kHNHUcNuuON2qAQ0TWYav0haQXWY/Dv6YBfiJ+JDPkTaHdfH WiB9kz7CJHgnOCzWc6+zZ7808pqz/3BImmyqdrYoTb1H2loA4bdQcAK3wuLVbTaDJus5 uBVsAVOS/dlrR8x2H5SDYVX8LgQ1zOX6g9S+ruznQjzr05kwuZOVwy/uTmkMrMJsfPSv XiybYcGuDvf8kqE6XQeT4p2iWdQg6o/6epxiax1WxGAOp2vSfnFubZoZec6r4k9YIjzZ B11w== X-Gm-Message-State: AOJu0YzzXI2qQ+nopd09blQnEWCGF6YCsPyys7NIIQ2es6/NpCLayLmf KF1XoNnrGT9ffLIFiduTxrZ/zvuJFEFj5Ndonl8XyMtbquL4PzD8Mx3YQPC4iw== X-Gm-Gg: AY/fxX4HMdR/p7jVESWzmtfF9dUtTDgmeFGjv/vyX93ha4vI8dW9jFbZFMf2f62EZcx jXiaHSb+vS2jr4knvrbQ50OOiyLxh0x6RBOh5wg82p6tedi2KDf76TodXMM6rjQEoj6dl1cbssc kZKu3uxAfYpRXGwUB2bRuItqkMsFNV1uqp5hN8/4LDEr+p1brxXNBQGLVw1KcGNK1Y7RrNp5xDx 7jnRJ0KNPebriVnGgk1iRbDO2j6Z5j7dcdmQ9vG1DhcGrzjPhgdaJ7i7FsFscYhmpeIbvKDvGJ7 CIZjOESupq+by1k1FEJ2NmqZaIijMbpw7ffBggq8EPvWQgCF9UxDsrvW5sfI1UjVAdyfjkIFxRz PMD5si+GYAGVVGxEqg5WwdXQ/Ia6Z9QpfBQEwusmtxHUO7fdg4ATiRC1siP8jpNKamn8VN5snzR G9m2ezOjtTyGmeNwPcS501jPcAOQ== X-Google-Smtp-Source: AGHT+IEcgRGq/HVyvdLB5U9AJt1Moc3vmx4zXLNF8UUH/xvhSbtuHw1vp0x7O+7c8lJHl7K8uWihGw== X-Received: by 2002:a05:6402:5194:b0:649:2336:deed with SMTP id 4fb4d7f45d1cf-6499b1cc740mr3155054a12.16.1765566533395; Fri, 12 Dec 2025 11:08:53 -0800 (PST) Received: from osama.. ([2a02:908:1b4:dac0:1401:37b6:6a29:b0c5]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6498210de23sm6147003a12.28.2025.12.12.11.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 11:08:51 -0800 (PST) From: Osama Abdelkader To: bitbake-devel@lists.openembedded.org Cc: paul@pbarker.dev, Osama Abdelkader Subject: [PATCH 4/4] bitbake-layers: layerindex-fetch: Add branch check/switch for cooker layers Date: Fri, 12 Dec 2025 20:08:06 +0100 Message-ID: <20251212190806.32476-5-osama.abdelkader@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251212190806.32476-1-osama.abdelkader@gmail.com> References: <20251212190806.32476-1-osama.abdelkader@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 12 Dec 2025 19:09:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18583 For layers already in bblayers.conf (cooker layers), add logic to check and switch branches when --branch is specified. Previously, cooker layers were skipped entirely in the fetch loop, so branch checking never executed. The code finds each layer's git repository root, determines the subdirectory relative to the repo root, and calls get_fetch_layer() with the requested branch to perform validation and checkout if needed. This completes the fix started in previous commit, allowing users to use --branch to switch already-configured layers to different branches. [YOCTO #7852] Signed-off-by: Osama Abdelkader --- lib/bblayers/layerindex.py | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/bblayers/layerindex.py b/lib/bblayers/layerindex.py index e0df630a7f..72d2eb8fb7 100644 --- a/lib/bblayers/layerindex.py +++ b/lib/bblayers/layerindex.py @@ -205,8 +205,44 @@ class LayerIndexPlugin(ActionPlugin): for deplayerbranch in dependencies: layerBranch = dependencies[deplayerbranch][0] - if layerBranch.index.config['TYPE'] == 'cooker': - # Anything loaded via cooker is already local, skip it + is_cooker_layer = layerBranch.index.config['TYPE'] == 'cooker' + + if is_cooker_layer: + # Anything loaded via cooker is already local + # If a branch was specified, we still need to check/switch branches + if args.branch: + # Map collection names to layer paths (same as cooker plugin does) + layerconfs = self.tinfoil.config_data.varhistory.get_variable_items_files('BBFILE_COLLECTIONS') + bbfile_collections = {layer: os.path.dirname(os.path.dirname(path)) for layer, path in layerconfs.items()} + + # Get the layer path for this cooker layer's collection + collection_name = layerBranch.collection + if collection_name in bbfile_collections: + bblayer = bbfile_collections[collection_name] + if os.path.exists(bblayer): + try: + # Find the git repository root + gitdir_cmd = ['git', '-C', bblayer, 'rev-parse', '--show-toplevel'] + result = subprocess.run(gitdir_cmd, capture_output=True, text=True) + if result.returncode == 0: + repo_root = result.stdout.strip() + # Get the subdir relative to repo root + rel_subdir = os.path.relpath(bblayer, repo_root) if bblayer != repo_root else '' + # Get parent dir of repo as fetchdir + parent_fetchdir = os.path.dirname(repo_root) + # Now call get_fetch_layer to check/switch branch + # Use args.branch (the requested branch) not layerBranch.actual_branch (current branch) + _, name, _ = self.get_fetch_layer(parent_fetchdir, + layerBranch.layer.vcs_url, + rel_subdir, + not args.show_only, + args.branch, + args.shallow) + if not name: + # Error during branch check/switch + return 1 + except subprocess.SubprocessError: + pass # Not a git repo, skip continue subdir, name, layerdir = self.get_fetch_layer(fetchdir,