From patchwork Fri Feb 3 10:38:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1736906 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=uG3x8eVJ; 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 4P7XFq46Syz23gY for ; Fri, 3 Feb 2023 21:39:10 +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 1pNtTC-0005Hy-47; Fri, 03 Feb 2023 10:39:02 +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 1pNtTB-0005HX-5V for kernel-team@lists.ubuntu.com; Fri, 03 Feb 2023 10:39:01 +0000 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (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 E2FE33FE87 for ; Fri, 3 Feb 2023 10:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675420740; bh=d33XOypbvA11W+fP62C/2u3PDya6cLbKwzCQ7eAw2sw=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=uG3x8eVJ4pfEWpMki8HKcs+4UTRic5XVPG2kPPx13sErtnqd5Hjz6UeVy++qdFhtM S8e+mF/kS5vYjjWA9uEbU73/PXIAzWnP9gxpo3DnFhI701UinPDgrsgNP+cWzmbBEd a7lmyiPFzgI9iD8ci2LC8Su39MqrCRycS48gsOBEtPwA9T9GEwWKlksJyyrSL8S6D7 zM4knnHkvFjVjZjzKAsIZyCogTAeN1NguIajQnooNtVd6BKphAC8O8B0c5tDl3dw7K FQVAOS3J+WdtCXzCi/1o6/VJOmU749u3R9eYbb51NSl7qIqOL/GmXtFquoKp2tuhe0 Mf0XUPj8seKpQ== Received: by mail-ej1-f71.google.com with SMTP id ae2-20020a17090725c200b0088d91fe7ec5so3633571ejc.1 for ; Fri, 03 Feb 2023 02:39:00 -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:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d33XOypbvA11W+fP62C/2u3PDya6cLbKwzCQ7eAw2sw=; b=7Pa5cNC85JTO7sX88/5MImmqiRTXSxTvf8kC0gS6m36eyUAwwpyby8NIvb1mIC7dfT f17UlBnux4HkYteYBolL9wGOBtDb3y4EBeS5CcjinF21PyFd8enOAri2huJqXI+DyXYP MkWnPz6GlE4yfkurEFzn14NvCBMm2CL+e64PLjUEHowNeYKgumfoGEfODeYYYyx8zdUa dlBUL2R6qjT8Od2F7Obl+4VsundKhuJJI+MhocNAavAsI4e4qTJloNYmM/k6TNtiIhNl u9mlqgQpsIA2Yd0BJo8O+2vBAr4/EAvCJy4v9TM4d1xf/91AKfB7MZvkJ289IQJ8OPJW ruEA== X-Gm-Message-State: AO0yUKVhBQSCC9jgwvbw4VuiUmE2HZ9yLGAxJC1WAFwCRREiOSjnUeDM LFMv+ehwCcpL6BlgtoKVMB7NLy9q/I1qCK3izePVc/e6/sGUsvtoYMMIi7dIZIPpBL6DrYtByD1 4PwqJ0yx9TGSxppRY/jnKQABGNETkep10uNzvSnbwKg== X-Received: by 2002:a17:906:c156:b0:88d:ba89:1835 with SMTP id dp22-20020a170906c15600b0088dba891835mr5753806ejc.6.1675420740573; Fri, 03 Feb 2023 02:39:00 -0800 (PST) X-Google-Smtp-Source: AK7set8Lny2Uifdrta++c/ypQLxwMWmutnMhxzbIIfI1mLolv2ZEPthAst2Ldtltpu3uD5C29UXazQ== X-Received: by 2002:a17:906:c156:b0:88d:ba89:1835 with SMTP id dp22-20020a170906c15600b0088dba891835mr5753798ejc.6.1675420740356; Fri, 03 Feb 2023 02:39:00 -0800 (PST) Received: from gollum.fritz.box ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id ka6-20020a170907920600b0088f8a61eb48sm1175695ejb.154.2023.02.03.02.38.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 02:38:59 -0800 (PST) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [Unstable/Lunar][RFC][PATCH] UBUNTU: [Packaging] kernelconfig: Automatically split the annotations file Date: Fri, 3 Feb 2023 11:38:59 +0100 Message-Id: <20230203103859.528812-1-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.34.1 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" We currently need an annotation rule for every single kernel config because the parser does not understand dependencies. A lot of configs are therefore due to other config setting or dependencies and are not directly controllable but they still end up in the annotations file and pollute it. Ideally, all configs that are set deliberately should have a note, the rest are just mechanically introduced necessary options. With this patch, the annotations file is split up and all rules *without* notes are moved to a separate file 'annotations.dep'. The idea being that by looking at the 'main' annotations file, one can tell what this kernel's config is all about. This is especially helpful for derivatives that include and override the master annotations. Obviously the whole concept depends on the maintainer being diligent and adding notes to configs that are manually modified... Signed-off-by: Juerg Haefliger --- debian/scripts/misc/kernelconfig | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/debian/scripts/misc/kernelconfig b/debian/scripts/misc/kernelconfig index a3559f323b57..578972083259 100755 --- a/debian/scripts/misc/kernelconfig +++ b/debian/scripts/misc/kernelconfig @@ -173,6 +173,39 @@ else python3 debian/scripts/misc/annotations -f "${annotations_file}" \ --arch "${arch}" --flavour "${flavour}" --import "${tmp_conf_file}" done + + if grep -q '^include "annotations.dep"' "${annotations_file}" ; then + echo + echo "Splitting annotations ..." + echo + + # Collect the configs with notes + declare -A config_w_notes + while IFS=" " read -r config rest ; do + config_w_notes[${config}]=1 + done < <(grep '^CONFIG_.* note<' "${annotations_file}") + + # Move all configs without notes to the dependers file + true > "${annotations_file}".new + while IFS= read -r line ; do + outfile="${annotations_file}".new + if [ "${line#CONFIG_}" != "${line}" ] ; then + config=${line%% *} + if [ ${config_w_notes[${config}]:-0} -eq 0 ] ; then + outfile="${annotations_file}".dep + fi + fi + echo "${line}" >> "${outfile}" + done < "${annotations_file}" + + # Squeeze multiple empty lines and remove any trailing + # empty line from the annotations file + cat -s "${annotations_file}".new | sed '${/^$/d}' > "${annotations_file}" + rm "${annotations_file}".new + + # Sort the dependers file + sort -uo "${annotations_file}".dep "${annotations_file}".dep + fi fi exit "${rc}"