Received: by 10.213.65.68 with SMTP id h4csp1755563imn; Sun, 8 Apr 2018 10:40:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx48OePNbmFx5fyHVI+6alXisu7dPVUOlCCNOGAW1FFqIXAdvGwFvdpnbHSbCG2LC30cB8YKG X-Received: by 10.99.42.209 with SMTP id q200mr22598645pgq.379.1523209252980; Sun, 08 Apr 2018 10:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523209252; cv=none; d=google.com; s=arc-20160816; b=sL0BoZSNEk5VGS9eANpqp9ZA2UZGvRYGF1v4DUcbIvqm8hhsWRRx76O9SqiITMy6n+ TdzCEClOjvZdHhjmx9wOBmD8vZE/wBu8XF/aiyUhTTtu0DduUX0FhkDRUuWpp1gLOoe1 8j5/WwnR+orsTflbnJpf7Iuwd2v9SCKYRLlNJn+s+vD+lERh8Jf3ed5HGpZwhzGyzNCL Z/88v/rr7DmmAjkZdJQ0bt0mQ0x967JBrR+GxLBGS/GVOq8xP/h51xCzKqV3WzhGx3fl EKWvubxNmV/QraVvX8xffzLzW8AE9/ZLGkUlL45xwTmzaGiKwSEtT+NkfGkUPEBvLUHj 5bFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=tffkg0UCmX+aCLk6GDQFZ/6ZOVerjt9erI+txvXEuiI=; b=ld2bRGD12Z+vZsJuA+3yHVvjjJTBP+JF4L/AUuq4wKRbI1kPwbei+cgnpR4Bp5HdY/ TGMHKeMbuvgIdYeVyOMgjsyDV9Dfkh8rOGtUlD5M32L9gNBJl0jHyaF2o7BOg6ITQlYQ ynic4La1MqbNcTFK9EjQo71ZSPBJuVSbL8spozdmWcXMoaHmc8sETLyVkvr83dQtNwaf swpEssHlVAvoWvP+j25aSTaqklyg5iS0rxEKEx8v6Z0vaKVk/F+Sgubopw7VV4QzXgfE lix7Bf4Yq68K4UR7vntiztBR2tSjMOxR94mlRnH0QNNOtQyz5RU7jiwOQHNi3viQT2sG cr4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iBsaGQbJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3-v6si14852472plb.17.2018.04.08.10.40.01; Sun, 08 Apr 2018 10:40:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iBsaGQbJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbeDHQbZ (ORCPT + 99 others); Sun, 8 Apr 2018 12:31:25 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53628 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752251AbeDHQbX (ORCPT ); Sun, 8 Apr 2018 12:31:23 -0400 Received: by mail-wm0-f68.google.com with SMTP id 66so6771875wmd.3 for ; Sun, 08 Apr 2018 09:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tffkg0UCmX+aCLk6GDQFZ/6ZOVerjt9erI+txvXEuiI=; b=iBsaGQbJ5ZW1XVqXnS6qjvhM3Qcbz5ijn9nO2nNTa4B3ON62Vb7AdVPGphHiYwajwe lEs0SBz7plZJAv5PcASW3OsCiXyKhjnwSTXASWGoK+dmVWpp8L87/DqhlKKZpI/jm18w Q15nNhOMiJExNdV9YNaIFemqGCHoWVJLpbrs8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tffkg0UCmX+aCLk6GDQFZ/6ZOVerjt9erI+txvXEuiI=; b=WRH3tHt+PpldEkABbFz1Q6CPu4f+OA6KRF+rWaCIBQnSy0uGF9WOfX4qsMgP2ESpBr mUGVmyIedM7NSUjnpv/M2nVAhsq9ILpWGXo9F69bR3xhGeUn7TWsiBdOrv8TvSfojke9 /xFhsBfzDqL6Ur+k+Ag8ruhbMAT9dgUwa7oIBG2Jo7RUb40WBMpOpmPmwnE5v1QrwZ6h 0ttKQz+OW5YW6NGGz7BZCDsKUdrPZoiraxx6aQQi93JKQFE1D1OkZw535487J10+8Zr+ IyojRvij4ThhpzyU//DYT6VcN11bA04ubHUNMWwK5HKsrQxvligUjgLg31XEEaPLdTGq eagQ== X-Gm-Message-State: ALQs6tBPJx+EpYLn0x6SNv5Z1Wp9e2b4OVSYmmMLb7unqFd1XLGJkmh8 jy369C9+jmv1yNG0SdLOKq58Tw== X-Received: by 10.28.241.18 with SMTP id p18mr19430848wmh.40.1523205082210; Sun, 08 Apr 2018 09:31:22 -0700 (PDT) Received: from localhost.localdomain ([95.235.67.87]) by smtp.gmail.com with ESMTPSA id 10sm5335894wrz.58.2018.04.08.09.31.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Apr 2018 09:31:21 -0700 (PDT) From: Andrea Parri To: Ingo Molnar , Jonathan Corbet Cc: linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , paulmck@linux.vnet.ibm.com, Andrea Parri Subject: [RFC PATCH v2 1/6] Documentation/features: Add script that refreshes the arch support status files in place Date: Sun, 8 Apr 2018 18:30:22 +0200 Message-Id: <1523205027-31786-2-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523205027-31786-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1523205027-31786-1-git-send-email-andrea.parri@amarulasolutions.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provides the script: Documentation/features/scripts/features-refresh.sh which operates on the arch-support.txt files and refreshes them in place. This way [1], "[...] we soft- decouple the refreshing of the entries from the introduction of the features, while still making it all easy to keep sync and to extend." [1] https://marc.info/?l=linux-kernel&m=152240950509781&w=2 Suggested-by: Ingo Molnar Signed-off-by: Andrea Parri Cc: Ingo Molnar Cc: Jonathan Corbet Cc: Andrew Morton --- Documentation/features/scripts/features-refresh.sh | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 Documentation/features/scripts/features-refresh.sh diff --git a/Documentation/features/scripts/features-refresh.sh b/Documentation/features/scripts/features-refresh.sh new file mode 100755 index 0000000000000..9e72d38a0720e --- /dev/null +++ b/Documentation/features/scripts/features-refresh.sh @@ -0,0 +1,98 @@ +# +# Small script that refreshes the kernel feature support status in place. +# + +for F_FILE in Documentation/features/*/*/arch-support.txt; do + F=$(grep "^# Kconfig:" "$F_FILE" | cut -c26-) + + # + # Each feature F is identified by a pair (O, K), where 'O' can + # be either the empty string (for 'nop') or "not" (the logical + # negation operator '!'); other operators are not supported. + # + O="" + K=$F + if [[ "$F" == !* ]]; then + O="not" + K=$(echo $F | sed -e 's/^!//g') + fi + + # + # F := (O, K) is 'valid' iff there is a Kconfig file (for some + # arch) which contains K. + # + # Notice that this definition entails an 'asymmetry' between + # the case 'O = ""' and the case 'O = "not"'. E.g., F may be + # _invalid_ if: + # + # [case 'O = ""'] + # 1) no arch provides support for F, + # 2) K does not exist (e.g., it was renamed/mis-typed); + # + # [case 'O = "not"'] + # 3) all archs provide support for F, + # 4) as in (2). + # + # The rationale for adopting this definition (and, thus, for + # keeping the asymmetry) is: + # + # We want to be able to 'detect' (2) (or (4)). + # + # (1) and (3) may further warn the developers about the fact + # that K can be removed. + # + F_VALID="false" + for ARCH_DIR in arch/*/; do + K_FILES=$(find $ARCH_DIR -name "Kconfig*") + K_GREP=$(grep "$K" $K_FILES) + if [ ! -z "$K_GREP" ]; then + F_VALID="true" + break + fi + done + if [ "$F_VALID" = "false" ]; then + printf "WARNING: '%s' is not a valid Kconfig\n" "$F" + fi + + T_FILE="$F_FILE.tmp" + grep "^#" $F_FILE > $T_FILE + echo " -----------------------" >> $T_FILE + echo " | arch |status|" >> $T_FILE + echo " -----------------------" >> $T_FILE + for ARCH_DIR in arch/*/; do + ARCH=$(echo $ARCH_DIR | sed -e 's/arch//g' | sed -e 's/\///g') + K_FILES=$(find $ARCH_DIR -name "Kconfig*") + K_GREP=$(grep "$K" $K_FILES) + # + # Arch support status values for (O, K) are updated according + # to the following rules. + # + # - ("", K) is 'supported by a given arch', if there is a + # Kconfig file for that arch which contains K; + # + # - ("not", K) is 'supported by a given arch', if there is + # no Kconfig file for that arch which contains K; + # + # - otherwise: preserve the previous status value (if any), + # default to 'not yet supported'. + # + # Notice that, according these rules, invalid features may be + # updated/modified. + # + if [ "$O" = "" ] && [ ! -z "$K_GREP" ]; then + printf " |%12s: | ok |\n" "$ARCH" >> $T_FILE + elif [ "$O" = "not" ] && [ -z "$K_GREP" ]; then + printf " |%12s: | ok |\n" "$ARCH" >> $T_FILE + else + S=$(grep -v "^#" "$F_FILE" | grep " $ARCH:") + if [ ! -z "$S" ]; then + echo "$S" >> $T_FILE + else + printf " |%12s: | TODO |\n" "$ARCH" \ + >> $T_FILE + fi + fi + done + echo " -----------------------" >> $T_FILE + mv $T_FILE $F_FILE +done -- 2.7.4