Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5484596ybi; Tue, 4 Jun 2019 07:21:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9CQxmD0kmDY6ja7M+yh7MyKETLJ4ERTck8bo45Vf9hTloYYDEeKnQ3oPdYgi6ETbp3J68 X-Received: by 2002:a17:902:7591:: with SMTP id j17mr37180548pll.200.1559658108309; Tue, 04 Jun 2019 07:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559658108; cv=none; d=google.com; s=arc-20160816; b=dMY82I8osFIs657NMRqqqvGYsil1295Qc2xweYnNIlDgCAcQkoJbBpvOMRkKN4uptl o+x5+2EXUs851rE25mDAl9yXoYNxbSSsVUUMRgwlIPMdUeXPblQR8w4bOe3iAgW2k5Ng IaYP6aK7g6naV1I+ASJTur7kfkY8KR1yzLV2MX1QOaVQ4yiSy8efYBklDGd31fG8pz60 1UKwNxmRqitY8VDKq7P4Y32S7r3M05oFXDoza45k1wnn1mp/KQWO5b5F9iNQlibsqtZO s9SR+Vhro6d/2BbydNcBTAp8pA1re/tURm67JqZkWIlQAtogO7nqiZBiVEFYvqvyfluV LeGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iin/rdSO0fH26p9LlU038nNL9Jh7a8Qf/HGkBqoFdvo=; b=us2sISmHArOsrUEx7WD3jXKd2njuT3avpZRfl27EdXGjjNwOkh0SRuI0FJ+MlKiDVk JaVgVq3l/o4fjWRwrcF4yDf6xtnZM5NAd1LRqpGqV6qFmj+moTLaPerhXbB3HxI3gUJE mkSwxYU7DiCuW5SLMzMoyfArcvpib0flbx3B1auHITfYeHJ96tfEOrVtCxcJe4BrXF2G 94HLHOT/DlDFcBQUILuJdxACMzMRpht/N/CYJSSw05TdTMnUcKTqa88cfsm0T7O0b99b 19+PlOB6W3ZNXsWkHuEPNEvDwM3iTyFpKxOxYMiLe0yYvrVsKblDN6NZa83pd2SNkJ8m Rb6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XgN7w3B4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si13007997pjp.24.2019.06.04.07.21.30; Tue, 04 Jun 2019 07:21:48 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XgN7w3B4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728100AbfFDOTn (ORCPT + 99 others); Tue, 4 Jun 2019 10:19:43 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52490 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727408AbfFDOSC (ORCPT ); Tue, 4 Jun 2019 10:18:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iin/rdSO0fH26p9LlU038nNL9Jh7a8Qf/HGkBqoFdvo=; b=XgN7w3B42kFk+jBxuEN+zaNJMv LwUzSxEeX3iaiIhuMKPlDVHB7aHJrFFOAD3EkLQTAnprmAnSFMMvDH6PjOIeSB2VqiHabPCCgUXBa jcaCFh23Znibn7aP8/l7vnOxSH+CkQ/jbZW0RXrHNMzkCupSyqiTzlnBRnMDg1HMoDBtJrpxvJCz5 3m5qfZP6+O1kSuYwYVQgAAPclyTjvTVxKercof2Ss9qqgTkQr/O+OU2pzUms+5regIjePb2EuIFbq y6zIf7N2clssAUPFtxFC7p3Fh8WkGwJ8vrjwdMzE1dw5iV5lx3lv1Y2f9Dgvu54wcfRmrxz20mvMf dqYmiMyA==; Received: from [179.182.172.34] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYAGH-0001Rx-U6; Tue, 04 Jun 2019 14:18:01 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hYAGF-0002mK-2i; Tue, 04 Jun 2019 11:17:59 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , Masahiro Yamada , Randy Dunlap Subject: [PATCH v2 22/22] docs: Kbuild/Makefile: allow check for missing docs at build time Date: Tue, 4 Jun 2019 11:17:56 -0300 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While this doesn't make sense for production Kernels, in order to avoid regressions when new documents are added, let's add a check target at the make file. For now, the only check it does is to verify if there isn't any documents with a broken link. Signed-off-by: Mauro Carvalho Chehab --- Documentation/Kconfig | 13 +++++++++++++ Documentation/Makefile | 5 +++++ Kconfig | 2 ++ scripts/documentation-file-ref-check | 9 +++++++++ 4 files changed, 29 insertions(+) create mode 100644 Documentation/Kconfig diff --git a/Documentation/Kconfig b/Documentation/Kconfig new file mode 100644 index 000000000000..66046fa1c341 --- /dev/null +++ b/Documentation/Kconfig @@ -0,0 +1,13 @@ +config WARN_MISSING_DOCUMENTS + + bool "Warn if there's a missing documentation file" + depends on COMPILE_TEST + help + It is not uncommon that a document gets renamed. + This option makes the Kernel to check for missing dependencies, + warning when something is missing. Works only if the Kernel + is built from a git tree. + + If unsure, select 'N'. + + diff --git a/Documentation/Makefile b/Documentation/Makefile index 2edd03b1dad6..89857285a024 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -4,6 +4,11 @@ subdir-y := devicetree/bindings/ +# Check for broken documentation file references +ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y) +$(shell $(srctree)/scripts/documentation-file-ref-check --warn) +endif + # You can set these variables from the command line. SPHINXBUILD = sphinx-build SPHINXOPTS = diff --git a/Kconfig b/Kconfig index 48a80beab685..990b0c390dfc 100644 --- a/Kconfig +++ b/Kconfig @@ -30,3 +30,5 @@ source "crypto/Kconfig" source "lib/Kconfig" source "lib/Kconfig.debug" + +source "Documentation/Kconfig" diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index ff16db269079..440227bb55a9 100755 --- a/scripts/documentation-file-ref-check +++ b/scripts/documentation-file-ref-check @@ -22,9 +22,16 @@ $scriptname =~ s,.*/([^/]+/),$1,; # Parse arguments my $help = 0; my $fix = 0; +my $warn = 0; + +if (! -d ".git") { + printf "Warning: can't check if file exists, as this is not a git tree"; + exit 0; +} GetOptions( 'fix' => \$fix, + 'warn' => \$warn, 'h|help|usage' => \$help, ); @@ -139,6 +146,8 @@ while () { if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) { $broken_ref{$ref}++; } + } elsif ($warn) { + print STDERR "Warning: $f references a file that doesn't exist: $fulref\n"; } else { print STDERR "$f: $fulref\n"; } -- 2.21.0