[PATCH 8/8] doc: kernel_{abi,feat}.py: warn about missing directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The underlying perl script get_feat.pl does not complain when you pass
nonexistent directories, and just produces empty/useless output:

    $ scripts/get_feat.pl rest --enable-fname --dir asdfasdf --arch arm64
    ====================================
    Feature status on arm64 architecture
    ====================================

    =========  =======  =======  ======  ===========
    Subsystem  Feature  Kconfig  Status  Description
    =========  =======  =======  ======  ===========
    =========  =======  =======  ======  ===========

Let's add an early sanity check and a warning if the check fails.

get_abi.pl doesn't have exactly the same issue as it actually produces
an error, but we can add the same check for consistency.

Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
---
 Documentation/sphinx/kernel_abi.py  | 7 ++++++-
 Documentation/sphinx/kernel_feat.py | 8 ++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py
index 9eb7282cc941..52af2750e634 100644
--- a/Documentation/sphinx/kernel_abi.py
+++ b/Documentation/sphinx/kernel_abi.py
@@ -79,11 +79,16 @@ class KernelCmd(Directive):
 
         srctree = os.path.abspath(os.environ["srctree"])
 
+        dir_path = os.path.join(srctree, 'Documentation', self.arguments[0])
+        if not os.path.exists(dir_path):
+            logger.warning("path does not exist: '%s'", dir_path,
+                           location=(self.state.document.current_source, self.lineno))
+
         args = [
             os.path.join(srctree, 'scripts/get_abi.pl'),
             'rest',
             '--enable-lineno',
-            '--dir', os.path.join(srctree, 'Documentation', self.arguments[0]),
+            '--dir', dir_path,
         ]
 
         if 'rst' in self.options:
diff --git a/Documentation/sphinx/kernel_feat.py b/Documentation/sphinx/kernel_feat.py
index f1c9e4a54964..e0bc6e03579c 100644
--- a/Documentation/sphinx/kernel_feat.py
+++ b/Documentation/sphinx/kernel_feat.py
@@ -79,12 +79,16 @@ class KernelFeat(Directive):
 
         srctree = os.path.abspath(os.environ["srctree"])
 
+        dir_path = os.path.join(srctree, 'Documentation', self.arguments[0])
+        if not os.path.exists(dir_path):
+            logger.warning("path does not exist: '%s'", dir_path,
+                           location=(self.state.document.current_source, self.lineno))
+
         args = [
             os.path.join(srctree, 'scripts/get_feat.pl'),
             'rest',
             '--enable-fname',
-            '--dir',
-            os.path.join(srctree, 'Documentation', self.arguments[0]),
+            '--dir', dir_path,
         ]
 
         if len(self.arguments) > 1:
-- 
2.34.1





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux