I cannot find a maintainer for Documentation/DocBook and the related
code in the scripts directory, is there a maintainer?

So far my kbuild 2.5 conversion has managed to be completely separate
from existing files, however DocBook needs a few tweaks to existing
files in order to handle separate source and object trees.  These
changes should work with both kbuild 2.4 and 2.5, any complaints before
I send them to Linus?

The major change is making various DocBook programs and scripts detect
errors and return non-zero codes.  This needs to be done for 2.4
anyway.  Against kernel 2.4.4.

Index: 4.36/scripts/kernel-doc
--- 4.36/scripts/kernel-doc Thu, 26 Apr 2001 12:48:22 +1000 kaos 
(linux-2.4/2_kernel-doc 1.1.1.2 644)
+++ 4.36(w)/scripts/kernel-doc Sat, 26 May 2001 23:51:06 +1000 kaos 
+(linux-2.4/2_kernel-doc 1.1.1.2 644)
@@ -22,6 +22,10 @@ use strict;
 #      - add perldoc documentation
 #      - Look more closely at some of the scarier bits :)
 
+# 26/05/2001 -         Support for separate source and object trees.
+#              Return error code.
+#              Keith Owens <[EMAIL PROTECTED]>
+
 #
 # This will read a 'c' file and scan for embedded comments in the
 # style of gnome comments (+minor extensions - see below).
@@ -97,6 +101,8 @@ use strict;
 # '@parameter' - name of a parameter
 # '%CONST' - name of a constant.
 
+my $errors = 0;
+
 # match expressions used to find embedded type information
 my $type_constant = '\%([-_\w]+)';
 my $type_func = '(\w+)\(\)';
@@ -198,6 +204,7 @@ my %parameters = ();
 my @parameterlist = ();
 my %sections = ();
 my @sectionlist = ();
+my %source_map = ();
 
 my $contents = "";
 my $section_default = "Description";   # default section
@@ -776,6 +783,7 @@ sub dump_function($$) {
             if (defined $type && $type && !defined $parameters{$param}) {
                $parameters{$param} = "-- undescribed --";
                print STDERR "Warning($file:$.): Function parameter '$param' not 
described in '$function_name'\n";
+               ++$errors;
            }
 
            push @parameterlist, $param;
@@ -784,6 +792,7 @@ sub dump_function($$) {
        }
     } else {
        print STDERR "Error($.): cannot understand prototype: '$prototype'\n";
+       ++$errors;
        return;
     }
 
@@ -837,6 +846,19 @@ $section = $section_default;
 
 sub process_file($);
 
+# Read the file that maps relative names to absolute names for
+# separate source and object directories and for shadow trees.
+if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
+       my ($relname, $absname);
+       while(<SOURCE_MAP>) {
+               chop();
+               ($relname, $absname) = (split())[0..1];
+               $relname =~ s:^/+::;
+               $source_map{$relname} = $absname;
+       }
+       close(SOURCE_MAP);
+}
+
 if ($filelist) {
        open(FLIST,"<$filelist") or die "Can't open file list $filelist";
        while(<FLIST>) {
@@ -850,11 +872,17 @@ foreach (@ARGV) {
     process_file($_);
 }
 
+exit($errors);
+
 sub process_file($) {
     my ($file) = @_;
+    if (defined($source_map{$file})) {
+       $file = $source_map{$file};
+    }
 
     if (!open(IN,"<$file")) {
        print STDERR "Error: Cannot open file $file\n";
+       ++$errors;
        return;
     }
 
@@ -887,6 +915,7 @@ sub process_file($) {
            } else {
                print STDERR "WARN($.): Cannot understand $_ on line $.",
                " - I thought it was a doc line\n";
+               ++$errors;
                $state = 0;
            }
        } elsif ($state == 2) { # look for head: lines, and include content
@@ -937,6 +966,7 @@ sub process_file($) {
            } else {
                # i dont know - bad line?  ignore.
                print STDERR "WARNING($.): bad line: $_"; 
+               ++$errors;
            }
        } elsif ($state == 3) { # scanning for function { (end of prototype)
            if (m#\s*/\*\s+MACDOC\s*#io) {
Index: 4.36/scripts/docproc.c
--- 4.36/scripts/docproc.c Fri, 05 Jan 2001 13:42:29 +1100 kaos (linux-2.4/4_docproc.c 
1.1 644)
+++ 4.36(w)/scripts/docproc.c Sat, 26 May 2001 23:22:36 +1000 kaos 
+(linux-2.4/4_docproc.c 1.1 644)
@@ -18,6 +18,7 @@ int main(int argc, char *argv[])
        char type[64];
        int i;
        int vp=2;
+       int ret=0;
        pid_t pid;
 
 
@@ -96,8 +97,8 @@ int main(int argc, char *argv[])
                        perror("exec scripts/kernel-doc");
                        exit(1);
                default:
-                       waitpid(pid, NULL,0);
+                       waitpid(pid, &ret ,0);
                }
        }
-       exit(0);
+       exit(ret);
 }
Index: 4.36/scripts/docgen
--- 4.36/scripts/docgen Fri, 05 Jan 2001 13:42:29 +1100 kaos (linux-2.4/7_docgen 1.1 
644)
+++ 4.36(w)/scripts/docgen Sat, 26 May 2001 23:23:49 +1000 kaos (linux-2.4/7_docgen 
+1.1 644)
@@ -1,3 +1,10 @@
 #!/bin/sh
-X=`$TOPDIR/scripts/gen-all-syms "$*"`
-$TOPDIR/scripts/docproc $X
+set -e
+if [ -z "$scripts_objtree" ]
+then
+       X=`$TOPDIR/scripts/gen-all-syms "$*"`
+       $TOPDIR/scripts/docproc $X
+else
+       X=`${scripts_objtree}gen-all-syms "$*"`
+       TOPDIR=. ${scripts_objtree}docproc $X
+fi


_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to