List:Internals« Previous MessageNext Message »
From:paul Date:July 16 2005 10:58pm
Subject:bk commit - mysqldoc@docsrva tree (paul:1.3040)
View as plain text  
Below is the list of changes that have just been committed into a local
mysqldoc repository of paul. When paul does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.3040 05/07/16 17:58:16 paul@stripped +5 -0
  Manpage modifications.

  refman/Makefile
    1.9 05/07/16 17:58:14 paul@stripped +14 -2
    Modify manpage target.

  refman-5.0/Makefile
    1.5 05/07/16 17:58:14 paul@stripped +14 -2
    Sync.

  refman-4.1/Makefile
    1.5 05/07/16 17:58:14 paul@stripped +14 -2
    Sync.

  make.d/vars-docbook
    1.5 05/07/16 17:58:14 paul@stripped +5 -0
    Add var for new script.

  tools/fix-manpages.pl
    1.1 05/07/16 17:37:35 paul@stripped +119 -0

  tools/fix-manpages.pl
    1.0 05/07/16 17:37:35 paul@stripped +0 -0
    BitKeeper file /Volumes/frost2/MySQL/bk/mysqldoc/tools/fix-manpages.pl

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	paul
# Host:	frost.snake.net
# Root:	/Volumes/frost2/MySQL/bk/mysqldoc

--- 1.8/refman/Makefile	2005-07-16 13:17:15 -05:00
+++ 1.9/refman/Makefile	2005-07-16 17:58:14 -05:00
@@ -204,11 +204,23 @@
 	$(RM) manual.txt
 
 # Manual page generation
+# "manual.man" target processes manual.xml and generates a bunch of
+# xxx.man files in the current directory. These get copied to the
+# manpages.d directory and post-processed by fix-manpages.pl.
 
-manpages: manual.man
+.PRECIOUS: manpages.d
+
+manpages: manpages.d
+	touch $@
+
+manpages.d: manual.man
+	-$(RM) -r $@
+	mkdir $@
+	$(FIX_MANPAGES) --destdir=manpages.d *.man
 
 clean::
-	$(RM) *.man
+	$(RM) *.man man
+	$(RM) -r *.man manpages manpages.d
 
 # Import standard variables and target rules
 
--- New file ---
+++ tools/fix-manpages.pl	05/07/16 17:37:35
#! /usr/bin/perl -w
# vim:set ts=2 sw=2 expandtab:

# fix-manpages.pl - post-process manpages generated from Reference Manual.

# Should be invoked in the directory that contains all the *.man files
# to be processed.  --destdir names the directory where to write the
# post-processed files.

# Performs the following actions for each file:
# - Adds "no warranty" notice

# Paul DuBois
# paul@stripped
# 2005-07-16

use strict;

use Getopt::Long;
$Getopt::Long::ignorecase = 0; # options are case sensitive
$Getopt::Long::bundling = 1;   # allow short options to be bundled

my $prog_name = "fix-manpages.pl";

my $usage = <<EOF;
Usage: $prog_name [options] manpage-file ...

Options:
--help, -h
    Print this message
--destdir dir
    Destination directory for postprocessed manpages. (required)
EOF

# Variables for command line options; most are undefined initially.
my $help;
my $dest_dir;

GetOptions (
  # =i means an integer argument is required after the option
  # =s means a string argument is required after the option
  # :s means a string argument is optional after the option
  "help|h"           => \$help,          # print help message
  "destdir=s"        => \$dest_dir,      # destination directory
) or do { print "$usage\n"; exit (1); };

if (defined ($help))
{
  print "$usage\n";
  exit (0);
}

if (!defined ($dest_dir))
{
  print "--destdir option is required\n";
  print "$usage\n";
  exit (0);
}

if (! -d $dest_dir)
{
  die "--destdir value ($dest_dir) is not a directory\n";
}

