Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5350426ybi; Tue, 4 Jun 2019 05:28:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYzyRG6kh2qxspDA7YKxR/iGFPEL3Gx2KUFm2L9ACciaaSW2JXLaBOCWnifq8LiPm3j2Z/ X-Received: by 2002:a62:b40a:: with SMTP id h10mr38387173pfn.216.1559651285675; Tue, 04 Jun 2019 05:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559651285; cv=none; d=google.com; s=arc-20160816; b=nvoPcyYAJOhzkaV1Apv1TsgIKTCYD9EomodZ7gPSWLBmRzs5yJURr4ZJHyGEuMR0Md lXO50sDCzSCsc895vz2S50evgrUmE5eoiHmah11ayTjv/ZPEAfT7yiqRYBwXnYAScEDv Z0+ARoHPOOnub0Ft27en4Zz5Ue7J5HpS6Mi+P0boWDDcZn+Yjc3i1Tw+Brc9SzvKKoO6 zwLtkfaCOnE+6wGJ8HE7nNJLhh/nd65LqxYuXF16tDZGutuSEbwUzfxs43W8qH75UfXO Zv6crWmsbwnNWeN5HH1i/Zn8Yg3KfAbSJHRCJTNWMKTUnyDYoqEQYfVOPHjDCRak9e+j YXGg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=S4Pz7TRu5Lcq2yQdR4kxNmctJu60r/vgdLSlDc7rPg0=; b=E/vCB5zbeo5rTO1a2FTMttsETDCfPxSCW2+59gYvGln0rdhiXloGrP4OFJ6D+Upoh9 YER1MDX8vN7L9pxzVQYJykfhko/fqzpb6XD9YtkB5HMqR47hgkamL3dt0eo2Q9/k9Yck ypF8/ok51TjflPOi4cuYOTADnbzYo7hLiPSvJTviIFG1kMiEVUtaZmro9RhLYITK/ZgC l/ZYsJQfQ0PewgZlkwuOPYSS5Jw7mdr8IZ/KYOJcINPSwQNMo8SoXpx5QEpO6l2e2Eer dNmCcGwbPgVSL573QjS9ENcuLHf+pW/6rKS68egvPzNYqao7X+BZWcBLVd/IZ/RKe3SE 9FyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="eiJuW/Ba"; 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 g129si23209043pfb.181.2019.06.04.05.27.48; Tue, 04 Jun 2019 05:28:05 -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="eiJuW/Ba"; 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 S1727716AbfFDM0d (ORCPT + 99 others); Tue, 4 Jun 2019 08:26:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60454 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726994AbfFDM0d (ORCPT ); Tue, 4 Jun 2019 08:26:33 -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: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:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=S4Pz7TRu5Lcq2yQdR4kxNmctJu60r/vgdLSlDc7rPg0=; b=eiJuW/BajBOBAudFTNG/cNt5a LupcpeNZRNJyKXf4PQEQBYvCelsX0tWh7MJQKqm8D4c3+W6Bd91f0bvq2YrQcp9rpMnPfL/d7wKjg 01E2RaVCrVT1tDzZDM2lS8tqt805U0W6FEZE8lDOFoXI7hPv6hpqz7VDNRWjXvVGYwwsgm1PzuLhU NVxGuSisF6dMxjRDKI8dwiVM8WBwwEg8lbskmgEbmOQrDF9w4DOHvy+PXoJL7CpJFHsA83C+3RRo5 2irH7anFq7WNHUOI99LRjjOe/yZK5KW55SIofR+zqhTbefHWW+sO/aBox0n17zSdNY+p23AATvYGi cF5OhO08w==; Received: from [187.113.6.249] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hY8WO-000464-B3; Tue, 04 Jun 2019 12:26:32 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hY8WK-000213-FZ; Tue, 04 Jun 2019 09:26:28 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Masahiro Yamada , Randy Dunlap Subject: [PATCH] docs: Kbuild/Makefile: allow check for missing docs at build time Date: Tue, 4 Jun 2019 09:26:27 -0300 Message-Id: <8ac254a7cf0569f1eeced9c9263cd7b0bfe4ed78.1559651025.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 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 documents are touched, let's add a check target at the make file. Signed-off-by: Mauro Carvalho Chehab --- Jon, It is very common for people to shift things around and forget to rename the documentation files. Just on this new Kernel cycle, every time I update from linux-next I get more broken stuff. IMO, the best is to run the check script with COMPILE_TEST, as this will make build robots to warn people about such breakages, with will hopefully help to avoid regressions due to broken documentation references. 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