From patchwork Thu Nov 14 22:17:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoann Congal X-Patchwork-Id: 52515 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 816DDD6A249 for ; Thu, 14 Nov 2024 22:18: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.6940.1731622682107202076 for ; Thu, 14 Nov 2024 14:18:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@smile.fr header.s=google header.b=eQugWm/4; spf=pass (domain: smile.fr, ip: 209.85.221.44, mailfrom: yoann.congal@smile.fr) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-37d49ffaba6so744715f8f.0 for ; Thu, 14 Nov 2024 14:18:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile.fr; s=google; t=1731622680; x=1732227480; 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=RbOgv1FfVWtwzgD2fU/mGiMnkC7x/PAOffhLrnMZon0=; b=eQugWm/4nM6JKMJrNatQS8ijRWx2uArsod7D13a29rxZjxtpsO1c67T5Rd38ZTeNHT RWHNulfc2QflcPO3UtGRWa6YlsOc42yvMqaHfK3a3V0unNksqoDLfnUKXlsP7JrH2yCU jwv2CWMONZbBxEmiQWWdmj7MwHEx7wnLLQaJ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731622680; x=1732227480; 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=RbOgv1FfVWtwzgD2fU/mGiMnkC7x/PAOffhLrnMZon0=; b=T4wPutJxCHPboY2hoNolf0gwlhVtXk1aWjpTySMstP4PFBa7vI6VgTlRdvdMppVnjm 8JlLtSG8QezpQKMRGKHnfVhzsSOTW2ouvwNKrG8ra1ixlpNhr7r5vHCujbRB4JCo6kw5 CHrgTD7kZ/HRk4u7lOliowl/DTqJcpeji6Ak+r/TV3Cjf1S5aozHdlp7qLzVnCtxbGFl jCFsWhzzbxg16oVPUGpS+GEYXYFGlCOcfZ5Y3z/T7Q1j6JDaV1zLGJNAvXy6k8AmOhnI Le7JwMOaKm3XOnOXaMtjaXE2ogMdBXlENPPAblQ7ywG4oJbu9O2zEELkAMxPig2Lw2ao yRJQ== X-Gm-Message-State: AOJu0YyP1TxCn2aL9XuzmidyCmY85NTUVklooqkm0x0z79+zp8ggmW87 TJp6AzQAXM7z5wUgKWeh+ME2Aw7h7UAxfW7efmf6XXplxlRjBPaideHMpmNL49khWGoi0OZIstc k X-Google-Smtp-Source: AGHT+IG3/3GDb2qPuH8W6Hr++XezcEGserWcK8HaNb7AxovRWemBWEG2tXk9z1m+4UJEgKUmxinQ1w== X-Received: by 2002:a05:6000:144f:b0:37c:d23a:1e4 with SMTP id ffacd0b85a97d-38225a26471mr241425f8f.30.1731622680311; Thu, 14 Nov 2024 14:18:00 -0800 (PST) Received: from P-ASN-ECS-830T8C3.local ([2a04:cec0:11fb:21bd:1f18:7aa1:7b8e:5f4a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae4c125sm2578731f8f.110.2024.11.14.14.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 14:18:00 -0800 (PST) From: Yoann Congal To: bitbake-devel@lists.openembedded.org Cc: Yoann Congal Subject: [PATCH v2 1/2] tinfoil: add new "finalizeData" API Date: Thu, 14 Nov 2024 23:17:25 +0100 Message-Id: <20241114221725.3826753-1-yoann.congal@smile.fr> 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 22:18:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16801 From: Yoann Congal Create a new tinfoil API "finalizeData" which does key expantion and runs the anonymous functions to allow bitbake-getvar to have the same output as "bitbake -e". Signed-off-by: Yoann Congal --- v1->v2: No change --- lib/bb/command.py | 8 ++++++++ lib/bb/tinfoil.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/lib/bb/command.py b/lib/bb/command.py index 695277f1e..a63427660 100644 --- a/lib/bb/command.py +++ b/lib/bb/command.py @@ -24,6 +24,7 @@ import io import bb.event import bb.cooker import bb.remotedata +import bb.parse class DataStoreConnectionHandle(object): def __init__(self, dsindex=0): @@ -582,6 +583,13 @@ class CommandsSync: return DataStoreConnectionHandle(idx) parseRecipeFile.readonly = True + def finalizeData(self, command, params): + newdata = command.cooker.data.createCopy() + bb.data.expandKeys(newdata) + bb.parse.ast.runAnonFuncs(newdata) + idx = command.remotedatastores.store(newdata) + return DataStoreConnectionHandle(idx) + class CommandsAsync: """ A class of asynchronous commands diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py index dcd3910cc..0e937fba3 100644 --- a/lib/bb/tinfoil.py +++ b/lib/bb/tinfoil.py @@ -633,6 +633,12 @@ class Tinfoil: fn = self.get_recipe_file(pn) return self.parse_recipe_file(fn) + def finalizeData(self): + """ + Run anonymous functions and expand keys + """ + return self._reconvert_type(self.run_command('finalizeData'), 'DataStoreConnectionHandle') + def parse_recipe_file(self, fn, appends=True, appendlist=None, config_data=None): """ Parse the specified recipe file (with or without bbappends) From patchwork Thu Nov 14 22:17:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoann Congal X-Patchwork-Id: 52516 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 647DED6A250 for ; Thu, 14 Nov 2024 22:18:28 +0000 (UTC) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.web10.6944.1731622698269449664 for ; Thu, 14 Nov 2024 14:18:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@smile.fr header.s=google header.b=Oorh1ycB; spf=pass (domain: smile.fr, ip: 209.85.128.54, mailfrom: yoann.congal@smile.fr) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-432d866f70fso9863115e9.2 for ; Thu, 14 Nov 2024 14:18:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile.fr; s=google; t=1731622696; x=1732227496; 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=BBxZVUeCI96ycUxfu2XPdSH2Y2dsNEOUKePFBKd7kx8=; b=Oorh1ycB+m06kNTNWv8KV4ZAktk5st9xq5QVGz0HBc49Yo88CK2u40DBNY+ODoKgSL jDeUzrMIJ/KDeq8Tse28VbiJMwLRVLB0keJxgwtFNY4Km2SNTfEpZ+kNlxM6AW0QAYJ1 q1rqDjcoPrENTZLiyHkNrewcgmK/3KjGY4s6o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731622696; x=1732227496; 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=BBxZVUeCI96ycUxfu2XPdSH2Y2dsNEOUKePFBKd7kx8=; b=wstydzP13XWd8aZeqSbrvVll/P+6RhI2jQW5RkODp/XvHXZZbo4H5jYH/d0PkpiDJi v9Hvmp3zcuCB2yFKlBE8zk58jpAhzNFLLkzS97ntBP79Bp4yQX1jSpKnAPlt9TWESSnG G+Hx8Ds0tBHCJsNhPCwXcpK2CBej1H1W4qPpeSE1YjiVTA0FMq5rKbk5H8L+OBTdZ4FD ag5LSHdlJPCmKa1wfqFapDAetPuxD5634m5Ut1fTIMiwL9+Tr4Fn4R3Kam+X2JHcOwQP RRng1dJUo4OxSW7mB71kJrXkfDM2o5hBZrQdfMgxiRWr4xvvTqzj2/iRfcNkXm5DIxQg oaCg== X-Gm-Message-State: AOJu0YxMbQCUBwFftT7OlZqBwOLFiWHmNe7UzRDC9RoG9DXhk4aJJALW TZnCzVtz5k1E/brqHKR8UxcsoGMIrz7IGU3BLFuYEY4oFifbR5NOuQ16fe6PQsJo5AM99xav2nz V X-Google-Smtp-Source: AGHT+IGoO+LFwU7wj2jV+NQYWUDA5kNTlITUj9D/YX8shOJjTHJAP/B4dL0PSDO7DBKOB0mUgwLnkw== X-Received: by 2002:a05:600c:1c23:b0:430:5356:ac92 with SMTP id 5b1f17b1804b1-432df721a19mr2712635e9.7.1731622696404; Thu, 14 Nov 2024 14:18:16 -0800 (PST) Received: from P-ASN-ECS-830T8C3.local ([2a04:cec0:11fb:21bd:1f18:7aa1:7b8e:5f4a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae4c125sm2578731f8f.110.2024.11.14.14.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 14:18:16 -0800 (PST) From: Yoann Congal To: bitbake-devel@lists.openembedded.org Cc: Yoann Congal Subject: [PATCH v2 2/2] bitbake-getvar: use finalizeData tinfoil API to get identical result to "bitbake -e" Date: Thu, 14 Nov 2024 23:17:27 +0100 Message-Id: <20241114221725.3826753-2-yoann.congal@smile.fr> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241114221725.3826753-1-yoann.congal@smile.fr> References: <20241114221725.3826753-1-yoann.congal@smile.fr> 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 22:18:28 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16802 From: Yoann Congal Fixes [YOCTO #15638] Signed-off-by: Yoann Congal --- v1->v2: Only call finalizeData() in the "not -r" case. In the "-r" case, the data is already finalized and calling finalizeData() overwrite correct data. --- bin/bitbake-getvar | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/bitbake-getvar b/bin/bitbake-getvar index 8901f99ae..20c0b696f 100755 --- a/bin/bitbake-getvar +++ b/bin/bitbake-getvar @@ -43,7 +43,9 @@ if __name__ == "__main__": d = tinfoil.parse_recipe(args.recipe) else: tinfoil.prepare(quiet=2, config_only=True) - d = tinfoil.config_data + # Expand keys and run anonymous functions to get identical result to + # "bitbake -e" + d = tinfoil.finalizeData() value = None if args.flag: