Received: by 10.192.165.148 with SMTP id m20csp2926866imm; Mon, 7 May 2018 03:45:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZruwSgxw1Icjrek1K73bODpsRFpCeDQC0iPxeTb04IR45hL6db4LaxSpKKLqdGc/a7LBYCC X-Received: by 2002:a63:77c9:: with SMTP id s192-v6mr29488095pgc.51.1525689907782; Mon, 07 May 2018 03:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525689907; cv=none; d=google.com; s=arc-20160816; b=XTqrPsGPB04aHg2lc2c0v/1aTFWGt68wFfKtAO/oNN8mAkKzin4VmODLupM2UHKXoE YV0GFHb46l6m9vKJ0JaFy02EAF/ldICiLiFjN17k/9tafakLRhpieZidmfTQwAP//s2a gZC0Djh9vI29jxNnG74gcrQHlArhwfu4O7oWXa6cwRvUXUR8kvnmfAdmV7VsnrsGvuJY n1B6qz3jZS5SZoDveOLOMmoGxqwARaSjCCXeEeAOONeTzkE9BbxEfKCuQ5rd/Yrn01MH PnMSNV23iLqrxFiJZNyHHa9XFbX5SxQ+t/2X1xoNm1seD3thy6bMoc39YdEcHFiKAUI1 tiBQ== 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=fMK3bZ8DXYttf0uxQEWi+Q/Qkeszj88c6v7MKcLrIlU=; b=Ni+Qdi0TqKKnPHhEcuOSnVxcF1qZh7vDc4LAiCU/hT1VkqJFNkP8cx9UwXk1x0Wcln 499wiMPyDMoV803eXxx6FkZnOOd1OW1u2F6m5TRROAp58GkVsppIr7cnamWyVaEFdVZL ZHtcBiGsr4CZx3A1beELkq31Ew+xD5A/WKJcfXYfKsB3jGJmhqe4twbq53hJ9kYxeM9D KiBC5WhIMNAwq/6f57KoYZV/izzSLGHy+QE87mviDBOdaIWXWIVlLN1nkH5lTiv5E4AF bCGJEoDfQ1+DFFtAZMcLNZJ26qHKOqf9H/EATyFkSQCRIHrfhCGT7SUKt+35W5/kOjuW qDww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=B59gCYWQ; 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 p10-v6si21351521plk.295.2018.05.07.03.44.53; Mon, 07 May 2018 03:45:07 -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=B59gCYWQ; 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 S1752247AbeEGKoY (ORCPT + 99 others); Mon, 7 May 2018 06:44:24 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:32949 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881AbeEGKoT (ORCPT ); Mon, 7 May 2018 06:44:19 -0400 Received: by mail-wr0-f196.google.com with SMTP id o4-v6so28236289wrm.0 for ; Mon, 07 May 2018 03:44:18 -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=fMK3bZ8DXYttf0uxQEWi+Q/Qkeszj88c6v7MKcLrIlU=; b=B59gCYWQwDROP0XMGARsta8yTq8dgzsxKUM1NpLM6FEGGsXKcfcRWGR+vQYDIdYXS+ p3Ic7DxJhRx7bpWY3/FwzjlTPc4d9T/zA9BnvDi4fTDak+6GZRq61SGPWYQ7vKP+g+dO h8aPDecluSSyVlv0T7LXYH8sHUKyf3nw6dExU= 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=fMK3bZ8DXYttf0uxQEWi+Q/Qkeszj88c6v7MKcLrIlU=; b=fIPsA34fzvhLNz4BfgxcJSLsb2kyUBmYUGZEUJyfSl+VOLSBObk7Wyse8FEFEDCb9Q 2LKKbXV8qtR/L5l2HaKHi+bDtXXDbSvVWbZKcuCjDjGBAthHSSiBEDC5VY68lhuHLPBo wMdMdR5lVh9CetiEZzRkxHeJd9n+vlqJnU8OkgU1mkcA2XqUu8Cn65/LYtlrw6Qd5obN 1fzTfWm3waCezDl4SbB4n2q44dFN8dkMi1CWWyhDwvlCapNJ/IC2gD7mKGA9ZMWPYeJm zKD60k0PPIiTQbW3wtDwq1Ty8XPGEHYlsUhHE2Q/TwcsT5EOs40W+grfb4+MSaskgiK7 7oYg== X-Gm-Message-State: ALQs6tBiF0/6s32mSwLHGBDVEy6bp3CWhZi4cBaVI2AE0dN9ae9ruuCC wZFEIq6VXoRHfNgO6nD8DnGelg== X-Received: by 2002:adf:db0b:: with SMTP id s11-v6mr27976004wri.241.1525689857312; Mon, 07 May 2018 03:44:17 -0700 (PDT) Received: from andrea.amarulasolutions.com (85.100.broadband17.iol.cz. [109.80.100.85]) by smtp.gmail.com with ESMTPSA id k82-v6sm7427307wmf.17.2018.05.07.03.44.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 May 2018 03:44:16 -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 v3 1/6] Documentation/features: Add script that refreshes the arch support status files in place Date: Mon, 7 May 2018 12:43:38 +0200 Message-Id: <1525689823-3340-2-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525689823-3340-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1525689823-3340-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] http://lkml.kernel.org/r/20180328122211.GA25420@andrea 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