From 845b83ebd27891a13196b74ed8cafa27d666c377 Mon Sep 17 00:00:00 2001 From: Norman Walsh Date: Mon, 2 Apr 2001 12:48:16 +0000 Subject: [PATCH] Initial revision --- cvstools/README.CVS | 51 ++++++++++++ cvstools/cvs2log | 148 +++++++++++++++++++++++++++++++++ cvstools/mergechangelogs | 139 +++++++++++++++++++++++++++++++ cvstools/nextversion | 39 +++++++++ cvstools/saxon | 174 +++++++++++++++++++++++++++++++++++++++ cvstools/xjparse | 25 ++++++ 6 files changed, 576 insertions(+) create mode 100644 cvstools/README.CVS create mode 100755 cvstools/cvs2log create mode 100755 cvstools/mergechangelogs create mode 100755 cvstools/nextversion create mode 100755 cvstools/saxon create mode 100755 cvstools/xjparse diff --git a/cvstools/README.CVS b/cvstools/README.CVS new file mode 100644 index 000000000..6a64b3d97 --- /dev/null +++ b/cvstools/README.CVS @@ -0,0 +1,51 @@ +README.CVS for the cvstools at cvs.docbook.sourceforge.net + +These tools won't work on your system. They'll be made more portable +at some future date. For now, you should just hack them to make them +work on your system. + +Copyright +--------- + +Copyright (C) 2001 Norman Walsh + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the ``Software''), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +Except as contained in this notice, the names of individuals +credited with contribution to this software shall not be used in +advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization +from the individuals in question. + +Any stylesheet derived from this Software that is publically +distributed will be identified with a different name and the +version strings in any derived Software will be changed so that +no possibility of confusion between the derived package and this +Software will exist. + +Warranty +-------- + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER +CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Contacting the Author +--------------------- + +Maintained by Norman Walsh, . diff --git a/cvstools/cvs2log b/cvstools/cvs2log new file mode 100755 index 000000000..718a85448 --- /dev/null +++ b/cvstools/cvs2log @@ -0,0 +1,148 @@ +#!/usr/bin/perl -- # --*-Perl-*-- + +use Getopt::Std; + +$usage = "Usage: $0 [-l logfile] [-w] [-c date]\n"; + +die $usage if ! getopts('c:l:w'); + +# Open the log file... +if ($opt_l) { + open (LOG, "$opt_l"); +} else { + open (LOG, "cvs -q log |"); +} + +$log = {}; +$logdesc = {}; +$file = ""; +$date = ""; +$rev = ""; + +while () { + if (/^Working file: (.*)$/) { + $file = $1; + if ($file =~ /^(.*)\/([^\/]+)$/) { + $dir = $1; + $file = $2; + } + } + + if (/^description:/) { + $desc = ""; + $_ = scalar(); + while (!/^----/) { + $desc .= $_; + $_ = scalar(); + } + + $logdesc->{$dir} = {} if ! exists $logdesc->{$dir}; + $logdesc->{$dir}->{$file} = $desc; + } + + if (/^----/) { + while (/^----/) { + &read_revision(*LOG); + } + + $log->{$dir}->{$date}->{$file}->{$rev}->{'new'} = 1; + } +} + +close (LOG); + +foreach $dir (sort keys %{$log}) { + $cl = "ChangeLog"; + $cl = "$dir/$cl" if $dir; + + $cutoff = $opt_c || "0000-00-00"; + if ($opt_w) { +# print "Writing $cl\n"; + open (F, ">$cl"); + } else { + print "Would have written $cl\n"; + open (F, ">/dev/null"); + } + + foreach $date (sort { $b cmp $a } keys %{$log->{$dir}}) { + if ($date lt $cutoff) { + print "\tStopping at cutoff date: $cutoff\n"; + last; + } + + print F "$date Norman Walsh \n\n"; + $msgs = {}; + + foreach $file (sort keys %{$log->{$dir}->{$date}}) { + foreach $rev (sort keys %{$log->{$dir}->{$date}->{$file}}) { + $logmsg = $log->{$dir}->{$date}->{$file}->{$rev}->{'logmsg'}; + if (exists $msgs->{$logmsg}) { + $msgsnew->{$logmsg} = $msgsnew->{$logmsg} + && $log->{$dir}->{$date}->{$file}->{$rev}->{'new'}; + $msgs->{$logmsg} .= ", $file"; + } else { + $msgsnew->{$logmsg} + = $log->{$dir}->{$date}->{$file}->{$rev}->{'new'}; + $msgs->{$logmsg} = "$file"; + } + } + } + + foreach $msg (sort fnsort keys %{$msgs}) { + $files = $msgs->{$msg}; + print F "\t* $files: "; + print F "\n\t" if (length($files) > 50); + + if ($msgsnew->{$msg}) { + print F "New file.\n\n"; + } else { + print F "$msg\n"; + } + } + } + close (F); +} + +sub fnsort { + return $msgs->{$a} cmp $msgs->{$b}; +} + +sub read_revision { + local(*LOG) = shift; + + $_ = scalar(); + chop; + die if !/^revision (\d.*)$/; + $rev = $1; + + $_ = scalar(); + chop; + die if !/^date: (.*?);\s+author: (\S+?);/; + $date = $1; + $author = $2; + + $date = $1 if $date =~ /^(\S+)\s/; + $date =~ s/[\\\/]/-/g; + + $logmsg = ""; + $_ = scalar(); + while(!/----/ && !/====/) { + $logmsg .= "\t" if ($logmsg ne ""); + $logmsg .= $_; + $_ = scalar(); + } +# $log->{$dir}->{$date}->{$file}->{$revision}->{author} +# ->{logmsg} + + $log->{$dir} = {} + if ! exists $log->{$dir}; + $log->{$dir}->{$date} = {} + if ! exists $log->{$dir}->{$date}; + $log->{$dir}->{$date}->{$file} = {} + if ! exists $log->{$dir}->{$date}->{$file}; + $log->{$dir}->{$date}->{$file}->{$rev} = {} + if ! exists $log->{$dir}->{$date}->{$file}->{$rev}; + + $log->{$dir}->{$date}->{$file}->{$rev}->{'author'} = $author; + $log->{$dir}->{$date}->{$file}->{$rev}->{'logmsg'} = $logmsg; +} diff --git a/cvstools/mergechangelogs b/cvstools/mergechangelogs new file mode 100755 index 000000000..0b830e9e1 --- /dev/null +++ b/cvstools/mergechangelogs @@ -0,0 +1,139 @@ +#!/usr/bin/perl -- # --*-Perl-*-- + +use Getopt::Std; + +$usage = "Usage: $0 [-v version]\n"; + +die $usage if ! getopts('v:'); +$version = $opt_v || &last_version(); + +# .../docbook must be the current directory + +die "Cannot find ChangeLog.\n" if ! -f "ChangeLog"; + +@dirs = (); +@ldirs = ('.'); +while (@ldirs) { + $dir = shift @ldirs; + push (@dirs, $dir); + + opendir (DIR, $dir); + while ($name = readdir(DIR)) { + $file = "$dir/$name"; + next if $name =~ /^\.\.?$/; + next if ! -d $file; + next if $name eq 'CVS'; + next if $name eq 'RCS'; + push (@ldirs, $file); + } + closedir (DIR); +} + +$found = 0; +open (F, "ChangeLog"); +while () { + chop; + $date = $1 if /^(\d+-\d+-\d+)/; + $found = 1 if /^\s+\* \S+: Version $version/; + last if $found; +} + +if (!$found) { + warn "Cannot find version $version in ChangeLog\n"; + $date = "0000-00-00"; +} + +print "Changes since version $version ($date)\n\n"; + +$date =~ /(\d+)-(\d+)-(\d+)/; +$date = sprintf("%04d%02d%02d", $1, $2, $3); + +foreach $dir (@dirs) { + $found = 0; + @LINES = (); + open(F, "$dir/ChangeLog"); + while () { + chop; + if (/^(\d+)-(\d+)-(\d+)/) { + $cdate = sprintf("%04d%02d%02d", $1, $2, $3); + $found = ($cdate <= $date); + } + + last if $found; + + push (@LINES, $_); + } + close (F); + + next if !@LINES; + + $dir =~ s/^\./docbook/; + print "Changes to $dir/*\n\n"; + + @entry = (); + foreach $_ (@LINES) { + if (/^\t/) { + push (@entry, $_); + } else { + &format(@entry) if @entry; + @entry = (); + print " | $_\n"; + } + } + &format(@entry) if @entry; + print "\n"; +} + +sub format { + my @lines = @_; + local $_ = join(" ", @lines); + + # get rid of leading * + s/^\t\* //; + + # get rid of tabs + s/\t/ /sg; + + # get rid of multiple spaces + s/\s+/ /sg; + + my $star = "*"; + while (length($_) > 60) { + if (/^(.{1,60})\s/) { + print " | \t$star $1\n"; + $star = " "; + $_ = $'; + } else { + print " | \t$star $_\n"; + $_ = ""; + } + } + + print " | \t$star $_\n" if $_ ne ""; +} + +sub last_version { + local $_; + my $version = undef; + + open (F, 'VERSION') || die "Cannot find VERSION.\n"; + read (F, $_, -s 'VERSION'); + close (F); + + if (/name=.VERSION.>(.*?)&1 | grep -v ^cvs`; +if (@cvsbad) { + print STDERR @cvsbad; + die "CVS is not up-to-date!\n"; +} + +open (F, 'VERSION') || die "Cannot find VERSION.\n"; +read (F, $_, -s 'VERSION'); +close (F); + +die "Cannot find version in VERSION.\n" + if !/^(.*name=.VERSION.>)(\d+)\.(\d+)(<.*)$/s; + +my $pre = $1; +my $major = $2; +my $minor = $3; +my $post = $4; + +$minor++; + +print "About to release $major.$minor; are you sure? "; +chop($_ = scalar(<>)); + +die "Aborted!\n" if !/^y/i; + +open (F, ">VERSION"); +print F "$pre$major.$minor$post"; +close (F); + +system ("cvs commit -m \"Version $major.$minor released.\" VERSION"); +system ("cvs tag V$major$minor"); + + diff --git a/cvstools/saxon b/cvstools/saxon new file mode 100755 index 000000000..4016900ba --- /dev/null +++ b/cvstools/saxon @@ -0,0 +1,174 @@ +#!/bin/bash + +# This shell script will definitely need to be hacked to run on your system! +# +# Usage: saxon [shellopts] src.xml style.xsl output.{xml|html} [styleopts] +# + +VARIABLES="" +EXTENSIONS=1 +DONE="0" +VERSION="622" +DEBUG=0 +JAR=0 +#XARG="" +#YARG="" +#RARG="" +XARG="-x com.sun.resolver.tools.ResolvingXMLReader" +YARG="-y com.sun.resolver.tools.ResolvingXMLReader" +RARG="-r com.sun.resolver.tools.CatalogURIResolver" +MEMORY="" + +while [ "$DONE" = "0" ]; do + case $1 in + -d) DEBUG=1; + shift; + ;; + -E) EXTENSIONS=0; + shift; + ;; + -e) EXTENSIONS=1; + shift; + ;; + -j) JAR=1; + echo "Using jar file for extension classes" + shift; + ;; + -5) VERSION=5; + RARG="" + shift; + ;; + -622) VERSION=622; + shift; + ;; + -621) VERSION=621; + shift; + ;; + -62) VERSION=62; + shift; + ;; + -61) VERSION=61; + shift; + ;; + -6) VERSION=6; + RARG="" + shift; + ;; + -x) shift; + XARG="-x $1"; + shift; + ;; + -y) shift; + YARG="-y $1"; + shift; + ;; + -r) shift; + RARG="-r $1"; + shift; + ;; + -m) shift + MEMORY="-Xmx$1"; + shift; + ;; + -*) DONE=1; + echo "Unexpected arguments!"; + echo " $*" + exit; + ;; + *) DONE=1 + esac +done + +VARIABLES="use.extensions=$EXTENSIONS" + +XMLSRC=$1; shift +XMLSTY=$1; shift +OUTPUT=$1; shift + +if [ "$OUTPUT" = "-" ]; then + OUTPUT=""; +fi + +if [ "$OUTPUT" != "" ]; then + OUTPUT="-o $OUTPUT" +fi + +case $VERSION in + 622) SAXON="/usr/local/java/saxon-6.2.2/saxon.jar" + SAXON_DEBUG="/usr/local/java/saxon-6.2.2/.classes" + NDWEXT="/share/xsl/docbook/extensions/saxon61/.classes"; + NDWEXT="/share/xsl/docbook/extensions/saxon61/.classes:/share/doctypes/website-pages/extensions/saxon61/.classes"; + if [ "$JAR" = "1" ]; then + NDWEXT="/share/xsl/docbook/extensions/saxon61.jar" + fi + ;; + 621) SAXON="/usr/local/java/saxon-6.2.1/saxon.jar" + SAXON_DEBUG="/usr/local/java/saxon-6.2.1/.classes" + NDWEXT="/share/xsl/docbook/extensions/saxon61/.classes"; + if [ "$JAR" = "1" ]; then + NDWEXT="/share/xsl/docbook/extensions/saxon61.jar" + fi + ;; + 62) SAXON="/usr/local/java/saxon-6.2/saxon.jar" + SAXON_DEBUG="/usr/local/java/saxon-6.2/.classes" + NDWEXT="/share/xsl/docbook/extensions/saxon61/.classes"; + if [ "$JAR" = "1" ]; then + NDWEXT="/share/xsl/docbook/extensions/saxon61.jar" + fi + ;; + 61) SAXON="/usr/local/java/saxon-6.1/saxon.jar" + SAXON_DEBUG="/usr/local/java/saxon-6.1/.classes" + NDWEXT="/share/xsl/docbook/extensions/saxon61/.classes"; + if [ "$JAR" = "1" ]; then + NDWEXT="/share/xsl/docbook/extensions/saxon61.jar" + fi + ;; + 6) SAXON="/usr/local/java/saxon-6.0.2/saxon.jar" + SAXON_DEBUG="/usr/local/java/saxon-6.0.2/.classes" + NDWEXT="/share/xsl/docbook/extensions/saxon6/.classes"; + if [ "$JAR" = "1" ]; then + NDWEXT="/share/xsl/docbook/extensions/saxon6.jar" + fi + ;; + 5) SAXON="/usr/local/java/saxon-5.5.1/saxon.jar" + SAXON_DEBUG="/usr/local/java/saxon-5.5.1/.classes" + NDWEXT="/share/xsl/docbook/extensions/saxon551/.classes"; + if [ "$JAR" = "1" ]; then + NDWEXT="/share/xsl/docbook/extensions/saxon551.jar" + fi + ;; + *) echo "Unexpected Saxon version $VERSION" + exit + ;; +esac + +if [ "$DEBUG" = "1" ]; then + SAXON="$SAXON_DEBUG:$SAXON" +fi + +XP="/usr/local/java/xp/xp.jar"; +SUN="/projects/sun/resolver/.classes"; +JAXP="/usr/local/jaxp-1.1/jaxp.jar:/usr/local/jaxp-1.1/crimson.jar" + +CLASSPATH=$SAXON:$JAXP:$SUN:$NDWEXT:~/java + +#echo $CLASSPATH + +echo saxon$VERSION $XARG $YARG $RARG $OUTPUT $XMLSRC $XMLSTY $VARIABLES $* + +if [ "$MEMORY" != "" ]; then + echo "java $MEMORY ..." +fi + +time java $MEMORY \ + -cp $CLASSPATH \ +-Djavax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImpl \ + com.icl.saxon.StyleSheet \ + $XARG $YARG $RARG $OUTPUT $XMLSRC $XMLSTY $VARIABLES $* + +if [ $? != 0 ]; then + echo "" + echo FAILED + echo "" + exit 1 +fi diff --git a/cvstools/xjparse b/cvstools/xjparse new file mode 100755 index 000000000..5bf9129ab --- /dev/null +++ b/cvstools/xjparse @@ -0,0 +1,25 @@ +#!/bin/bash + +# This shell script will definitely need to be hacked to run on your system! +# +# Usage: xjparse [opts] src.xml +# + +SUN="/projects/sun/resolver/.classes"; +JAXP="/usr/local/jaxp-1.1/jaxp.jar:/usr/local/jaxp-1.1/crimson.jar" + +CLASSPATH=$JAXP:$SUN:~/java + +#echo $CLASSPATH + +java \ + com.sun.resolver.apps.xparse $* + +if [ $? != 0 ]; then + echo "" + echo FAILED + echo "" + exit 1 +fi + + -- 2.40.0