Re: [PATCH] [KERNEL-DOC] kill warnings when building mandocs

Borislav Petkov
2007-04-19T06:37:07Z

On Wed, Apr 18, 2007 at 10:16:54AM -0700, Randy Dunlap wrote:
> On Fri, 13 Apr 2007 11:29:43 +0200 Borislav Petkov wrote:
>
> > Sorry for the improper whitespaces, here's a correct version.
> >
> > Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
> >
> >
> > Index: 21-rc6/scripts/kernel-doc
> > ===================================================================
> > --- 21-rc6.orig/scripts/kernel-doc
> > +++ 21-rc6/scripts/kernel-doc
> > @@ -326,6 +326,32 @@ while ($ARGV[0] =~ m/^-(.*)/) {
> > }
> > }
> >
> > +# get kernel version
> > +sub get_kernel_version() {
> > + my $version;
> > + open (FILE, "../Makefile") || die "Can't open man kernel Makefile: $!";
>
> How are you running scripts/kernel-doc ?
> I had to change "../Makefile" to just "Makefile" when using
> 'make htmldocs;.
I knew this one would come around and bite me in the a**. My cmd is :
make V=1 O=build/ htmldocs > build.log 2>&1

so man is cd-ing into the O=build directory and then the main Makefile is one
level above it. Gonna fix this properly today and get back to you.
>
> > + EOF: while (my $line = <FILE>)
> > + {
> > + if ($line =~ /VERSION\s+=\s+(\d+)/) {
> > + $version .= $1;
> > + next;
> > + }
> > + if ($line =~ /PATCHLEVEL\s+=\s+(\d+)/) {
> > + $version .= ".$1";
> > + next;
> > + }
> > + if ($line =~ /SUBLEVEL\s+=\s+(\d+)/) {
> > + $version .= ".$1";
> > + next;
> > + }
> > + if ($line =~ /EXTRAVERSION\s+=\s+(.*)$/) {
> > + $version .= $1;
> > + last EOF;
> > + }
> > + }
> > + return $version;
> > +}
> >
> > # generate a sequence of code that will splice in highlighting information
> > # using the s// operator.
> > @@ -592,6 +618,7 @@ sub output_function_xml(%) {
> > print "<refmeta>\n";
> > print " <refentrytitle><phrase>".$args{'function'}."</phrase></refentrytitle>\n";
> > print " <manvolnum>9</manvolnum>\n";
> > + print " <refmiscinfo class=\"version\">" . get_kernel_version() . "</refmiscinfo>\n";
> > print "</refmeta>\n";
> > print "<refnamediv>\n";
> > print " <refname>".$args{'function'}."</refname>\n";
> > @@ -668,6 +695,7 @@ sub output_struct_xml(%) {
> > print "<refmeta>\n";
> > print " <refentrytitle><phrase>".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n";
> > print " <manvolnum>9</manvolnum>\n";
> > + print " <refmiscinfo class=\"version\">" . get_kernel_version() . "</refmiscinfo>\n";
> > print "</refmeta>\n";
> > print "<refnamediv>\n";
> > print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n";
> > @@ -752,6 +780,7 @@ sub output_enum_xml(%) {
> > print "<refmeta>\n";
> > print " <refentrytitle><phrase>enum ".$args{'enum'}."</phrase></refentrytitle>\n";
> > print " <manvolnum>9</manvolnum>\n";
> > + print " <refmiscinfo class=\"version\">" . get_kernel_version() . "</refmiscinfo>\n";
> > print "</refmeta>\n";
> > print "<refnamediv>\n";
> > print " <refname>enum ".$args{'enum'}."</refname>\n";
> > -
>
> ---
> ~Randy
> *** Remember to use Documentation/SubmitChecklist when testing your code ***

--
Regards/Gruß,
Boris.