From patchwork Fri Dec 20 20:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 54514 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 A7434E7718B for ; Fri, 20 Dec 2024 20:42:02 +0000 (UTC) Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) by mx.groups.io with SMTP id smtpd.web10.4128.1734727312847997055 for ; Fri, 20 Dec 2024 12:41:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KcW7sztb; spf=pass (domain: gmail.com, ip: 209.85.167.181, mailfrom: jpewhacker@gmail.com) Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3eb9bbcc936so1216700b6e.0 for ; Fri, 20 Dec 2024 12:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734727311; x=1735332111; 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=PNNxYWCsZf5GuJYn34sLgvqUKT/O2E7PGd+Bl76vA+0=; b=KcW7sztbIrOIoqgJO/JRtmYWuNE3aM7+uB7K2HHNiutYJvHgkDgovJc/MgesFlPvgD OaDzEqS33SV/QKlQJydwlKHZYyM0A0qn5aPcL5ke/TW+hM1t9Fx2tCqP7j95wUpdjOpe GHZb2I8zFHR41pw2csCiZGse9eDDx3Iv4pgv+RvymjWQVd+jUV7RM2tT0ggiGbFAcjB+ Ut5Akp0vyyRGRLI3A86pWI70sIBx5e9nni1MPtCtO1zXs0Ux6mGzMj/uJ7MC3UXQ8D8s vx0dGNk7Y5POLmK/oLiDbr17sqHc6k8cn7Cntn7BBdmPM4uKyKPyRAkLvOgmxvTPAbh4 0fnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734727311; x=1735332111; 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=PNNxYWCsZf5GuJYn34sLgvqUKT/O2E7PGd+Bl76vA+0=; b=edY78cLDEmQMzm+FGM8zRAJfvYf5fUVOtDVJjBkPXbdumpAprA8qssDzjuPLmtlFyM FJihVs1YeHvJMqZIeWarhqPU27AvmwG64lL7zW386hlEMPn/O028x2dqKN8t9xo4+VVb AKoOArnC7Gsy1B3vtFE86ofWXEDkE8dvOqivehLvCOuDzmcUnYP4ylypG8YX9p/AmosD 64GYKpeEPMY9PxWh7bzYHlfRGnvp4v4b5jjAej8bcsX6bTQKvnxlqRDRLQHqh3PGwomp 3O5qMOtM4ZpFw7zMVdrwbk87CgIuLazBDCH0nArl9VafTlZp9JMIdWWZYwZLKGdbCRqS O30A== X-Gm-Message-State: AOJu0YxrQ1SbO54VhK5Vrd8TOxo5VOm7lVe7uireR58PmM8lv1g3RPqw h3841zwquiMJc4WLV/gGGuUoPua/Bchyle07whxTkIJ2LdftmBhtVCPx+A== X-Gm-Gg: ASbGncvbTJ3zGF0TAe8bOfXzwc6T/0RYrQA72cNrsfPW8YUSHTSCXQvX/F6J3YiLsYI /bBl8v05oCQEPhTreHcN6ImW4tYV7LvgyDpqgrjhZsZ0cG/fd97YyIWyeV71lFPydpGlFhKUqCF Ez89NQ1fP+cMtepmOGPtUoKN49q/shH2FpCfn/a8N5Qjiw4NYrsB7u/snhfadHIZEK+B9GAeX9A 6tKLZKdOZXXnAUHYO2AUFt2j4sW4CAghSbxsVUxThucMppqpezEh7U= X-Google-Smtp-Source: AGHT+IE0qzrBOak9/31bm1uTVpgmu3b0HFs/wLUMNdCFzynhdtdHvJrVrEEw5PLqGQJt48dJjoq62A== X-Received: by 2002:a05:6808:14c8:b0:3e6:580e:f12c with SMTP id 5614622812f47-3ed88f42295mr2257042b6e.10.1734727310891; Fri, 20 Dec 2024 12:41:50 -0800 (PST) Received: from localhost.localdomain ([2601:282:4300:19e0::dc1a]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3ece26db9dasm975106b6e.48.2024.12.20.12.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 12:41:50 -0800 (PST) From: Joshua Watt X-Google-Original-From: Joshua Watt To: openembedded-core@lists.openembedded.org Cc: Joshua Watt Subject: [OE-core][PATCH 1/2] lib: configfragments: Restrict fragment file checking Date: Fri, 20 Dec 2024 13:41:44 -0700 Message-ID: <20241220204145.2636370-1-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.47.1 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 ; Fri, 20 Dec 2024 20:42:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/208988 The current implementation of the config fragments is too aggressive in checking files; any file in the fragment directory is checked, including hidden files or files with weird extensions. In particular, if an editor is creating temporary backup files when editing, these will be checked and will almost assuredly fail, which prevents the tool from running. Add a filter so that only non-hidden files that end with .conf are checked. Signed-off-by: Joshua Watt --- meta/lib/bbconfigbuild/configfragments.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/lib/bbconfigbuild/configfragments.py b/meta/lib/bbconfigbuild/configfragments.py index 30cc5ece07..a0c3883399 100644 --- a/meta/lib/bbconfigbuild/configfragments.py +++ b/meta/lib/bbconfigbuild/configfragments.py @@ -43,6 +43,8 @@ class ConfigFragmentsPlugin(LayerPlugin): for topdir, dirs, files in os.walk(os.path.join(layerdir, fragments_path_prefix)): fragmentdir = os.path.relpath(topdir, os.path.join(layerdir, fragments_path_prefix)) for fragmentfile in sorted(files): + if fragmentfile.startswith(".") or not fragmentfile.endswith(".conf"): + continue fragmentname = os.path.normpath("/".join((layername, fragmentdir, fragmentfile.split('.')[0]))) fragmentpath = os.path.join(topdir, fragmentfile) fragmentsummary, fragmentdesc = self.get_fragment_info(fragmentpath, fragmentname) From patchwork Fri Dec 20 20:41:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 54515 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 A86B2E7718C for ; Fri, 20 Dec 2024 20:42:02 +0000 (UTC) Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) by mx.groups.io with SMTP id smtpd.web10.4130.1734727316484557479 for ; Fri, 20 Dec 2024 12:41:56 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZzwfBMea; spf=pass (domain: gmail.com, ip: 209.85.167.172, mailfrom: jpewhacker@gmail.com) Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3ebadbb14dcso964344b6e.3 for ; Fri, 20 Dec 2024 12:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734727314; x=1735332114; 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=12l7Nn23gkoRUSlW2rQg3Z83dBJI0FtaE3fQ1K/Ponk=; b=ZzwfBMeae42QVRWKONGt95l2JqZ0yuCK/mnDSSJqWUVYLXOli30I9cKArbmZPqxfE/ 4ScMKga74NX2ovEIBGP2KiVWk+7hbdc9WoNcWUQllJOzpFb2NkOEr90UIOedtv1khM09 z3s5Vx9WrOnXGkTIaFt4d+Q5jy2OFUufhnVSd3e3smbYRH2qOznNhUyFkz7VvmBgG2A2 qwFaHKicMXgnWJcdzcRW5N1qpUgIWfZlAhhK/tb8aXhyMATPTPcIe3O6HEzjsHNS0tIr oNuVcA7j62qZBYPyI837l4b+ACbCHZ+jsAPDbV44j7lvSVEbxgJ5jrnMRzueaCCSqDoX BIVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734727314; x=1735332114; 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=12l7Nn23gkoRUSlW2rQg3Z83dBJI0FtaE3fQ1K/Ponk=; b=c+9ZuZBViJDjVkDl8VT1tQ92EqcsmFB1rIJ2bZqHOGQyGBE789KJ7qnh8e5IPyguh/ 9xBYVdz9CdEaW0MlB7bRQ4H3IObE+AFgIkxhFnm3cg9GvyLQUVZfTv0DqQlUFV5kcMq1 HGfnm4oOXckAUdEYHWZee6x0B5QQCvcjO4lEEOUFcch65ChrI2gvncibxaOeNmGfuAeb TkQzq4AHFgln531QqJytVNnW4avnOEZdzx/T74Qjp7VsrPxF6TXj8oropcRWPBaKFkgt 9K4dbKKuDeyLQZUD2dMfjQq0GbUEvVOlQCJAVadVneaVHWKSUVWzqxvsEYZVs3zp5o69 xFzw== X-Gm-Message-State: AOJu0YzDv4k+I3yh7foqpmfkAMdrLPVvimCpx6BIqDP8PiRmGJV7+E1o JrGyjjl+/oETSDlPaqrKaIr497glICj5CGGPqPOBLDv7cTKsEsY4kh4QXQ== X-Gm-Gg: ASbGncve5awsCqG7rHL3xHIwA11SkzxknLaEm7RjRo9/8wg87UKLXRhwrFrJQ/FkFYN 2EHzkFiMeGbuk+xQNNS1NwrMye/g+/19NHtRjpbAXITJ7LYnOOoQZPjgYnzaY223Kqf2QwgHf5R MrR0FsHTVsaBk675vXw/zxCgeMHIuxX7/QTECWf95ckhCtiNcNW0HTDidcbzVAmzKly5/jjCmCC 50F0HfsBVqygVcXSjSWZwx4JOwPW1u3m/RmtbIYAB8g5nN3o0W9yVk= X-Google-Smtp-Source: AGHT+IFeBGf515h+HVBZOlfLaA0OHlkwJR1NldsI0u6J7ulfQVpJ7l1fXrkLurQQ0+e55PiZ3gs2Zw== X-Received: by 2002:a05:6808:1906:b0:3eb:5480:59c6 with SMTP id 5614622812f47-3ed890a93aemr2878618b6e.30.1734727314626; Fri, 20 Dec 2024 12:41:54 -0800 (PST) Received: from localhost.localdomain ([2601:282:4300:19e0::dc1a]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3ece26db9dasm975106b6e.48.2024.12.20.12.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 12:41:53 -0800 (PST) From: Joshua Watt X-Google-Original-From: Joshua Watt To: openembedded-core@lists.openembedded.org Cc: Joshua Watt Subject: [OE-core][PATCH 2/2] lib: configfragements: enable/disable multiple fragements at once Date: Fri, 20 Dec 2024 13:41:45 -0700 Message-ID: <20241220204145.2636370-2-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220204145.2636370-1-JPEWhacker@gmail.com> References: <20241220204145.2636370-1-JPEWhacker@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 ; Fri, 20 Dec 2024 20:42:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/208989 Extends the 'enable-fragment' and 'disable-fragment' commands so that they accept multiple fragments at once as a convenience for the user Signed-off-by: Joshua Watt --- meta/lib/bbconfigbuild/configfragments.py | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/meta/lib/bbconfigbuild/configfragments.py b/meta/lib/bbconfigbuild/configfragments.py index a0c3883399..a4896cc734 100644 --- a/meta/lib/bbconfigbuild/configfragments.py +++ b/meta/lib/bbconfigbuild/configfragments.py @@ -103,34 +103,37 @@ class ConfigFragmentsPlugin(LayerPlugin): """ Enable a fragment in the local build configuration """ def enable_helper(varname, origvalue, op, newlines): enabled_fragments = origvalue.split() - if args.fragmentname in enabled_fragments: - print("Fragment {} already included in {}".format(args.fragmentname, args.confpath)) - else: - enabled_fragments.append(args.fragmentname) + for f in args.fragmentname: + if f in enabled_fragments: + print("Fragment {} already included in {}".format(f, args.confpath)) + else: + enabled_fragments.append(f) return " ".join(enabled_fragments), None, 0, True - if not self.fragment_exists(args.fragmentname): - raise Exception("Fragment {} does not exist; use 'list-fragments' to see the full list.".format(args.fragmentname)) + for f in args.fragmentname: + if not self.fragment_exists(f): + raise Exception("Fragment {} does not exist; use 'list-fragments' to see the full list.".format(f)) self.create_conf(args.confpath) modified = bb.utils.edit_metadata_file(args.confpath, ["OE_FRAGMENTS"], enable_helper) if modified: - print("Fragment {} added to {}.".format(args.fragmentname, args.confpath)) + print("Fragment {} added to {}.".format(", ".join(args.fragmentname), args.confpath)) def do_disable_fragment(self, args): """ Disable a fragment in the local build configuration """ def disable_helper(varname, origvalue, op, newlines): enabled_fragments = origvalue.split() - if args.fragmentname in enabled_fragments: - enabled_fragments.remove(args.fragmentname) - else: - print("Fragment {} not currently enabled in {}".format(args.fragmentname, args.confpath)) + for f in args.fragmentname: + if f in enabled_fragments: + enabled_fragments.remove(f) + else: + print("Fragment {} not currently enabled in {}".format(f, args.confpath)) return " ".join(enabled_fragments), None, 0, True self.create_conf(args.confpath) modified = bb.utils.edit_metadata_file(args.confpath, ["OE_FRAGMENTS"], disable_helper) if modified: - print("Fragment {} removed from {}.".format(args.fragmentname, args.confpath)) + print("Fragment {} removed from {}.".format(", ".join(args.fragmentname), args.confpath)) def do_disable_all_fragments(self, args): """ Disable all fragments in the local build configuration """ @@ -151,11 +154,11 @@ class ConfigFragmentsPlugin(LayerPlugin): parser_enable_fragment = self.add_command(sp, 'enable-fragment', self.do_enable_fragment, parserecipes=False) parser_enable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) - parser_enable_fragment.add_argument('fragmentname', help='The name of the fragment (use list-fragments to see them)') + parser_enable_fragment.add_argument('fragmentname', help='The name of the fragment (use list-fragments to see them)', nargs='+') parser_disable_fragment = self.add_command(sp, 'disable-fragment', self.do_disable_fragment, parserecipes=False) parser_disable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) - parser_disable_fragment.add_argument('fragmentname', help='The name of the fragment') + parser_disable_fragment.add_argument('fragmentname', help='The name of the fragment', nargs='+') parser_disable_all = self.add_command(sp, 'disable-all-fragments', self.do_disable_all_fragments, parserecipes=False) parser_disable_all.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath))