From patchwork Wed Nov 5 19:06:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 73664 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 62FD1CCFA0D for ; Wed, 5 Nov 2025 19:06:48 +0000 (UTC) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.17903.1762369603657175968 for ; Wed, 05 Nov 2025 11:06:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=B+U3RDzQ; spf=pass (domain: gmail.com, ip: 209.85.221.53, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-4283be7df63so93649f8f.1 for ; Wed, 05 Nov 2025 11:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762369602; x=1762974402; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=n6X0NzrMvAdH76unAbmRzJdzkqIvPNo3kGTofpqT23U=; b=B+U3RDzQKs6sYOQ9DMoTDz/4ZD5LY6+nNtjNUUwjKSybXTfE4+JcJlXGUUhnMaPYrl jYgwmv1eBvE2p2SdECumFwcdn9tVVfSaRZgApsvuQfESwgDV/gMHAPabfdlpokFZRZJj +AbVcy1NYYcz9T5ebAS6HyFMp1OI796khmuIR+IRAOgRfZ0DpgBFvbUD65fXpwu/bi6j LptRcKFsZ0bkNZV3hyPw2GSqA45svAdPxBunO4Wfnyx6oV7graKHur/mMYlUK0IQv/Vl zurgd9SVJPnCb7a+ljZfSSevaaavjkFYiV1AY6WIGWV4by1edSZrErIQbs/yyH21H0/k 5hyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762369602; x=1762974402; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n6X0NzrMvAdH76unAbmRzJdzkqIvPNo3kGTofpqT23U=; b=v+2ij6u+QMrjHB1fK9g/y/7NQhU2dSpAQ5vgbB/kWRaenLSCDKaMqPMZ/pVvmuzZcs qPPbNvWOkebSm8PoTxxgmjP7Up47c/CdN1l0893MUwuTBDu5earnzdCUkxahGr8Li819 NypPDwktk6EFt2V5uLtfXN8AJ4bmoj6VQPSgT+Mo2fecMONS1xNmdIMgmQ2VxeX+STm2 2b6EYUJSCk4VCsmSQal2vaUa0pjZ6l7H/vGl4LdFBMNCwhVVzH16vnRx8l4I5Qxv7vD9 S8QDn0K1Uhg6/Zjqm+2fejll9emNLn6dYIPMlG4xqjevw5937hqOhC2X2kk4xcWQDWJ1 RKjg== X-Gm-Message-State: AOJu0YyHZslLbsPucY5YmKMbtVsELVbd/5jOXudmmAMLdKTnL4UcDhr8 1lnVLNuxt4J0vEASTCo2tvcci0bEEdHalJ4pPiJ0KyNaH70TNhbh9xWt7Wt/AQ== X-Gm-Gg: ASbGncvNBX9j9YaN7U5I53TE0E3jGlX9uaDXnypwxoMmspxc/ToBjlw7gWDJieoAc6y yiDBOR+gKCygQK/lcuW7FmGITcPv0Jdqt8T64mS27JK5PCybQ6zMcycQUe9wrbvBfp2QhUPp6g4 CSYwFFnmT5AXgTxLPr/jEonI0ZzjbRWMB7GczmVJzzeCljqxKpTuaJM7F0KNIIoA+s1558Y8KmP t4mx0LDWjY74Cb7JQ2KwRfJC4oT4K3aNjFtPHl6XoyFAtZQLtC+eWYEabqNXqVSXereRlOgr1hx NPYeF6gso7jDaSL44qVAhRd6Kv9Y9iOOMTCsFIBK2T/3cSuiW/ufj0bSRvQ6MsKlEQeaHzCKTKA BwVuyVc3V1xQO/778Qi2D/HsUOUeyfZ85+r9v/1LI33dR9Jb6WkHKOlXaaJVQCfo/STUy8RC2P2 73d8VNJvnxOqU/Ay83BVWUge4y+favoEriQnMP X-Google-Smtp-Source: AGHT+IHN/Y6G1OD9GKGPUdUjosqNU6MVSgq2HNVj9vydWRW8ytJih6jEGLJRlMX9PX9gszrNdxkpqg== X-Received: by 2002:a05:6000:22c4:b0:429:927e:f2d with SMTP id ffacd0b85a97d-429e33056eemr3856589f8f.38.1762369601735; Wed, 05 Nov 2025 11:06:41 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb477203sm313840f8f.29.2025.11.05.11.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 11:06:41 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Johannes Schneider Subject: [PATCH 1/6] bitbake-setup: rename function 'default_settings_path' to 'topdir_settings_path' Date: Wed, 5 Nov 2025 20:06:31 +0100 Message-Id: <20251105190636.679388-1-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 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 ; Wed, 05 Nov 2025 19:06:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18270 From: Johannes Schneider Rename the function to align with the corresponding 'global_settings_path' function, and move it down just above the later. This is done to differentiate from the built-in default settings, and to align with the other places in the code that use 'topdir_settings' (or 'global_settings') Signed-off-by: Johannes Schneider --- bin/bitbake-setup | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 3cd67805f..a9035e7c8 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -634,9 +634,6 @@ def install_buildtools(top_dir, settings, args, d): print("Buildtools archive is downloaded into {} and its content installed into {}".format(buildtools_download_dir, buildtools_install_dir)) subprocess.check_call("{} -d {} --downloads-directory {}".format(install_buildtools, buildtools_install_dir, buildtools_download_dir), shell=True) -def default_settings_path(top_dir): - return os.path.join(top_dir, 'settings.conf') - def create_siteconf(top_dir, non_interactive=True): siteconfpath = os.path.join(top_dir, 'site.conf') print('A common site.conf file will be created, please edit or replace before running builds\n {}\n'.format(siteconfpath)) @@ -653,6 +650,9 @@ def create_siteconf(top_dir, non_interactive=True): with open(siteconfpath, 'w') as siteconffile: siteconffile.write('# This file is intended for build host-specific bitbake settings\n') +def topdir_settings_path(top_dir): + return os.path.join(top_dir, 'settings.conf') + def global_settings_path(args): return os.path.abspath(args.global_settings) if args.global_settings else os.path.join(os.path.expanduser('~'), '.config', 'bitbake-setup', 'settings.conf') @@ -667,7 +667,7 @@ def change_setting(top_dir, args): if vars(args)['global']: settings_path = global_settings_path(args) else: - settings_path = default_settings_path(top_dir) + settings_path = topdir_settings_path(top_dir) settings = load_settings(settings_path) if args.subcommand == 'set': @@ -709,7 +709,7 @@ def get_top_dir(args, settings): setup_dir_via_bbpath = get_setup_dir_via_bbpath() if setup_dir_via_bbpath: top_dir = os.path.dirname(setup_dir_via_bbpath) - if os.path.exists(default_settings_path(top_dir)): + if os.path.exists(topdir_settings_path(top_dir)): return top_dir if hasattr(args, 'setup_dir'): @@ -720,10 +720,10 @@ def get_top_dir(args, settings): top_dir_name = settings['default']['top-dir-name'] return os.path.join(top_dir_prefix, top_dir_name) -def merge_settings(builtin_settings, global_settings, local_settings, cmdline_settings): +def merge_settings(builtin_settings, global_settings, topdir_settings, cmdline_settings): all_settings = builtin_settings - for s in (global_settings, local_settings): + for s in (global_settings, topdir_settings): for section, section_settings in s.items(): for setting, value in section_settings.items(): all_settings[section][setting] = value @@ -841,7 +841,7 @@ def main(): # This cannot be set with the rest of the builtin settings as top_dir needs to be determined first builtin_settings['default']['dl-dir'] = os.path.join(top_dir, '.bitbake-setup-downloads') - topdir_settings = load_settings(default_settings_path(top_dir)) + topdir_settings = load_settings(topdir_settings_path(top_dir)) all_settings = merge_settings(builtin_settings, global_settings, topdir_settings, args.cmdline_settings) if args.func == settings_func: From patchwork Wed Nov 5 19:06:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 73666 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 8B35BCCFA1B for ; Wed, 5 Nov 2025 19:06:48 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.17904.1762369604156097405 for ; Wed, 05 Nov 2025 11:06:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=H+7c0YXo; spf=pass (domain: gmail.com, ip: 209.85.221.50, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3ee130237a8so133341f8f.0 for ; Wed, 05 Nov 2025 11:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762369602; x=1762974402; 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=uYCNFMpdWkQFM4DMFhg+r/4DTkF+qIKKphTbOWJeHo8=; b=H+7c0YXo3UjA1uGeMll/7yDQoBN3/U9yudvNUSmsIqZDZo2z/zqs98Xzf83I4HPTCw Vecpfd9irz40pDkqO05A9KIFJTmCL6RBD/Q19ZaQRBc7N4of02a88Iv5Tar1GZYw2B0V eR0DTgHCboUxBy47u5eBOG4Spk78YLKILfD65zE5EZnGoHfwOHf56Y05OvQHFRre6ij+ qZOH8g2bX+y8Pma2lNsKHo9YwOQWKFdm3p9avorqtBeNt5N3G2PmEtkvCdAOBgcky4lz mpLBnHQphzS9LiBrRWHQzhkkypbjt5LLiXc1ge+h2QqxJEEt+JTfri4SMjiRRq3L+fH/ 6a5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762369602; x=1762974402; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uYCNFMpdWkQFM4DMFhg+r/4DTkF+qIKKphTbOWJeHo8=; b=SCLWQ+Zx4c0nIMvcAzburHIx62O0pSmlHQ6x86+UTtaVn7swTnjM9oCguRI0nbjCaW ru0O47tMFjpHxQltD5NcyLiDc7MbtJEkyOQD3/Tplxr5Fnmh0980q3g86SxXWUnXkJiN ILIcCcqT1dA6+jJyRWTVcGeUpMeZhQzeewz/czDJvvW2KBkYDT6PA/RV+OcOCdQZ8Q/h HbsRvYmmJhC0tb1BFkN+0g9p8uQPMENSJO3Dog/1aPv7SDFULD3kJKxo6Zv2jEYtICXF wOAjKCQdMjZvZQaBE2FqLiaw0DLYnb0kwTefAnmP78TahjBDeqK7pUQvVOhrwjPlVs95 LtoQ== X-Gm-Message-State: AOJu0YzaKE2EQQ/W9KhBKnNMDAfz9BwfSMpDc4yYmyA4wq2SKH+lcgZA 1pBBFSOlqIryLBXhfwgiVW16VpJeOCCduKD3YXerDA+tS8Qx4OdVEts84SoH4Q== X-Gm-Gg: ASbGncsVeiYCWHQPveTautUhe3wSsF/9Gr7N9mjHaPy3hGTse+u2kVOvSGWhTuB8iNC yM+hQrKyaD+/TxQU12Bq/VrCIHyNTHoTSdkKK8KwXtW+CANaLVUq9tt3/G4Hna4Ikkt9g1haq/y uJ9bgsepMxhHH0ipcQyIpiYfPErtQwDoE39OGS/7yPIHMHjELU7h9rvyJnpsIqHO1KU//Ig2r6E dULs1LoOv/UUSTaST7qn+fxeP+N27IHD2arI4ib7Eg3Q1q1o5J6wlBiNXns8+5VseDpy7ELkBap cPNwUayCHBg9i0ZGQnsI89QefGOd5JyZm9V1rkOextcaUgTAj+xQheJgBElxhpNhQajL+GQuYBs a3x574dXpFWWkawJ09cYaNrWH0krleZ5l5OwSfQ5pnLUl7gCPe+DWAyXarWznidi15q83BHGhbK IISuSd2YBNLOQnTs2i81NQfRkUKu2+bZ7qlxXk X-Google-Smtp-Source: AGHT+IFiIWDoGOd4h+uByrCzBPa+JvK8oXEhulsQ4PPQOj3gi/ke28N9of+iS2uIlFb2l/ugaE1QZg== X-Received: by 2002:a5d:5f46:0:b0:429:8c4e:b0c8 with SMTP id ffacd0b85a97d-429e32f7b92mr4523305f8f.27.1762369602488; Wed, 05 Nov 2025 11:06:42 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb477203sm313840f8f.29.2025.11.05.11.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 11:06:42 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Johannes Schneider Subject: [PATCH 2/6] bitbake-setup: fix key-error when changing a new 'section' Date: Wed, 5 Nov 2025 20:06:32 +0100 Message-Id: <20251105190636.679388-2-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251105190636.679388-1-alex.kanavin@gmail.com> References: <20251105190636.679388-1-alex.kanavin@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 ; Wed, 05 Nov 2025 19:06:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18271 From: Johannes Schneider Setting a key=value in a new section would raise a key-error when using in-memory settings, e.g: ./bin/bitbake-setup --setting default top-dir-prefix /tmp/bitbake-setup --setting default top-dir-name gs settings foo bar baz Loading settings from /tmp/bitbake-setup/gs/settings.conf Traceback (most recent call last): File "/tmp/bitbake-setup/bitbake/./bin/bitbake-setup", line 853, in main() File "/tmp/bitbake-setup/bitbake/./bin/bitbake-setup", line 838, in main all_settings = merge_settings(builtin_settings, global_settings, topdir_settings, args.setting) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/bitbake-setup/bitbake/./bin/bitbake-setup", line 733, in merge_settings all_settings[section][setting] = value ~~~~~~~~~~~~^^^^^^^^^ KeyError: 'foo' Signed-off-by: Johannes Schneider --- bin/bitbake-setup | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index a9035e7c8..3f56f8378 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -726,9 +726,13 @@ def merge_settings(builtin_settings, global_settings, topdir_settings, cmdline_s for s in (global_settings, topdir_settings): for section, section_settings in s.items(): for setting, value in section_settings.items(): + if section not in all_settings.keys(): + all_settings[section] = {} all_settings[section][setting] = value for (section, setting, value) in cmdline_settings: + if section not in all_settings.keys(): + all_settings[section] = {} all_settings[section][setting] = value return all_settings From patchwork Wed Nov 5 19:06:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 73661 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 5BFDFCCFA13 for ; Wed, 5 Nov 2025 19:06:48 +0000 (UTC) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.17661.1762369604846787162 for ; Wed, 05 Nov 2025 11:06:45 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KkdF9ao5; spf=pass (domain: gmail.com, ip: 209.85.128.46, mailfrom: alex.kanavin@gmail.com) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4775895d69cso809285e9.0 for ; Wed, 05 Nov 2025 11:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762369603; x=1762974403; 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=mPRv7h9aFZz/gdi9IpifxZuqZwXZtjJYIFD4hy0CIZQ=; b=KkdF9ao5F/1MDABkYZH0espgPf8JhABgE08WHDgS4qyYab+lKF8Wy3TAukKmCLMsLA 7cByHq2auTYh4mdX2GM1EAz3TSn454arNwORz6PLoB+L3XNGKSrFjYv5KKBix3R0aswU +VcqM77QwztYpNw6AoXEgZhz6wAF8+qY3mfFWBpvSneLMy0VPDI/yMLfBsfXq31Jj8Qp S/LKsZOyIvxg6BIr9WatpVtv0nsIN53Pn1ukg9wMXAbDUQxiEiMXsCvSS4VhOpftsPBk roS7igXhIgETQUzhG8pGe4BpJKk1oyKeIsoZOy3fOV7825SmnuzLeY+afXy7rrg406DL 0rKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762369603; x=1762974403; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mPRv7h9aFZz/gdi9IpifxZuqZwXZtjJYIFD4hy0CIZQ=; b=Nb8BaD1eWDVyNtWhKF3j+P3Q/Zp363p8+zOLF1QhZGAYbvF1V2R92Zd/T8bmH5wJ12 5XpIRxNNR+Y/yixg+uI1xn2yONjhjLXEj6TFVTRU7GlmC/DejErsO8IyLngolqRi8aGK ZDpwBA27XGZD37Rb7qZEKI/hREajrcE3MOVL/f2OPwoC2pnDrq5/IceJ8zOkk0oxudsr RIopQFBs01CdNOknc5xjXx1Ac25bCYcI7cjPztatTgHXdXYMBJuEAEycKCOARhKGnICO WVe5JKlBdbKyXXqMjywhQa+JXmWq55yHjr4YZUbfxzz6/wRInNJz+8GltSmeW6jRcibD e3aw== X-Gm-Message-State: AOJu0YzKa77dFVdvVOqoZO40ZBBtwxutaEjFSjKK7eBvpS6nSsIzQ2d8 ulx+GqguGaYeHA2F9vhG260MhwsQSZnGa7M1H8hWBzwJoZKAppnf0sS7vfdgAQ== X-Gm-Gg: ASbGncsKGrGAiRMYoH/7GXjl4L8EtKRr26s01rJs1h/YljUwcBD/W7K2c/TtVbW0Gia E2LbQXltDQpodjmzFAESn5y3SPYRITvk+f9HALmhARLvj0dhnL7OiTFrEykxeeKUig2FSn9V9P/ kRzTqI3iAQ7dU7JKtkywh4uwqhaC/AsXZpeAQdnbdMJyi5ee4yXaym6P6wnCjXkcQg8I18KB/Zv AWpCDtBTw5wUG7uv4crIPLnPy/brGRmezRMGM1bdrQMIQ+9P+1uVIt6o9dfgc5tMB+ldjL7D2u0 FSCzzaO3CrTvxZp0nJTmgVE4vjdNe8jRnOz6GbkpJl0nsrXrPIwF0qdo7I044/KsE7NLJ2u5Wji wWfPgU1ootBTk9W/+8B68rmIJSfYOZM1PZE2PMbj9FBL7TZ903LeF2eDkAvO6z29bMhxXyminvm w6U2tYw71pO53yoNoAaZc2SA6o5B5laKffhk11Cx3xCoTWRI0= X-Google-Smtp-Source: AGHT+IHcNN5vZqTk9umic0CWpWmHJ3JNArZA+kxklnH6CYqfnsCVqLE6Mk/yaSfBQkGB2SUFRZh+Mg== X-Received: by 2002:a05:6000:40cc:b0:429:b857:6fdb with SMTP id ffacd0b85a97d-429e3311896mr3545483f8f.49.1762369603137; Wed, 05 Nov 2025 11:06:43 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb477203sm313840f8f.29.2025.11.05.11.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 11:06:42 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Johannes Schneider Subject: [PATCH 3/6] bitbake-setup: rename 'write_config' into 'write_upstream_config' Date: Wed, 5 Nov 2025 20:06:33 +0100 Message-Id: <20251105190636.679388-3-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251105190636.679388-1-alex.kanavin@gmail.com> References: <20251105190636.679388-1-alex.kanavin@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 ; Wed, 05 Nov 2025 19:06:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18272 From: Johannes Schneider Rename the function to reflect which (of the possibly many) files in the build/config directory it writes to. Signed-off-by: Johannes Schneider --- bin/bitbake-setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 3f56f8378..59b4dfdb8 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -57,9 +57,9 @@ def get_config_name(config): else: raise Exception("Config file {} does not end with {}, please rename the file.".format(config, suffix)) -def write_config(config, config_dir): +def write_upstream_config(config_dir, config_data): with open(os.path.join(config_dir, "config-upstream.json"),'w') as s: - json.dump(config, s, sort_keys=True, indent=4) + json.dump(config_data, s, sort_keys=True, indent=4) def commit_config(config_dir): bb.process.run("git -C {} add .".format(config_dir)) @@ -469,7 +469,7 @@ def init_config(top_dir, settings, args, d): bb.event.register("bb.build.TaskProgress", handle_task_progress, data=d) - write_config(upstream_config, confdir) + write_upstream_config(confdir, upstream_config) commit_config(confdir) update_build(upstream_config, confdir, setupdir, layerdir, d) @@ -526,7 +526,7 @@ def build_status(top_dir, settings, args, d, update=False): source_overrides = current_upstream_config["source-overrides"] new_upstream_config = obtain_config(top_dir, settings, args, source_overrides, d) - write_config(new_upstream_config, confdir) + write_upstream_config(confdir, new_upstream_config) config_diff = bb.process.run('git -C {} diff'.format(confdir))[0] if config_diff: From patchwork Wed Nov 5 19:06:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 73663 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 6EDBCCCFA1A for ; Wed, 5 Nov 2025 19:06:48 +0000 (UTC) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.17906.1762369605489517917 for ; Wed, 05 Nov 2025 11:06:45 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L3M9gcW5; spf=pass (domain: gmail.com, ip: 209.85.221.41, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3ecde0be34eso732222f8f.1 for ; Wed, 05 Nov 2025 11:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762369604; x=1762974404; 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=Wt7a4edqAH7FZkPhUvSfQU8sQSgPwBm4w+DubrVJ5eE=; b=L3M9gcW5CIttw1xthWP4wfwLRobOr+P1EcZFN3poPvIr3r3Zo2bGfBNgp56J8g5KNt 9Oo0ShNxjM79m+FXTh6IURuxKbXj9a3PsoTgKVbtC3jJgIF0tPIy/2O1V925U3ch7can 2XW10+T4fm/jSBrTp7ZilLSAfJp4fU0M+EGwyommBatuh+eJHL3jf+AtpUa0GWPyged3 YVuPG62kuaMkvYJuhFaLSVd4/92EAmyAs4Y/k+Mj2JYEkZU6ei9D5FpqDT9iEkwcnjzM 5RONhQnDSxZTc4Ch4OK72HfvYEIH802i8xKl9hHSzmTXhOIpWqlwCWWcQDO0bidNfKCR XKlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762369604; x=1762974404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wt7a4edqAH7FZkPhUvSfQU8sQSgPwBm4w+DubrVJ5eE=; b=s/utD2KHQH42hMZztdD/uQrHf/Bf89Ff5YfVodUd9Gjn1UGeTo2YsvaIE0JaDP/rxg 0xjs7i47nLz0fEsfk4lcIkV4bUALZYGXxQUzRwD1EhrH4Dm4LtEYff7CD9out7Qbvgkx xE8xm5eejAIbk/5xlbubeQifxH/35x9j5R5JNyYrVtNCLTwoA3+uzmOtkszG7yUWzKGP /ufGPhWen1PRdWCdFh5cdFaojShb0hkhMuS+KMsld8S3oVB71hyimLFxjo5a8veh4Ral FNS4yKxkGQV+mY7mZgtD4eYO/fEBoILADh66PCJRRXZDLZhfS56LCgrIsoyhgxpPXmXe 9lrg== X-Gm-Message-State: AOJu0YzjudQKBOosmUbr2qqNIkwTfUb+3QzY20Y69A3X3LcG6hapujMB vSkecJgcoGh4JQjNaEc3Elust60IpydnwcHAEvGev689defrUxKdCkvb9DoPZA== X-Gm-Gg: ASbGncsiAGV8CvW+aSVSnld03YtpS7LCuchtAVwHvUBLMOWSV8ozdFrlesHeuqGp3nu I3HSU0gGnVEyXDkVptTDmEz+VhA8JpdglAOcsBxb3QN+yz4xXJSU4ZdHioyikEhzaLOpJhd0QUw dxlwLp4UPpiP19ZNOE/ZSprBxvQAQqwPc/z7MqaVjN5RUmlnX4UPHy078JIrA7YnAJom6eb+Cdl FiLbwFdsQzmtznGJLJ5jP+AFev3p3PUskukvI/2V9nJPQ5mYQUGDyUGw497Qq6ifpXWzsg9FEyK aAUGoxwO/gtn9kC1jOc2FmRY5BNlqHRjbt9Wmn4V/ck2LvyjpMDO9x1OChNwPm8Y12+iISa5qNO frFtF63ZhmQ7XesLQjJ0h6nrk48ZnTMmxCWK+zqp9NTb+O0uJjTKtil9JtEcPS8RtBsRHEcloT4 Vplx4q2woPJLbde269wtk/oPch/Xpn8QaacJhz X-Google-Smtp-Source: AGHT+IEdsNzZHA79NebXgP1hSicAdqHb+AgXXFHKCOQyuXrGdhK/w2FIUIvIUh96Sm3vh6ctdXer6A== X-Received: by 2002:a05:6000:420e:b0:429:cff0:1929 with SMTP id ffacd0b85a97d-429eb1a2c1emr518330f8f.29.1762369603875; Wed, 05 Nov 2025 11:06:43 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb477203sm313840f8f.29.2025.11.05.11.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 11:06:43 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Johannes Schneider Subject: [PATCH 4/6] bitbake-setup: checkout_layers: construct 'src_uri' separatly Date: Wed, 5 Nov 2025 20:06:34 +0100 Message-Id: <20251105190636.679388-4-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251105190636.679388-1-alex.kanavin@gmail.com> References: <20251105190636.679388-1-alex.kanavin@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 ; Wed, 05 Nov 2025 19:06:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18273 From: Johannes Schneider Construct the 'src_uri' separately, and then pass either variant into one call that creates the Fetch. Making use of format-strings to shorten/simplify the code. Also: using 'proto' instead of 'type' for a variable name, to avoid the protected keyword. Signed-off-by: Johannes Schneider --- bin/bitbake-setup | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 59b4dfdb8..ff753557c 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -90,13 +90,14 @@ def checkout_layers(layers, layerdir, d): remotes = r_remote['remotes'] for remote in remotes: - type,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"]) + prot,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"]) fetchuri = bb.fetch.encodeurl(('git',host,path,user,pswd,params)) print(" {}".format(r_name)) if branch: - fetcher = bb.fetch.Fetch(["{};protocol={};rev={};branch={};destsuffix={}".format(fetchuri,type,rev,branch,repodir)], d) + src_uri = f"{fetchuri};protocol={prot};rev={rev};branch={branch};destsuffix={repodir}" else: - fetcher = bb.fetch.Fetch(["{};protocol={};rev={};nobranch=1;destsuffix={}".format(fetchuri,type,rev,repodir)], d) + src_uri = f"{fetchuri};protocol={prot};rev={rev};nobranch=1;destsuffix={repodir}" + fetcher = bb.fetch.Fetch([src_uri], d) do_fetch(fetcher, layerdir) if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')): From patchwork Wed Nov 5 19:06:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 73665 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 78EFCCCFA1C for ; Wed, 5 Nov 2025 19:06:48 +0000 (UTC) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.17662.1762369606429176477 for ; Wed, 05 Nov 2025 11:06:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R6XWlaSi; spf=pass (domain: gmail.com, ip: 209.85.221.45, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-429b72691b4so144824f8f.3 for ; Wed, 05 Nov 2025 11:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762369605; x=1762974405; 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=aI7pnUesjsLGs0O80OhdRsiCGJvxWifBYB24Q8cr8DY=; b=R6XWlaSiX8pjk77Xxxj7Egiu3QPK0lOgUkvA6owiMyKXrvs4nPIBkByQdMzOhDLtdn qdH8PExxa5IMOiMtafrx294lziEUfiHv3A3HS5+LFQa1chmY4CbO/vGnbuMKMB11qdhm YNIMIPdz1CiAAsPee3dmrjToP5d/OKW+cYhTIGyohOLlIaDdD47p903fYQJqZMR9WThi zxbIXm2qzNRSYdT1UBz+v6UYEXMAuuILTsOvbYJLDA9BxQzgbt5vgd6EErEDu7y8Fo0C JEElBxu/H+AwFhRRpq00kVClaNmawazWMTpeOnY/tuKF3i8GZDQIT/QhlINP8+ewM2hU BI+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762369605; x=1762974405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aI7pnUesjsLGs0O80OhdRsiCGJvxWifBYB24Q8cr8DY=; b=jNSeHbwtD2pbOVZDU02cKvXxuRAiwzbIy8xLVMKWMHrEv0DxopndD+S3hD5K/dEs8e HFsfeSfZ8OF1GLP55flfd97lKXtsuwbRYzx9Txju1ynyfu3oIeobJo8NjgTpV5cSLhQF QiKm+KgG9jhe8ditMpyJ9xGnDy2vgF8l8DcbmFGQpTwXW3BhZPX7sdsGDCrLxzc6gTKl EwD7YgX5zRUOdPPHrCPEH9TmgJfvosVKt9RPaxbJ8sz+baq9CCILP2w5CC53nHcMJAQ4 3zMD69ztfqhDXrKCxaCVW4XaEQWxB3AcztxlFW86MgYGBqr1CTJwwdHy9NJr2SWuxKrj aesg== X-Gm-Message-State: AOJu0Yx35MjnkRD+wqVghalSF2FMjuvzHBwbWl10OxX/7QpgLdQRarKw U7o50b+AH896VWipl5Pr5ln90ciM4vFzcVHFsAokkEQIDMm+jq+CEtgK6q196w== X-Gm-Gg: ASbGncsvX176/MHblrCj/EHovii5O39Jx4rUiDjzGSoyB934X0mnjmZSSHkJgucmxAN WRydOlTA3ko8su4H98+ssZp2WBKYaS6dOcyZJBLBkmwZwNDfT12EGO1fzZsTFwoyfDX5VsH1crw asyY439XSahEgdbvu+Jx50D+vtmTFo+Vq0mJpN6Ng8IUsWzftG/MDkxRFcIJAHva9X/4BBton3v r23b6SJiDAAhpwpjbwk9UdpnrZ844tM7iVRbY0FHX3mVfWInBtNWpJ54llrq6cSvHFqMyqHfFCv 0mQn3W8WcpFrDEO2Nj0Fi2eRS/8wo3rYbZQqIDcXsjQVHZoks/bYXENZlQiKpdQcbKvkgSA5zJI DsWLlxOVfEU93nUZqi2L68CDdY6TPG0Vz3wz+llUUd0z1oPce0xOC221Ck8PoXDqwGhkEHmTe9A 4yMzZCq5p1k9/HDzt7o/PNOCei5YiZQbl9T2ayKORYG+oUXVw= X-Google-Smtp-Source: AGHT+IH8Mn38QiwO6Oq/KPDKP5Wnj12OGGZGQLpNSjwtLOnhc8p8RmR+y1efOsZ+2MTzmArEbMN6EA== X-Received: by 2002:a05:6000:1a8a:b0:429:d48d:aca8 with SMTP id ffacd0b85a97d-429e32c9560mr3507660f8f.9.1762369604513; Wed, 05 Nov 2025 11:06:44 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb477203sm313840f8f.29.2025.11.05.11.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 11:06:44 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Johannes Schneider Subject: [PATCH 5/6] bitbake-setup: tests: move duplicate code into 'check_setupdir_files' Date: Wed, 5 Nov 2025 20:06:35 +0100 Message-Id: <20251105190636.679388-5-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251105190636.679388-1-alex.kanavin@gmail.com> References: <20251105190636.679388-1-alex.kanavin@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 ; Wed, 05 Nov 2025 19:06:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18274 From: Johannes Schneider All places that called into 'check_setupdir_files' did the same preparation step to load the upstream-config.json and then pass it into the function. Since the 'setuppath' is already passed into the function, and the name and relative location of the upstream-config.json is fixed, constructing the file path and loading the json could be done in the function. De-duplicate code by loading the json inside the function instead. Signed-off-by: Johannes Schneider --- lib/bb/tests/setup.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py index a17b8ac46..e18d6fc6a 100644 --- a/lib/bb/tests/setup.py +++ b/lib/bb/tests/setup.py @@ -177,10 +177,12 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) self.git('add {}'.format(name), cwd=self.testrepopath) self.git('commit -m "Adding {}"'.format(name), cwd=self.testrepopath) - def check_setupdir_files(self, setuppath, test_file_content, json_config): + def check_setupdir_files(self, setuppath, test_file_content): + with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f: + config_upstream = json.load(f) with open(os.path.join(setuppath, 'layers', 'test-repo', 'test-file')) as f: self.assertEqual(f.read(), test_file_content) - bitbake_config = json_config["bitbake-config"] + bitbake_config = config_upstream["bitbake-config"] bb_build_path = os.path.join(setuppath, 'build') bb_conf_path = os.path.join(bb_build_path, 'conf') self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env'))) @@ -198,7 +200,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) for l in bitbake_config["bb-layers"]: if l.startswith('{THISDIR}/'): thisdir_layer = os.path.join( - os.path.dirname(json_config["path"]), + os.path.dirname(config_upstream["path"]), l.removeprefix("{THISDIR}/"), ) self.assertIn(thisdir_layer, bblayers) @@ -296,9 +298,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) for c in v['buildconfigs']: out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c)) setuppath = os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c)) - with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f: - config_upstream = json.load(f) - self.check_setupdir_files(setuppath, test_file_content, config_upstream) + self.check_setupdir_files(setuppath, test_file_content) os.environ['BBPATH'] = os.path.join(setuppath, 'build') out = self.runbbsetup("status") self.assertIn("Configuration in {} has not changed".format(setuppath), out[0]) @@ -327,9 +327,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) if c in ('gadget', 'gizmo'): self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0]) self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) - with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f: - config_upstream = json.load(f) - self.check_setupdir_files(setuppath, test_file_content, config_upstream) + self.check_setupdir_files(setuppath, test_file_content) # make a new branch in the test layer repo, change a file on that branch, # make a new commit, update the top level json config to refer to that branch, @@ -353,6 +351,4 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) if c in ('gadget', 'gizmo'): self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0]) self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) - with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f: - config_upstream = json.load(f) - self.check_setupdir_files(setuppath, test_file_content, config_upstream) + self.check_setupdir_files(setuppath, test_file_content) From patchwork Wed Nov 5 19:06:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 73662 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 5AB80CCF9F8 for ; Wed, 5 Nov 2025 19:06:48 +0000 (UTC) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.17663.1762369606955805997 for ; Wed, 05 Nov 2025 11:06:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=juuAKkB1; spf=pass (domain: gmail.com, ip: 209.85.221.47, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-429c7f4f8a2so708969f8f.0 for ; Wed, 05 Nov 2025 11:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762369605; x=1762974405; 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=aaPcqo1cwNZKj4kdI43WPHXz75QZ7K5gQseHaOSdP1s=; b=juuAKkB1u6q+TWVjTGj2WM40QeqDva03l6ZydUaJ52KDW3EfpVjW96PHeA3IjhBuPO LuOwtfJ8rMZiKS/zNlsotWtVJQJi0WUhrmF1nJAm0bP/exAijbmCCPRpblZml6d5DqHS xWUYDzvJh5hk18MbVv/lbvu24zVY04TByalTmCD5qkRQi682Kfbks0saxo7jfRi3N/F9 w6buqafDN/MdsiBCgzNipPdYVWrsA8ElANC3ekFFqBKBVTxKRR1FvAgF0s8BiN3807kj kuzEu39mlLHiCRsFJf0M3Ug14s8vWlACiCOtJRpmmDm/NF27MzcTwqpYBvuE1jnjhs58 6dZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762369605; x=1762974405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aaPcqo1cwNZKj4kdI43WPHXz75QZ7K5gQseHaOSdP1s=; b=eRPUzmiND1RTf7ZKRWH9C6ZvERYtPFwN7GOOVk38BIa7aRk27QraUz/vqzWqibNUO3 zyUAKSIettLfOzVYJ5FJWxCtk9EG+1tRxKWszw2J33Ke+KfdEXSzVdzjTjWz1p8EFSOG BI5pHoEO9CAB3dWLVIvzr7UieDZT9wVyrB7EnofF+8RvOBnnYOITia+YCmKZNfCuNp6X hkGEY3EpCeJhb8l3E8AkdNtEvSjuc2e1DvFAQdtOwH3cRStTF4GH6IshgwmmSbgT6GN5 B6WongLEVzBBwxE87w3t3GWtGCAnJAJmb2Aj6WtPrSGWCo/3jiD8u3DeMwDNfASFcCvr xLAw== X-Gm-Message-State: AOJu0YwTBIFaZ7/FsU3c0ts7nfXMbyRvYlz8WfpvS39Yde0fac5+xLMf 6y8jClkQclzAFRsvW0l+vRLdKUyXvisWqng7UPKoHFgRH+pkpq/3TeZYA1d9Tg== X-Gm-Gg: ASbGnctRnvu+8whF/Ui2T+i3iD9u2u2KL67OZvZH6mdj10O/b3/iSdP/t/u6gcTQytg e5s1tMXbGcwmc3XCdRnqYdn/JUxc+EDgumfbsWH5VKfbtyRPsXleGzXkmchKdTDSftRTOZn/u4/ mNJ0joASfj+xedXhJWS9P+UbvaD4hKC9/FRPLsRzVaEx3xeRj4iHmwExgGzl5QAfEdP4ARqnU1Y N6VKx9neqEvDgrn4ZUW9TD/MU42U5bgUoC5IScHyz7ptmB7bmZyI2lxa4wPGnVewslj2/PiOVTv 5RZmOX0Wzrn5olkiCstr9wjTGGiEPg4hY4fvdibJDfabQd7tnj33gRHvyVzFVEJtKDJZUO7GIT1 qpDxLAxal3XbbHNBI/18tsn5xYUmGR9mgYz4BMC++fm9p36K9x/P7edW6IdUn0cQOT3sZJM/LvW PS6PuKoMZsitcAzZQbsMb1qck88CtA7gs4Rx8J X-Google-Smtp-Source: AGHT+IE4ATEVkDFBXkax8iuJTJqM0UJqWdp2Q7pEpMNb6V/poW4xEWUm0EILTD+cGJ7tMOdniEEKXw== X-Received: by 2002:a05:6000:1848:b0:429:cb8b:b58e with SMTP id ffacd0b85a97d-429eb1a2b33mr482711f8f.28.1762369605205; Wed, 05 Nov 2025 11:06:45 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb477203sm313840f8f.29.2025.11.05.11.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 11:06:44 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Johannes Schneider Subject: [PATCH 6/6] bitbake-setup: capture revisions while checking out layers Date: Wed, 5 Nov 2025 20:06:36 +0100 Message-Id: <20251105190636.679388-6-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251105190636.679388-1-alex.kanavin@gmail.com> References: <20251105190636.679388-1-alex.kanavin@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 ; Wed, 05 Nov 2025 19:06:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18275 From: Johannes Schneider When initializing a build setup from a conf.json that only sets 'rev' to a tag or branch, the actual revision would not be captured or logged. To capture the current layer state after an 'init' or 'update', the checkout_layers function is extended to store the revision the bb.fetch.Fetch pulled, and write that information into a sources-fixed-revisions.json file. This file can then be fed back into bitbake-setup init as: --sources-overrides This new 'sources-fixed-revisions.json' is written during 'update_build' and stored alongside the 'config-upstream.json' in the config dir. And put with the later under version control by calling 'commit_config" after 'update_build'. The use of 'deepcopy' is necessary to not modify the original input data - which python passes around as reference. Signed-off-by: Johannes Schneider --- bin/bitbake-setup | 20 +++++++++++++++++--- lib/bb/tests/setup.py | 6 ++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index ff753557c..47de4654e 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -18,6 +18,7 @@ import configparser import datetime import glob import subprocess +import copy default_registry = os.path.normpath(os.path.dirname(__file__) + "/../default-registry") @@ -61,6 +62,12 @@ def write_upstream_config(config_dir, config_data): with open(os.path.join(config_dir, "config-upstream.json"),'w') as s: json.dump(config_data, s, sort_keys=True, indent=4) +def write_sources_fixed_revisions(config_dir, config_data): + sources = {} + sources['sources'] = config_data + with open(os.path.join(config_dir, "sources-fixed-revisions.json"),'w') as s: + json.dump(sources, s, sort_keys=True, indent=4) + def commit_config(config_dir): bb.process.run("git -C {} add .".format(config_dir)) bb.process.run("git -C {} commit --no-verify -a -m 'Configuration at {}'".format(config_dir, time.asctime())) @@ -76,6 +83,7 @@ def _write_layer_list(dest, repodirs): json.dump({"version":"1.0","layers":layers}, f, sort_keys=True, indent=4) def checkout_layers(layers, layerdir, d): + layers_fixed_revisions = copy.deepcopy(layers) repodirs = [] oesetupbuild = None print("Fetching layer/tool repositories into {}".format(layerdir)) @@ -99,6 +107,9 @@ def checkout_layers(layers, layerdir, d): src_uri = f"{fetchuri};protocol={prot};rev={rev};nobranch=1;destsuffix={repodir}" fetcher = bb.fetch.Fetch([src_uri], d) do_fetch(fetcher, layerdir) + urldata = fetcher.ud[src_uri] + revision = urldata.revision + layers_fixed_revisions[r_name]['git-remote']['rev'] = revision if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')): oesetupbuild = os.path.join(layerdir, repodir, 'scripts/oe-setup-build') @@ -115,6 +126,8 @@ def checkout_layers(layers, layerdir, d): os.remove(symlink) os.symlink(os.path.relpath(t,layerdir),symlink) + return layers_fixed_revisions + def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir): def _setup_build_conf(layers, build_conf_dir): os.makedirs(build_conf_dir) @@ -269,15 +282,16 @@ def get_registry_config(registry_path, id): raise Exception("Unable to find {} in available configurations; use 'list' sub-command to see what is available".format(id)) def update_build(config, confdir, setupdir, layerdir, d): - layer_config = config["data"]["sources"] + layer_config = copy.deepcopy(config["data"]["sources"]) layer_overrides = config["source-overrides"]["sources"] for k,v in layer_overrides.items(): if k in layer_config: layer_config[k]["git-remote"] = v["git-remote"] - checkout_layers(layer_config, layerdir, d) + sources_fixed_revisions = checkout_layers(layer_config, layerdir, d) bitbake_config = config["bitbake-config"] thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir) + write_sources_fixed_revisions(confdir, sources_fixed_revisions) def int_input(allowed_values): n = None @@ -471,8 +485,8 @@ def init_config(top_dir, settings, args, d): bb.event.register("bb.build.TaskProgress", handle_task_progress, data=d) write_upstream_config(confdir, upstream_config) - commit_config(confdir) update_build(upstream_config, confdir, setupdir, layerdir, d) + commit_config(confdir) bb.event.remove("bb.build.TaskProgress", None) diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py index e18d6fc6a..767a6298d 100644 --- a/lib/bb/tests/setup.py +++ b/lib/bb/tests/setup.py @@ -187,6 +187,12 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) bb_conf_path = os.path.join(bb_build_path, 'conf') self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env'))) + with open(os.path.join(setuppath, 'config', "sources-fixed-revisions.json")) as f: + sources_fixed_revisions = json.load(f) + self.assertTrue('test-repo' in sources_fixed_revisions['sources'].keys()) + revision = self.git('rev-parse HEAD', cwd=self.testrepopath).strip() + self.assertEqual(revision, sources_fixed_revisions['sources']['test-repo']['git-remote']['rev']) + if "oe-template" in bitbake_config: with open(os.path.join(bb_conf_path, 'conf-summary.txt')) as f: self.assertEqual(f.read(), bitbake_config["oe-template"])