From patchwork Thu Nov 14 11:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 52465 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 7FA33D65C74 for ; Thu, 14 Nov 2024 11:11:08 +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.web10.35225.1731582658181775159 for ; Thu, 14 Nov 2024 03:10:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YMDLIy8t; 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-38207c86695so430577f8f.2 for ; Thu, 14 Nov 2024 03:10:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731582656; x=1732187456; 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=tz/NE9R+0lJ91wLRy5mP3gfePpIPNAtFZRS3+M0iLvY=; b=YMDLIy8tkoJZvcikRMKC2ovJk7F7iO4WWHviETEnSXrk5j6LpfZuXtpT1FLRVycK+v wDC3bL89FdaMRR10hCQSgnJrHK/22Z2hB6T0xrnhvIdAp+X2yUutq/o+T+falHOaAVFg bPHR+o9lzvVM4NOiJtCxq8Ljzbz8Ub0DAWun+xWYeTupAUOLo1dQtaAwUZ/XIxkbjOxm hIuduNxq3x2thZ6QIrJcps3PSwIjvd5FDoeTSX93DOgFcIJgKTq9INYpYH4oZy6zplIA xLK+OyShrtIdi4qRQt6NYO7Le+uizXi0iN1iDdlAdn8QjAKq7KgDvMrYESWH4dSjZlu0 V1LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731582656; x=1732187456; 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=tz/NE9R+0lJ91wLRy5mP3gfePpIPNAtFZRS3+M0iLvY=; b=AQg38RmUgcWCO1M8hAIMFJ0j6bfqYsn5roJHho8rq6fM94YU//qggzsjRIiYH+1UUk 8kFqqTI2olFVzmxkahOYsnD/NMrIVgDE4mHoci0lMFqONyhlV4dNR9U+/hqvqSyXm3zE ubbgys375WXkYyw4FCF0t9PR/flx4KqNvDMM/7Z3w5YyAl+3OLcIfBgHxCcpl/vdcIgx yYM2OcxUT+Lc8rYDnKn5z4WK+CWkS4WHgLgVMF3XOFySna0CQos8lREtgYVKlvymleZG coOknMHQtl8l5U1hZ8R13mL/5I9fEMSfk7KwUOrKiHa7FX+BdB10Z4bttPvV7lz5gkJ2 lz5w== X-Gm-Message-State: AOJu0Yy8Peiq/OsSf2ph9kBqPFT9bnCEtA9Aca/phZNzOOPVsw26CgB1 jZewssLAL9aFav3KC5feVyLTMXor9mMQ9Id4fr4xi9o8ZLgSLcScMeEwnQ== X-Google-Smtp-Source: AGHT+IEhVFY5BFGKgvEhlezlJn4WnVcLRfkBBXK3mYObJjDk13hZ1bzsuNrX18VopPvdjEBOpdFQqA== X-Received: by 2002:a5d:5983:0:b0:381:bdeb:1799 with SMTP id ffacd0b85a97d-381f186cd09mr21784231f8f.16.1731582656195; Thu, 14 Nov 2024 03:10:56 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ada31b0sm1199051f8f.1.2024.11.14.03.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 03:10:55 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 1/3] bitbake-config-build: add an alias to bitbake-layers intended for managing specific local configs Date: Thu, 14 Nov 2024 12:10:46 +0100 Message-Id: <20241114111048.2624711-1-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 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, 14 Nov 2024 11:11:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16797 From: Alexander Kanavin This was prompted by adding support for config fragments (in a separate commit to oe-core); after some deliberation I concluded there should be a separate tool, as bitbake-layers is already somewhat over-stuffed, and this will give space for more build/conf/* operations in the future that anyone can come up with (such as tweaking site-specific items in site.conf etc.) The alias completely reuses existing code via symlink and the difference is in where it looks for plugins. Signed-off-by: Alexander Kanavin --- bin/bitbake-config-build | 1 + bin/bitbake-layers | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 120000 bitbake/bin/bitbake-config-build diff --git a/bin/bitbake-config-build b/bin/bitbake-config-build new file mode 120000 index 00000000000..11e6df80c4b --- /dev/null +++ b/bin/bitbake-config-build @@ -0,0 +1 @@ +bitbake-layers \ No newline at end of file diff --git a/bin/bitbake-layers b/bin/bitbake-layers index aebb5100c2c..3923c4db562 100755 --- a/bin/bitbake-layers +++ b/bin/bitbake-layers @@ -18,13 +18,14 @@ import warnings warnings.simplefilter("default") bindir = os.path.dirname(__file__) +toolname = os.path.basename(__file__).split(".")[0] topdir = os.path.dirname(bindir) sys.path[0:0] = [os.path.join(topdir, 'lib')] import bb.tinfoil import bb.msg -logger = bb.msg.logger_create('bitbake-layers', sys.stdout) +logger = bb.msg.logger_create(toolname, sys.stdout) def main(): parser = argparse.ArgumentParser( @@ -67,7 +68,8 @@ def main(): try: for path in ([topdir] + bbpaths): - pluginpath = os.path.join(path, 'lib', 'bblayers') + pluginbasepath = {"bitbake-layers":'bblayers', 'bitbake-config-build':'bbconfigbuild'}[toolname] + pluginpath = os.path.join(path, 'lib', pluginbasepath) bb.utils.load_plugins(logger, plugins, pluginpath) registered = False From patchwork Thu Nov 14 11:10:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 52466 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 804F5D65C75 for ; Thu, 14 Nov 2024 11:11:08 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web11.34856.1731582658652534877 for ; Thu, 14 Nov 2024 03:10:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=H+bu/mH0; spf=pass (domain: gmail.com, ip: 209.85.221.43, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-37d5689eea8so339050f8f.1 for ; Thu, 14 Nov 2024 03:10:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731582657; x=1732187457; 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=uni6I9Uj7GnmDzWSZmnamv21HJl8iaq5lIitjAff0k4=; b=H+bu/mH0gkgGiY5s64mi7BB+/euA9kH44kiGKPED3yz4malwNdOXPE62EsyENsozVJ j7KcG9pIRfIi95IIf94fzJ3CD6roWj9uGW6sMHu8BqTUDDNGpLr68C2PCYCHzvBFROAe UeoMridhEzHcTvaIr9514K/qyfNM5PtTGV/9dfmiClcVxuvavalpk8tU2po+cn7KOSAE pW/GQdGJTPzX4mb4mMHRZjSP5ikx4K1sVURQqmRFcZTaxIE2/1r07RHOyY0ozANIqCFq MS1VZOvyrikykgeVwzURWbNfwsACIk25Jtlsx14POWpRFNjrqMJT56nv8M2C8O4dfTCe k/1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731582657; x=1732187457; 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=uni6I9Uj7GnmDzWSZmnamv21HJl8iaq5lIitjAff0k4=; b=aLCPoOAeOgs6SsZLcxHBn5dNLxTlg1xJEloBPonQ9eBUE+Zi110/JDrTmyEBvOp80j zmvJy0t4plMXndWtQy9b+gC/wwSWY/YexbBybCgJVdCmy/I2/QOYZhRKVqEo9/Xd8bhn 3Msb9d+Xb/dPYqn7EGfHpngePQYAyv4LmDMqKqxBB62Cg0hdPfdMJQMcjvRCTUUNt3/v YtO5PF3/waD+Qvk+SKlO2+6atiTFOROZaJX01wnDLwOrSfyKukjbJGK01C0eGHcTOc8o SJTtfphJFMfjnWRg/OTTC/qPqEpK5KxvCfEh+tRi5fHGcpEZHDhAlRLuqU9lAfFwLRZT ZGZw== X-Gm-Message-State: AOJu0Yyss+CGwb5MUWIp/wthEUTWGW/0mKcu9nwe89u2oObLyEgDpYTf oSq5Me3uVuDgVRjAIAWHY2XA6KTtmq7NHcx3pLowURgXkg5JvYV4IYcgMQ== X-Google-Smtp-Source: AGHT+IG8gxhJKk7gacdXx/l6jtGMayNBvt3VzsbGHZ2fNE7p4IBe/k5/Y3l125OCZLcNaR4wAwgbzQ== X-Received: by 2002:a5d:6d0e:0:b0:381:dff2:cf08 with SMTP id ffacd0b85a97d-381f18651e9mr18723418f8f.2.1731582656771; Thu, 14 Nov 2024 03:10:56 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ada31b0sm1199051f8f.1.2024.11.14.03.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 03:10:56 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 2/3] parse: add support for 'addfragments' directive Date: Thu, 14 Nov 2024 12:10:47 +0100 Message-Id: <20241114111048.2624711-2-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241114111048.2624711-1-alex.kanavin@gmail.com> References: <20241114111048.2624711-1-alex.kanavin@gmail.com> MIME-Version: 1.0 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, 14 Nov 2024 11:11:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16798 From: Alexander Kanavin It takes two parameters: - location prefix for fragments - name of variable that holds the list of enabled fragments Implementation of this directive essentially expands the fragment list obtained from it into 'require' entries and hands them to the implementation of 'require'. Signed-off-by: Alexander Kanavin --- lib/bb/parse/ast.py | 19 +++++++++++++++++++ lib/bb/parse/parse_py/ConfHandler.py | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py index 001ba8d289a..b7272dfdc65 100644 --- a/lib/bb/parse/ast.py +++ b/lib/bb/parse/ast.py @@ -326,6 +326,20 @@ class InheritDeferredNode(AstNode): inherits.append(self.inherit) data.setVar('__BBDEFINHERITS', inherits) +class AddFragmentsNode(AstNode): + def __init__(self, filename, lineno, fragments_path_prefix, fragments_variable): + AstNode.__init__(self, filename, lineno) + self.path = fragments_path_prefix + self.variable = fragments_variable + + def eval(self, data): + fragments = data.getVar(self.variable) + if not fragments: + return + for f in fragments.split(): + full_fragment_name = data.expand("{}/{}.conf".format(self.path, f)) + bb.parse.ConfHandler.include(self.filename, full_fragment_name, self.lineno, data, "include fragment") + def handleInclude(statements, filename, lineno, m, force): statements.append(IncludeNode(filename, lineno, m.group(1), force)) @@ -370,6 +384,11 @@ def handleInheritDeferred(statements, filename, lineno, m): classes = m.group(1) statements.append(InheritDeferredNode(filename, lineno, classes)) +def handleAddFragments(statements, filename, lineno, m): + fragments_path_prefix = m.group(1) + fragments_variable = m.group(2) + statements.append(AddFragmentsNode(filename, lineno, fragments_path_prefix, fragments_variable)) + def runAnonFuncs(d): code = [] for funcname in d.getVar("__BBANONFUNCS", False) or []: diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py index 7826dee7d3d..31001e2afe1 100644 --- a/lib/bb/parse/parse_py/ConfHandler.py +++ b/lib/bb/parse/parse_py/ConfHandler.py @@ -47,6 +47,7 @@ __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) __unset_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) __unset_flag_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)\[([a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\]$" ) __addpylib_regexp__ = re.compile(r"addpylib\s+(.+)\s+(.+)" ) +__addfragments_regexp__ = re.compile(r"addfragments\s+(.+)\s+(.+)" ) def init(data): return @@ -197,6 +198,11 @@ def feeder(lineno, s, fn, statements, baseconfig=False, conffile=True): ast.handlePyLib(statements, fn, lineno, m) return + m = __addfragments_regexp__.match(s) + if m: + ast.handleAddFragments(statements, fn, lineno, m) + return + raise ParseError("unparsed line: '%s'" % s, fn, lineno); # Add us to the handlers list From patchwork Thu Nov 14 11:10:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 52464 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 7EB28D65C73 for ; Thu, 14 Nov 2024 11:11:08 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web10.35226.1731582659281050287 for ; Thu, 14 Nov 2024 03:10:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IBZzSlqQ; spf=pass (domain: gmail.com, ip: 209.85.221.44, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-381ee2e10dfso288073f8f.0 for ; Thu, 14 Nov 2024 03:10:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731582658; x=1732187458; 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=ws1gWkyGI4yaWFzhZcbqxVzfseYgbY0VRVhs0VzZGYk=; b=IBZzSlqQtk5lvOALnqzC3L1T3gn1UFknz4FaUqYsEAnrsJNHIBovoda6hVNXampJGW 2ZtgM2UBYMsqn+EDo8zyF8k3P+Pqc09EEV0E8wOLzGGtixego1A1Qjg7XkkOb3D14Low c62CmzlA5Yu+adadO6FuiSufb+xeh/4dRioBonoWhI0KdRSEawJ8Qu268fr9oYuvzWF4 KW+jZVt5pGsjU4fYY7deEEBpiHVaY/sTzP5mCuN49BYKOqLX+r6r/AQce8wSfapzRLQa dUTxEnxbXAUAM4uG0RPYmScEZO2fTB0SNwD7qGJJcDlvjefGdlc6mLPPwS/0NWamjGSi 9+0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731582658; x=1732187458; 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=ws1gWkyGI4yaWFzhZcbqxVzfseYgbY0VRVhs0VzZGYk=; b=e78khgZO+DseYx63wmVsHs8ibtjrjfqTYMl1W4WFy2K/FZ5znen5JqHOU7oBJJWJ0J iIav++cmy0IQItbzeUpdDIm/ac382CTYrQFPHBmfN5PPhfYtXM2prxvm2FKeN/zVGSE6 t6aTMV9MTUkMvDlvNtpYoCFFBvTIuDlbCSrELmpLxv1FkglolaHqKmqXSL8Yk7EmqAId CpQdXV2X8q2VjqXZz+wzNQbv9iiVaC0Q/7e5O7S1GHJsQ2Da3pLnpXUS9FWrC0eFaxOj QoC+O5nqgoLqhpSQGHhZSZfFAotyHrt7MAI30ltj7a9nkL/2+1IxIcF1hk+o5cLhGszU 1BKg== X-Gm-Message-State: AOJu0YycUangdfF75JeqRBAQVr+f9OAXpwp1utQTJ2GV2bAjOg8maGBm iCsdA6B4YZ3IzGE2UuT17hq+7H9Mc/2cd+8RDkzDO4h1A5e8s8qekxOMZg== X-Google-Smtp-Source: AGHT+IFZMzSOm0ou+Q2D0F1xw/btJM75qQtyQkp8o83Zfn4l6+BDhF4uanpjYkLZIgoqKT53X1y69Q== X-Received: by 2002:a5d:59ad:0:b0:381:df72:8678 with SMTP id ffacd0b85a97d-3821850235cmr1263754f8f.16.1731582657372; Thu, 14 Nov 2024 03:10:57 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ada31b0sm1199051f8f.1.2024.11.14.03.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 03:10:57 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 3/3] parse/ConfHandler: allow / in variable flags Date: Thu, 14 Nov 2024 12:10:48 +0100 Message-Id: <20241114111048.2624711-3-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241114111048.2624711-1-alex.kanavin@gmail.com> References: <20241114111048.2624711-1-alex.kanavin@gmail.com> MIME-Version: 1.0 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, 14 Nov 2024 11:11:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16799 From: Alexander Kanavin This is beneficial for config fragments, as their names are specified via flags, and those names can include slashes: BB_CONF_FRAGMENT_SUMMARY[init/systemd] = "This fragment enables systemd as an init manager" Signed-off-by: Alexander Kanavin --- lib/bb/parse/parse_py/ConfHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py index 31001e2afe1..35321dacfe1 100644 --- a/lib/bb/parse/parse_py/ConfHandler.py +++ b/lib/bb/parse/parse_py/ConfHandler.py @@ -21,7 +21,7 @@ __config_regexp__ = re.compile( r""" ^ (?Pexport\s+)? (?P[a-zA-Z0-9\-_+.${}/~:]+?) - (\[(?P[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]*)\])? + (\[(?P[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@/]*)\])? \s* ( (?P:=) |