From patchwork Tue Feb 7 07:36:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1738761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=ExACJ9fy; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P9w172x60z23y8 for ; Tue, 7 Feb 2023 18:36:26 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pPIWW-0002W7-Hc; Tue, 07 Feb 2023 07:36:16 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pPIWS-0002Ue-9O for kernel-team@lists.ubuntu.com; Tue, 07 Feb 2023 07:36:12 +0000 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 7467D3FDAA for ; Tue, 7 Feb 2023 07:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675755370; bh=t4TS8JWI5q3KgJd+IMgr1H+yq8pDZt2S1tEO6YuUH9g=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ExACJ9fyih3lbBTvGTzN8DVVaAc8k5QoKVaZ5FlThP7rjy2ZvdARRLB+kFQZ13R5z nbgi/W3U2hNsT+wnR2v0PJUZUzedqDyhKQaJT4kNSVLBJcZx8qS2YIjrEqQEfT2a1t IMAI+cIuT6jFpFobL7yV5M1LkyE/GtQHQoZls37hgniBKosvHeITq94eXw+4gB37VE CCF/uVdUsJlfCPSgs2d4181KKf+eH/YsmCI3mA5HurOp7s4F3FDyI84Ogc0f5uxNhQ bwTTsynNlHVVtxOTQkqbvxN12NwZPzyVEQP2kcWqFJqurXBhg0HSSTLaSC3+isCC3Z QFB6fRN4c9LPw== Received: by mail-ej1-f70.google.com with SMTP id ae2-20020a17090725c200b0088d91fe7ec5so10369835ejc.1 for ; Mon, 06 Feb 2023 23:36:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t4TS8JWI5q3KgJd+IMgr1H+yq8pDZt2S1tEO6YuUH9g=; b=sfPMYC3YEOnv69QKCIevDik2epoFkCg6rZ0OYxHWTT07jD4808wcuu2OPjf2Gzi+4L JDpXpQlzwtUkoCgKM9jYdnMZYL0qX3RTbZg9LGK2buoAwlaV4e3leJ+xDUD6GI/yubn4 Zcy/zllIcveeZsiv3Je7Bv5qv+DFrAg7AdNy8H5t1EXJ87aF17L0IXO9ueX34Vh3KsNo z1F5WImOmRFtNwdKiP19DjveLbW5oF7yMnpCJ8LWWxNGduo8O+9pBZxyM/o8QBKMOWnf 8M80/kKKUc1zgIlMo3UZE8MVxCsbiqkmZweB/XXgUyNCuleUTTKvp0U0J4lcpG0fED8k na6Q== X-Gm-Message-State: AO0yUKXJuKtHoVCyftS8SmLdiHNqF9BTjRaSc3CxmgMUvbTVffnw0d2W tn9FEc/XssHS7FLvIOjo4goBUP4WnaFxMji1q1ADGIbWe3TTfBbLBzhuR9vmIzEXqcetlxGGm0x 8NbYMdvQCids2rfijXX3h7SY3aD91X0P7/MJYwCYzbigN4bc= X-Received: by 2002:a50:f61b:0:b0:4a0:e237:2cef with SMTP id c27-20020a50f61b000000b004a0e2372cefmr2580941edn.4.1675755370202; Mon, 06 Feb 2023 23:36:10 -0800 (PST) X-Google-Smtp-Source: AK7set9+vFuJxd5svLsw7X/eYgSl5UiSDYZIDn/Cu0+LuFAVJvhw91ZOfr5Xknv1Gul2iEY8ZONeXw== X-Received: by 2002:a50:f61b:0:b0:4a0:e237:2cef with SMTP id c27-20020a50f61b000000b004a0e2372cefmr2580934edn.4.1675755370029; Mon, 06 Feb 2023 23:36:10 -0800 (PST) Received: from gollum.fritz.box ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id fg10-20020a056402548a00b004a23558f01fsm6008679edb.43.2023.02.06.23.36.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 23:36:09 -0800 (PST) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [Unstable/Lunar][PATCH 2/5] UBUNTU: [Packaging] annotations: Clean up policy writes Date: Tue, 7 Feb 2023 08:36:04 +0100 Message-Id: <20230207073607.913994-3-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207073607.913994-1-juerg.haefliger@canonical.com> References: <20230207073607.913994-1-juerg.haefliger@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" The logic to determine if policy lines need to be written to the output file is a little convoluted. Basically, if there is no 'policy' key in a config, there is nothing to do, so put that check at the beginning of the loop. Signed-off-by: Juerg Haefliger --- debian/scripts/misc/kconfig/annotations.py | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/debian/scripts/misc/kconfig/annotations.py b/debian/scripts/misc/kconfig/annotations.py index 2af5f7c5b17b..ee679903d9da 100644 --- a/debian/scripts/misc/kconfig/annotations.py +++ b/debian/scripts/misc/kconfig/annotations.py @@ -276,25 +276,29 @@ class Annotation(Config): # Only save local differences (preserve includes) for conf in sorted(self.config): - old_val = tmp_a.config[conf] if conf in tmp_a.config else None new_val = self.config[conf] + if 'policy' not in new_val: + continue + # If new_val is a subset of old_val, skip it - if old_val and 'policy' in old_val and 'policy' in new_val: + old_val = tmp_a.config.get(conf) + if old_val and 'policy' in old_val: if old_val['policy'] == old_val['policy'] | new_val['policy']: continue - if 'policy' in new_val: - val = dict(sorted(new_val['policy'].items())) - line = f"{conf : <47} policy<{val}>" - if 'note' in new_val: - val = new_val['note'] - if new_val.get('oneline', False): - # Single line - line += f' note<{val}>' - else: - # Separate policy and note lines, - # followed by an empty line - line += f'\n{conf : <47} note<{val}>\n' - tmp.write(line + "\n") + + # Write out the policy (and note) line(s) + val = dict(sorted(new_val['policy'].items())) + line = f"{conf : <47} policy<{val}>" + if 'note' in new_val: + val = new_val['note'] + if new_val.get('oneline', False): + # Single line + line += f' note<{val}>' + else: + # Separate policy and note lines, + # followed by an empty line + line += f'\n{conf : <47} note<{val}>\n' + tmp.write(line + "\n") # Replace annotations with the updated version tmp.flush()