foreach my $file (@ARGV)
{
  warn "processing $file...\n";
  my ($basename) = $file =~ m|([^/]+)$|;
  my $in_man;
  warn $basename, "\n";
  {
    open IN, $file
    or die "Cannot open $file for reading: $!\n";
    local $/ = undef;
    $in_man = <IN>;            # slurp input document as single string
    close (IN);
  }

  # delete spaces from lines that have only spaces
  $in_man =~ s/^\s+\n/\n/mg;

  # convert multiple blank lines to single blank line
  $in_man =~ s/\n+/\n/g;

  # write out post-processed file
  open OUT, ">$dest_dir/$basename"
    or die "Cannot open $dest_dir/$basename for writing: $!\n";
  print OUT $in_man;

  # add extra sections

  # generate a "see also" for all manpages except the current one
  # and add pointer to manual
  print OUT ".SH \"SEE ALSO\"\n";
  my @basenames = ();
  foreach my $file2 (@ARGV)
  {
    my ($basename2) = $file2 =~ m|([^/]+)$|;
    if ($basename ne $basename2)
    {
      $basename2 =~ s/\..*$/\(1\)/; # change extension to (1)
    }
    push @basenames, $basename2 unless $basename eq $basename2;
  }
  print OUT join (",\n", sort @basenames), "\n.P\n" if @basenames;
  print OUT <<EOF;
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql/com/doc/.
EOF

  print OUT ".SH AUTHOR\n";
  print OUT "MySQL AB (http://www.mysql.com/).\n";
  print OUT "This software comes with no warranty.\n";

  close (OUT);
}

exit (0);


--- 1.4/make.d/vars-docbook	2005-06-15 18:52:38 -05:00
+++ 1.5/make.d/vars-docbook	2005-07-16 17:58:14 -05:00
@@ -33,3 +33,8 @@
 # that point to htto://bugs.mysql.com bug reports.
 
 BUG_PREP = $(TOOLS_DIR)/bug-prep.pl
+
+# FIX_MANPAGES post-processes the manpages generated from the Reference
+# manual.
+
+FIX_MANPAGES = $(TOOLS_DIR)/fix-manpages.pl

--- 1.4/refman-4.1/Makefile	2005-07-16 13:17:14 -05:00
+++ 1.5/refman-4.1/Makefile	2005-07-16 17:58:14 -05:00
@@ -206,11 +206,23 @@
 	$(RM) manual.txt
 
 # Manual page generation
+# "manual.man" target processes manual.xml and generates a bunch of
+# xxx.man files in the current directory. These get copied to the
+# manpages.d directory and post-processed by fix-manpages.pl.
 
-manpages: manual.man
+.PRECIOUS: manpages.d
+
+manpages: manpages.d
+	touch $@
+
+manpages.d: manual.man
+	-$(RM) -r $@
+	mkdir $@
+	$(FIX_MANPAGES) --destdir=manpages.d *.man
 
 clean::
-	$(RM) *.man
+	$(RM) *.man man
+	$(RM) -r *.man manpages manpages.d
 
 # Import standard variables and target rules
 

--- 1.4/refman-5.0/Makefile	2005-07-16 13:17:15 -05:00
+++ 1.5/refman-5.0/Makefile	2005-07-16 17:58:14 -05:00
@@ -203,11 +203,23 @@
 	$(RM) manual.txt
 
 # Manual page generation
+# "manual.man" target processes manual.xml and generates a bunch of
+# xxx.man files in the current directory. These get copied to the
+# manpages.d directory and post-processed by fix-manpages.pl.
 
-manpages: manual.man
+.PRECIOUS: manpages.d
+
+manpages: manpages.d
+	touch $@
+
+manpages.d: manual.man
+	-$(RM) -r $@
+	mkdir $@
+	$(FIX_MANPAGES) --destdir=manpages.d *.man
 
 clean::
-	$(RM) *.man
+	$(RM) *.man man
+	$(RM) -r *.man manpages manpages.d
 
 # Import standard variables and target rules
 
Thread
bk commit - mysqldoc@docsrva tree (paul:1.3040)paul17 Jul