diff options
Diffstat (limited to 'dist-tools')
| -rwxr-xr-x | dist-tools/getstats.py | 2 | ||||
| -rwxr-xr-x | dist-tools/git-commit-po-updates.sh | 2 | ||||
| -rwxr-xr-x | dist-tools/htmldoc | 7 | ||||
| -rwxr-xr-x | dist-tools/makerelease.pl | 30 | ||||
| -rwxr-xr-x | dist-tools/manServer.pl | 2939 | ||||
| -rw-r--r-- | dist-tools/shipper/COPYING | 340 | ||||
| -rw-r--r-- | dist-tools/shipper/Makefile | 38 | ||||
| -rw-r--r-- | dist-tools/shipper/README | 7 | ||||
| -rwxr-xr-x | dist-tools/shipper/buildrpms | 44 | ||||
| -rwxr-xr-x | dist-tools/shipper/rpm2lsm | 108 | ||||
| -rw-r--r-- | dist-tools/shipper/rpm2lsm.1 | 95 | ||||
| -rw-r--r-- | dist-tools/shipper/rpm2lsm.xml | 135 | ||||
| -rwxr-xr-x | dist-tools/shipper/shipper | 583 | ||||
| -rw-r--r-- | dist-tools/shipper/shipper.1 | 294 | ||||
| -rw-r--r-- | dist-tools/shipper/shipper.spec | 69 | ||||
| -rw-r--r-- | dist-tools/shipper/shipper.xml | 752 |
16 files changed, 28 insertions, 5417 deletions
diff --git a/dist-tools/getstats.py b/dist-tools/getstats.py index ad52f464..4c45318b 100755 --- a/dist-tools/getstats.py +++ b/dist-tools/getstats.py @@ -12,7 +12,7 @@ from datetime import date # Get version and date with tempfile.TemporaryDirectory() as tmpdirname: subprocess.check_call("git archive --format=tar HEAD | ( cd {} && tar -xf -)".format(tmpdirname), shell=True) - LOC = subprocess.getoutput("cat {0}/*.[chly] {0}/*.py 2>/dev/null | wc -l".format(tmpdirname)).strip() + LOC = subprocess.getoutput("cat {0}/*.[chly] {0}/*.a[cm] {0}/*.py 2>/dev/null | wc -l".format(tmpdirname)).strip() try: with open("configure.ac") as f: AC_INIT = list(filter(lambda x: re.match('AC_INIT', x), diff --git a/dist-tools/git-commit-po-updates.sh b/dist-tools/git-commit-po-updates.sh index f7c4d759..0bcdb6f4 100755 --- a/dist-tools/git-commit-po-updates.sh +++ b/dist-tools/git-commit-po-updates.sh @@ -115,7 +115,7 @@ done git diff -G '^"(Project-Id-Version|PO-Revision-Date):' --name-only po/*.po \ | while read pofile ; do if ! handle_po "$pofile" "Update" "to" ; then - echo "There were errors updating $nfile" >&2 ; rc=1 + echo "There were errors updating $pofile" >&2 ; rc=1 fi done diff --git a/dist-tools/htmldoc b/dist-tools/htmldoc new file mode 100755 index 00000000..b16af17f --- /dev/null +++ b/dist-tools/htmldoc @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu +type htmldoc >/dev/null 2>&1 && case "$(type htmldoc)" in +*"$(realpath $(dirname $0))"*) ;; # ignore re-executing ourselves to avoid unterminated recursion +*) exec htmldoc "$@" ;; +esac +exec flatpak run --filesystem=host org.msweet.htmldoc "$@" diff --git a/dist-tools/makerelease.pl b/dist-tools/makerelease.pl index 8a648316..0f9a2f3b 100755 --- a/dist-tools/makerelease.pl +++ b/dist-tools/makerelease.pl @@ -94,8 +94,6 @@ if ($versions[0] eq $tag) { my $pwd = `pwd`; chomp $pwd; -$ENV{PATH} .= ":$pwd/dist-tools:$pwd/dist-tools/shipper"; - print "Building $version release, tag $tag, previous tag $oldtag\n"; if (-d "autom4te.cache") { @@ -128,10 +126,13 @@ print "--- CPUs for make: $ncpu\n"; if ($ncpu < 1) { warn "ncpus unplausible, assuming 2"; $ncpu = 2; } -if (system("cd autobuild && make -j$ncpu " . ($verbose ? '' : '-s') . " check distcheck")) { +if (system("cd autobuild && make -j $ncpu " . ($verbose ? '' : '-s') . " check && make -j $ncpu " . ($verbose ? '' : '-s') . " distcheck")) { die("Compilation failure\n"); } +my $hashes = `cd autobuild && openssl dgst -sha256 $project-$version$xzsufx $project-$version$lzsufx`; +if (!$hashes) { die "openssl dgst failed"; } + open(REPORT, ">$tmp/$project.PREAMBLE.$$"); print REPORT <<EOF; @@ -145,8 +146,15 @@ The source archive is available at: <$website$project-$version$xzsufx/download> <$website$project-$version$lzsufx/download> -Here are the release notes: +The detached GnuPG signature is available at: +<$website$project-$version$xzsufx.asc/download> +<$website$project-$version$lzsufx.asc/download> + +The SHA256 hashes for the tarballs are: +$hashes +Here are the release notes: +-------------------------------------------------------------------------------- EOF # Extract the current notes @@ -169,16 +177,14 @@ $oldver =~ tr/-/./; $oldver =~ s/^RELEASE_//; if ($diffs) { - print REPORT "Diffs from the previous ($oldver) release follow as a MIME attachment." -} else { - print REPORT "By popular demand, diffs from the previous release have been omitted." + print REPORT "Diffs from the previous ($oldver) release follow as a MIME attachment.\n"; } -close(NEWS); - -close(REPORT); +close(NEWS) or die $!; +close(REPORT) or die $!; if ($diffs) { + die "sending diffs has not been ported from svn to git yet. Aborting"; if ($tag eq '<workfile>') { system("svn diff -r$oldtag $errnull >$tmp/$project.DIFFS.$$"); } else { @@ -192,7 +198,8 @@ if ($diffs) { ." -n -D 'diff between $oldver and $version' -m 'text/plain' -e 7bit -f $tmp/$project.DIFFS.$$" ." -o ANNOUNCE.EMAIL"; } else { - system("mv", "$tmp/$project.PREAMBLE.$$", "ANNOUNCE.EMAIL"); + my @cmd = ("mv", "$tmp/$project.PREAMBLE.$$", "ANNOUNCE.EMAIL"); + system (@cmd) == 0 or die "mv @cmd failed: $?"; } #unlink("$tmp/$project.PREAMBLE.$$"); @@ -204,6 +211,7 @@ system("cd autobuild && gpg -ba --sign $project-$version$xzsufx && gpg -ba --sig print "### Extracting release notes...\n"; makerelnotes('NEWS', 'autobuild/README.txt'); +#die "Aborting... in dry-run mode"; print "### Uploading\n"; print "=== local\n"; diff --git a/dist-tools/manServer.pl b/dist-tools/manServer.pl deleted file mode 100755 index 6573f650..00000000 --- a/dist-tools/manServer.pl +++ /dev/null @@ -1,2939 +0,0 @@ -#!/usr/bin/perl -T - -# manServer - Unix man page to HTML converter -# Rolf Howarth, rolf@squarebox.co.uk -# Version 1.07 16 July 2001 -# Version 1.07+ma1 2006-03-31 Matthias Andree -# add trailing slash of URLs -# support https, too - -$version = "1.07+ma1"; -$manServerUrl = "<A HREF=\"http://www.squarebox.co.uk/users/rolf/download/manServer.shtml\">manServer $version</A>"; - -use Socket; - -$ENV{'PATH'} = "/bin:/usr/bin"; - -initialise(); -$request = shift @ARGV; -# Usage: manServer [-dn] filename | manServer [-s port] - -$root = ""; -$cgiMode = 0; -$bodyTag = "BODY bgcolor=#F0F0F0 text=#000000 link=#0000ff vlink=#C000C0 alink=#ff0000"; - -if ($ENV{'GATEWAY_INTERFACE'} ne "") -{ - *OUT = *STDOUT; - open(LOG, ">>/tmp/manServer.log"); - chmod(0666, '/tmp/manServer.log'); - $root = $ENV{'SCRIPT_NAME'}; - $url = $ENV{'PATH_INFO'}; - if ($ENV{'REQUEST_METHOD'} eq "POST") - { $args = <STDIN>; chop $args; } - else - { $args = $ENV{'QUERY_STRING'}; } - $url .= "?".$args if ($args); - $cgiMode = 1; - $date = &fmtTime(time); - $remoteHost = $ENV{'REMOTE_HOST'} || $ENV{'REMOTE_ADDR'}; - $referer = $ENV{'HTTP_REFERER'}; - $userAgent = $ENV{'HTTP_USER_AGENT'}; - print LOG "$date\t$remoteHost\t$url\t$referer\t$userAgent\n"; - processRequest($url); -} -elsif ($request eq "-s" || $request eq "") -{ - *LOG = *STDERR; - startServer(); -} -else -{ - $cmdLineMode = 1; - if ($request =~ m/^-d(\d)/) - { - $debug = $1; - $request = shift @ARGV; - } - *OUT = *STDOUT; - *LOG = *STDERR; - $file = findPage($request); - man2html($file); -} - -exit(0); - - -##### Mini HTTP Server #### - -sub startServer -{ - ($port) = @ARGV; - $port = 8888 unless $port; - - $sockaddr = 'S n a4 x8'; - - ($name, $aliases, $proto) = getprotobyname('tcp'); - ($name, $aliases, $port) = getservbyname($port, 'tcp') - unless $port =~ /^\d+$/; - - while(1) - { - $this = pack($sockaddr, AF_INET, $port, "\0\0\0\0"); - - select(NS); $| = 1; select(stdout); - - socket(S, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; - if (bind(S, $this)) - { - last; - } - else - { - print STDERR "Failed to bind to port $port: $!\n"; - ++$port; - } - } - - listen(S, 5) || die "connect: $!"; - - select(S); $| = 1; select(stdout); - - while(1) - { - print LOG "Waiting for connection on port $port\n"; - ($addr = accept(NS,S)) || die $!; - #print "accept ok\n"; - - ($af,$rport,$inetaddr) = unpack($sockaddr,$addr); - @inetaddr = unpack('C4',$inetaddr); - print LOG "Got connection from ", join(".",@inetaddr), "\n"; - - while (<NS>) - { - if (m/^GET (\S+)/) { $url = $1; } - last if (m/^\s*$/); - } - *OUT = *NS; - processRequest($url); - close NS ; - } -} - - -sub processRequest -{ - $url = $_[0]; - print LOG "Request = $url, root = $root\n"; - - if ( ($url =~ m/^([^?]*)\?(.*)$/) || ($url =~ m/^([^&]*)&(.*)$/) ) - { - $request = $1; - $args = $2; - } - else - { - $request = $url; - $args = ""; - } - - @params = split(/[=&]/, $args); - for ($i=0; $i<=$#params; ++$i) - { - $params[$i] =~ tr/+/ /; - $params[$i] =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C",hex($1))/eg; - } - %params = @params; - - $request = $params{'q'} if ($params{'q'}); - $searchType = $params{'t'}; - $debug = $params{'d'}; - - $processed = 0; - $file = ""; - - if ($searchType) - { - print OUT "HTTP/1.0 200 Ok\n" unless ($cgiMode); - print OUT "Content-type: text/html\n\n"; - print OUT "<H1>Searching not yet implemented</H1>\n"; - print LOG "Searching not implemented\n"; - $processed = 1; - } - elsif ($request eq "/" || $request eq "") - { - print OUT "HTTP/1.0 200 Ok\n" unless ($cgiMode); - print OUT "Content-type: text/html\n\n"; - print LOG "Home page\n"; - homePage(); - $processed = 1; - } - elsif ($request =~ m,^/.*/$,) - { - print OUT "HTTP/1.0 200 Ok\n" unless ($cgiMode); - print OUT "Content-type: text/html\n\n"; - print LOG "List directory\n"; - listDir($request); - $processed = 1; - } - elsif (-f $request || -f "$request.gz" || -f "$request.bz2") - { - # Only allow fully specified files if they're in our manpath - foreach $md (@manpath) - { - $dir = $md; - if (substr($request,0,length($dir)) eq $dir) - { - print OUT "HTTP/1.0 200 Ok\n" unless ($cgiMode); - print OUT "Content-type: text/html\n\n"; - man2html($request); - $processed = 1; - last; - } - } - } - else - { - $file = findPage($request); - if (@multipleMatches) - { - print OUT "HTTP/1.0 200 Ok\n" unless ($cgiMode); - print OUT "Content-type: text/html\n\n"; - print LOG "Multiple matches\n"; - printMatches(); - $processed = 1; - } - elsif ($file) - { - print OUT "HTTP/1.0 301 Redirected\n" unless ($cgiMode); - $file .= "&d=$debug" if ($debug); - print OUT "Location: $root$file\n\n"; - print LOG "Redirect to $root$file\n"; - $processed = 1; - } - } - - unless ($processed) - { - print OUT "HTTP/1.0 404 Not Found\n" unless ($cgiMode); - print OUT "Content-type: text/html\n\n"; - print OUT "<HTML><HEAD>\n<TITLE>Not Found</TITLE>\n<$bodyTag>\n"; - print OUT "<CENTER><H1><HR>Not Found<HR></H1></CENTER>\nFailed to find man page /$request\n"; - print OUT "<P><HR><P><A HREF=\"$root/\">Main Index</A>\n</HTML>\n"; - print STDERR "Failed to find /$request\n" unless ($cgiMode); - } -} - -sub homePage -{ - print OUT "<HTML><HEAD><TITLE>Manual Pages - Main Index</TITLE> -</HEAD><$bodyTag><CENTER><H1><HR><I>Manual Reference Pages</I> - Main Index<HR></H1></CENTER> -<FORM ACTION=\"$root/\" METHOD=get>\n"; - $uname = `uname -s -r`; - if (! $?) - { - $hostname = `hostname`; - print OUT "<B>$uname pages on $hostname</B><P>\n"; - } - # print OUT "<SELECT name=t> <OPTION selected value=0>Command name - # <OPTION value=1>Keyword search <OPTION value=2>Full text search</SELECT>\n"; - print OUT "Command name: <INPUT name=q size=20> <INPUT type=submit value=\"Show Page\"> </FORM><P>\n"; - loadManDirs(); - foreach $dir (@mandirs) - { - ($section) = ($dir =~ m/man([0-9A-Za-z]+)$/); - print OUT "<A HREF=\"$root$dir/\">$dir" ; - print OUT "- <I>$sectionName{$section}</I>" if ($sectionName{$section}); - print OUT "</A><BR>\n"; - } - print OUT "<P><HR><P><FONT SIZE=-1>Generated by $manServerUrl from local unix man pages.</FONT>\n</BODY></HTML>\n"; -} - -sub listDir -{ - foreach $md (@manpath) - { - $dir = $md; - if (substr($request,0,length($dir)) eq $dir) - { - $request =~ s,/$,,; - ($section) = ($request =~ m/man([0-9A-Za-z]+)$/); - $sectionName = $sectionName{$section}; - $sectionName = "Manual Reference Pages" unless ($sectionName); - print OUT "<HTML><HEAD><TITLE>Contents of $request</TITLE></HEAD>\n<$bodyTag>\n"; - print OUT "<CENTER><H1><HR><NOBR><I>$sectionName</I></NOBR> - <NOBR>Index of $request</NOBR><HR></H1></CENTER>\n"; - print OUT "<FORM ACTION=\"$root/\" METHOD=get>\n"; - print OUT "Command name: <INPUT name=q size=20> <INPUT type=submit value=\"Show Page\"> </FORM><P>\n"; - - if (opendir(DIR, $request)) - { - @files = sort readdir DIR; - foreach $f (@files) - { - next if ($f eq "." || $f eq ".." || $f !~ m/\./); - $f =~ s/\.(gz|bz2)$//; - # ($name) = ($f =~ m,/([^/]*)$,); - print OUT "<A HREF=\"$root$request/$f\">$f</A> \n"; - } - closedir DIR; - } - print OUT "<P><A HREF=\"$root/\">Main Index</A>\n</HTML>\n"; - print OUT "<P><HR><P><FONT SIZE=-1>Generated by $manServerUrl from local unix man pages.</FONT>\n</BODY></HTML>\n"; - return; - } - } - print OUT "<H1>Directory $request not known</H1>\n"; -} - -sub printMatches -{ - print OUT "<HTML><HEAD><TITLE>Ambiguous Request '$request'</TITLE></HEAD>\n<$bodyTag>\n"; - print OUT "<CENTER><H1><HR>Ambiguous Request '$request'<HR></H1></CENTER>\nPlease select one of the following pages:<P><BLOCKQUOTE>"; - foreach $f (@multipleMatches) - { - print OUT "<A HREF=\"$root$f\">$f</A><BR>\n"; - } - print OUT "</BLOCKQUOTE><HR><P><A HREF=\"$root/\">Main Index</A>\n</HTML>\n"; -} - - -##### Process troff input using man macros into HTML ##### - -sub man2html -{ - $file = $_[0]; - $srcfile = $file; - $zfile = $file; - if (! -f $file) - { - if (-f "$file.gz") - { - $zfile = "$file.gz"; - $zcat = "/usr/bin/zcat"; - $zcat = "/bin/zcat" unless (-x $zcat); - $srcfile = "$zcat $zfile |"; - $srcfile =~ m/^(.*)$/; - $srcfile = $1; # untaint - } - elsif (-f "$file.bz2") - { - $zfile = "$file.bz2"; - $srcfile = "/usr/bin/bzcat $zfile |"; - $srcfile =~ m/^(.*)$/; - $srcfile = $1; # untaint - } - } - print LOG "man2html $file\n"; - $foundNroffTag = 0; - loadContents($file); - unless (open(SRC, $srcfile)) - { - print OUT "<H1>Failed to open $file</H1>\n"; - print STDERR "Failed to open $srcfile\n"; - return; - } - ($dir,$page,$sect) = ($file =~ m,^(.*)/([^/]+)\.([^.]+)$,); - $troffTable = 0; - %macro = (); - %renamedMacro = (); - %deletedMacro = (); - @indent = (); - @tabstops = (); - $indentLevel = 0; - $prevailingIndent = 6; - $trapLine = 0; - $blockquote = 0; - $noSpace = 0; - $firstSection = 0; - $eqnStart = ""; - $eqnEnd = ""; - $eqnMode = 0; - %eqndefs = (); - $defaultNm = ""; - $title = $file; - $title = "Manual Page - $page($sect)" if ($page && $sect); - - $_ = getLine(); - if (m/^.so (man.*)$/) - { - # An .so include on the first line only is replaced by the referenced page. - # (See elsewhere for processing of included sections that occur later in document.) - man2html("$dir/../$1"); - return; - } - - $perlPattern = ""; - if ($file =~ m/perl/) - { - &loadPerlPages(); - $perlPattern = join('|', grep($_ ne $page, keys %perlPages)); - } - - print OUT "<HTML><HEAD>\n<TITLE>$title</TITLE>\n<$bodyTag><A NAME=top></A>\n"; - - if ($foundNroffTag) - { - do - { - preProcessLine(); - processLine(); - } - while(getLine()); - endNoFill(); - endParagraph(); - } - else - { - # Special case where input is not nroff at all but is preformatted text - $sectionName = "Manual Reference Pages"; - $sectionNumber = $sect; - $left = "Manual Page"; - $right = "Manual Page"; - $macroPackage = "(preformatted text)"; - $pageName = "$page($sect)"; - $saveCurrentLine = $_; - outputPageHead(); - $_ = $saveCurrentLine; - print OUT "<PRE>\n"; - do - { - print OUT $_; - } - while(getLine()); - print OUT "</PRE>\n"; - } - outputPageFooter(); -} - -sub outputPageHead -{ - plainOutput( "<CENTER>\n" ); - outputLine( "<H1><HR><I>$sectionName - </I><NOBR>$pageName</NOBR><HR></H1>\n" ); - plainOutput( "</CENTER>\n" ); -} - -sub outputPageFooter -{ - if ($pageName) - { - unless ($cmdLineMode) - { - plainOutput( "<FORM ACTION=\"$root/\" METHOD=get>\n" ); - plainOutput( "Jump to page <INPUT name=q size=12> or go to <A HREF=#top>Top of page</A> | \n" ); - plainOutput( "<A HREF=\"$root$dir/\">Section $sectionNumber</A> | \n" ); - plainOutput( "<A HREF=\"$root/\">Main Index</A>.\n" ); - plainOutput( "<FORM>\n" ); - } - endBlockquote(); - outputLine("<P><HR>\n<TABLE width=100%><TR> <TD width=33%><I>$left</I></TD> <TD width=33% align=center>$pageName</TD> <TD align=right width=33%><I>$right</I></TD> </TR></TABLE>"); - } - plainOutput("<FONT SIZE=-1>Generated by $manServerUrl from $zfile $macroPackage.</FONT>\n</BODY></HTML>\n"); -} - -sub outputContents -{ - print OUT "<A name=contents></A><H3>CONTENTS</H3></A>\n"; - blockquote(); - for ($id=1; $id<=$#contents; ++$id) - { - $name = $contents[$id]; - $pre = ""; - $pre = " " if ($name =~ m/^ /); - $pre .= " " if ($name =~ m/^ /); - $name =~ s,^\s+,,; - next if ($name eq "" || $name =~ m,^/,); - unless ($name =~ m/[a-z]/) - { - $name = "\u\L$name"; - $name =~ s/ (.)/ \u\1/g; - } - outputLine("$pre<A HREF=#$id>$name</A><BR>\n"); - } - endBlockquote(); -} - -# First pass to extract table of contents -sub loadContents -{ - @contents = (); - %contents = (); - # print STDERR "SRCFILE = $srcfile\n"; - open(SRC, $srcfile) || return; - while (<SRC>) - { - preProcessLine(); - $foundNroffTag = $foundNroffTag || (m/^\.(\\\"|TH|so) /); - if (m/^\.(S[HShs]) ([A-Z].*)\s*$/) - { - $foundNroffTag = 1; - $c = $1; - $t = $2; - $t =~ s/"//g; - $id = @contents; - if ($c eq "SH" || $c eq "Sh") - { - push(@contents, $t); - } - elsif ($t =~ m/\\f/) - { - $t =~ s/\\f.//g; - push(@contents, " $t"); - } - else - { - push(@contents, " $t"); - } - $contents{"\U$t"} = $id; - } - } - close SRC; -} - -# Preprocess $_ -sub preProcessLine -{ - # Remove spurious white space to canonicise the input - chop; - $origLine = $_; - s, $,,g; - s,^',.,; # treat non breaking requests as if there was a dot - s,^\.\s*,\.,; - - if ($eqnMode == 1) - { - if (m/$eqnEnd/) - { - s,^(.*?)$eqnEnd,&processEqnd($1),e; - $eqnMode = 0; - } - else - { - &processEqns($_); - } - } - if ($eqnStart && $eqnMode==0) - { - s,$eqnStart(.*?)$eqnEnd,&processEqnd($1),ge; - if (m/$eqnStart/) - { - s,$eqnStart(.*)$,&processEqns($1),e; - $eqnMode = 1; - } - } - - # XXX Note: multiple levels of escaping aren't handled properly, eg. \\*.. as a macro argument - # should get interpolated as string but ends up with a literal '\' being copied through to output. - s,\\\\\*q,",g; # treat mdoc \\*q as special case - - s,\\\\,_DBLSLASH_,g; - s,\\ ,_SPACE_,g; - s,\s*\\".*$,,; - s,\\$,,; - - # Then apply any variable substitutions and escape < and > - # (which has to be done before we start inserting tags...) - s,\\\*\((..),$vars{$1},ge; - s/\\\*([*'`,^,:~].)/$vars{$1}||"\\*$1"/ge; - s,\\\*(.),$vars{$1},ge; - # Expand special characters for the first time (eg. \(<- - s,\\\((..),$special{$1}||"\\($1",ge; - s,<,<,g; - s,>,>,g; - - # Interpolate width and number registers - s,\\w(.)(.*?)\1,&width($2),ge; - s,\\n\((..),&numreg($1),ge; - s,\\n(.),&numreg($1),ge; -} - -# Undo slash escaping, normally done at output stage, also in macro defn -sub postProcessLine -{ - s,_DBLSLASH_,\\,g; - s,_SPACE_, ,g; -} - -# Rewrite the line, expanding escapes such as font styles, and output it. -# The line may be a plain text troff line, or it might be the expanded output of a -# macro in which case some HTML tags may already have been inserted into the text. -sub outputLine -{ - $_ = $_[0]; - - print OUT "<!-- Output: \"$_\" -->\n" if ($debug>1); - - if ($needBreak) - { - plainOutput("<!-- Need break --><BR>\n"); - lineBreak(); - } - if ($textSinceBreak && !$noFill && $_ =~ m/^\s/) - { - plainOutput("<BR>\n"); - lineBreak(); - } - - s,\\&\.,.,g; # \&. often used to escape dot at start of line - s,\\\.,.,g; - s,\\\^,,g; - s,\\\|,,g; - s,\\c,,g; - s,\\0, ,g; - s,\\t,\t,g; - - s,\\%, ,g; - s,\\\{,,g; - s,\\},,g; - s,\\$,,g; - - s,\\e,\,g; - s,\\([-+_~#[]),\1,g; - - # Can't implement local motion tags - s,\\[hv](.).*?\1,,g; - s,\\z,,g; - - # Font changes, super/sub-scripts and font size changes - s,\\(f[^(]|f\(..|u|d|s[-+]?\d),&inlineStyle($1),ge; - - # Overstrike - if (m/\\o/) - { - # handle a few special accent cases we know how to deal with - s,\\o(.)([aouAOU])"\1,\\o\1\2:\1,g; - s,\\o(.)(.)\\(.)\1,\\o\1\2\3\1,g; - s;\\o(.)([A-Za-z])(['`:,^~])\1;\\o\1\3\2\1;g; - #s,\\o(.)(.*?)\1,"<BLINK>".($vars{$2}||$2)."</BLINK>",ge; - s,\\o(.)(.*?)\1,$vars{$2}||$2,ge; - } - # Bracket building (ignore) - s,\\b(.)(.*?)\1,\2,g; - - s,\\`,`,g; - s,\\',',g; - s,',’,g; - s,`,‘,g; - - # Expand special characters introduced by eqn - s,\\\((..),$special{$1}||"\\($1",ge; - s,\\\((..),<BLINK>\\($1</BLINK>,g unless (m,^\.,); - - # Don't know how to handle other escapes - s,(\\[^&]),<BLINK>\1</BLINK>,g unless (m,^\.,); - - postProcessLine(); - - # Insert links for http, ftp and mailto URLs - # Recognised URLs are sequence of alphanumerics and special chars like / and ~ - # but must finish with an alphanumeric rather than punctuation like "." - s,\b(https?://[-\w/~:@.%#+$?=]+[\w/]),<A HREF=\"\1\">\1</A>,g; - s,\b(ftp://[-\w/~:@.%#+$?=]+),<A HREF=\"\1\">\1</A>,g; - s,([-_A-Za-z0-9.]+@[A-Za-z][-_A-Za-z0-9]*\.[-_A-Za-z0-9.]+),<A HREF=\"mailto:\1\">\1</A>,g; - - # special case for things like 'perlre' as it's so useful but the - # pod-generated pages aren't very parser friendly... - if ($perlPattern && ! m/<A HREF/i) - { - s,\b($perlPattern)\b,<A HREF=\"$root$perlPages{$1}\">\1</A>,g; - } - - # Do this late so \& can be used to suppress conversion of URLs etc. - s,\\&,,g; - - # replace tabs with spaces to next multiple of 8 - if (m/\t/) - { - $tmp = $_; - $tmp =~ s/<[^>]*>//g; - $tmp =~ s/&[^;]*;/@/g; - @tmp = split(/\t/, $tmp); - $pos = 0; - for ($i=0; $i<=$#tmp; ++$i) - { - $pos += length($tmp[$i]); - $tab[$i] = 0; - $tab[$i] = 8 - $pos%8 unless (@tabstops); - foreach $ts (@tabstops) - { - if ($pos < $ts) - { - $tab[$i] = $ts-$pos; - last; - } - } - $pos += $tab[$i]; - } - while (m/\t/) - { - s,\t," " x (shift @tab),e; - } - } - - $textSinceBreak = $_ unless ($textSinceBreak); - print OUT $_; -} - -# Output a line consisting purely of HTML tags which shouldn't be regarded as -# a troff output line. -sub plainOutput -{ - print OUT $_[0]; -} - - -# Output the original line for debugging -sub outputOrigLine -{ - print OUT "<!-- $origLine -->\n"; -} - -# Use this to read the next input line (buffered to implement lookahead) -sub getLine -{ - $lookaheadPtr = 0; - if (@lookahead) - { - $_ = shift @lookahead; - return $_; - } - $_ = <SRC>; -} - -# Look ahead to peek at the next input line -sub _lookahead -{ - # set lookaheadPtr to 0 to re-read the lines we've looked ahead at - if ($lookaheadPtr>=0 && $lookaheadPtr <= $#lookahead) - { - return $lookahead[$lookaheadPtr++]; - } - $lookaheadPtr = -1; - $ll = <SRC>; - push(@lookahead, $ll); - return $ll; -} - -# Consume the last line that was returned by lookahead -sub consume -{ - --$lookaheadPtr; - if ($lookaheadPtr>=0 && $lookaheadPtr <= $#lookahead) - { - $removed = $lookahead[$lookaheadPtr]; - @lookahead = (@lookahead[0..$lookaheadPtr-1],@lookahead[$lookaheadPtr+1..$#lookahead]); - } - else - { - $removed = pop @lookahead; - } - chop $removed; - plainOutput("<!-- Consumed $removed -->\n"); -} - -# Look ahead skipping comments and other common non-text tags -sub lookahead -{ - $ll = _lookahead(); - while ($ll =~ m/^\.(\\"|PD|IX|ns)/) - { - $ll = _lookahead(); - } - return $ll; -} - -# Process $_, expaning any macros into HTML and calling outputLine(). -# If necessary, this method can read more lines of input from <SRC> (.ig & .de) -# The following state variables are used: -# ... -sub processLine -{ - $doneLine = 1; # By default, this counts as a line for trap purposes - - s,^\.if t ,,; - s,^\.el ,,; # conditions assumed to evaluate false, so else must be true... - - if ($troffTable) - { - processTable(); - } - elsif ($eqnMode == 2) - { - plainOutput("<!-- $_ -->\n"); - processEqns($_); - } - elsif (m/^\./) - { - processMacro(); - } - else - { - processPlainText(); - } - if ($doneLine) - { - # Called after processing (most) input lines to decrement trapLine. This is needed - # to implement the .it 1 trap after one line for .TP, where the first line is outdented - if ($trapLine > 0) - { - --$trapLine; - if ($trapLine == 0) - { - &$trapAction; - } - } - } -} - - -# Process plain text lines -sub processPlainText -{ - if ($_ eq "") - { - lineBreak(); - plainOutput("<P>\n"); - return; - } - - s,(\\f[23BI])([A-Z].*?)(\\f.),$1.($contents{"\U$2"}?"<A HREF=#".$contents{"\U$2"}.">$2</A>":$2).$3,ge; - - if ($currentSection eq "SEE ALSO" && ! $cmdLineMode) - { - # Some people don't use BR or IR for see also refs - s,(^|\s)([-.A-Za-z_0-9]+)\s?\(([0-9lL][0-9a-zA-Z]*)\),\1<A HREF=\"$root/$2.$3\">$2($3)</A>,g; - } - outputLine("$_\n"); -} - - -# Process macros and built-in directives -sub processMacro -{ - outputOrigLine(); - - # Place macro arguments (space delimited unless within ") into @p - # Remove " from $_, place command in $c, remainder in $joined - - @p = grep($_ !~ m/^\s*$/, split(/("[^"]*"|\s+)/) ); - grep(s/"//g, @p); - $_ = join(" ", @p); - $p[0] =~ s/^\.//; - $c = $p[0]; - $joined = join(" ", @p[1..$#p]); - $joined2 = join(" ", @p[2..$#p]); - $joined3 = join(" ", @p[3..$#p]); - - if ($macro{$c}) # Expand macro - { - # Get full macro text - $macro = $macro{$c}; - # Interpolate arguments - $macro =~ s,\\\$(\d),$p[$1],ge; - #print OUT "<!-- Expanding $c to\n$macro-->\n"; - foreach $_ (split(/\n/, $macro)) - { - $_ .= "\n"; - preProcessLine(); - processLine(); - } - $doneLine = 0; - return; - } - elsif ($renamedMacro{$c}) - { - $c = $renamedMacro{$c}; - } - - if ($c eq "ds") # Define string - { - $vars{$p[1]} = $joined2; - $doneLine = 0; - } - elsif ($c eq "nr") # Define number register - { - $number{$p[1]} = evalnum($joined2); - $doneLine = 0; - } - elsif ($c eq "ti") # Temporary indent - { - plainOutput(" "); - } - elsif ($c eq "rm") - { - $macroName = $p[1]; - if ($macro{$macroName}) - { - delete $macro{$macroName}; - } - else - { - $deletedMacro{$macroName} = 1; - } - } - elsif ($c eq "rn") - { - $oldName = $p[1]; - $newName = $p[2]; - $macro = $macro{$oldName}; - if ($macro) - { - if ($newName =~ $reservedMacros && ! $deletedMacro{$newName}) - { - plainOutput("<!-- Not overwriting reserved macro '$newName' -->\n"); - } - else - { - $macro{$newName} = $macro; - delete $deletedMacro{$newName}; - } - delete $macro{$oldName}; - } - else - { - # Support renaming of reserved macros by mapping occurrences of new name - # to old name after macro expansion so that built in definition is still - # available, also mark the name as deleted to override reservedMacro checks. - plainOutput("<!-- Fake renaming reserved macro '$oldName' -->\n"); - $renamedMacro{$newName} = $oldName; - $deletedMacro{$oldName} = 1; - } - } - elsif ($c eq "de" || $c eq "ig") # Define macro or ignore - { - $macroName = $p[1]; - if ($c eq "ig") - { $delim = ".$p[1]"; } - else - { $delim = ".$p[2]"; } - $delim = ".." if ($delim eq "."); - # plainOutput("<!-- Scanning for delimiter $delim -->\n"); - - $macro = ""; - $_ = getLine(); - preProcessLine(); - while ($_ ne $delim) - { - postProcessLine(); - outputOrigLine(); - $macro .= "$_\n"; - $_ = getLine(); - last if ($_ eq ""); - preProcessLine(); - } - outputOrigLine(); - # plainOutput("<!-- Found delimiter -->\n"); - if ($c eq "de") - { - if ($macroName =~ $reservedMacros && ! $deletedMacro{$macroName}) - { - plainOutput("<!-- Not defining reserved macro '$macroName' ! -->\n"); - } - else - { - $macro{$macroName} = $macro; - delete $deletedMacro{$macroName}; - } - } - } - elsif ($c eq "so") # Source - { - plainOutput("<P>[<A HREF=\"$root$dir/../$p[1]\">Include document $p[1]</A>]<P>\n"); - } - elsif ($c eq "TH" || $c eq "Dt") # Man page title - { - endParagraph(); - $sectionNumber = $p[2]; - $sectionName = $sectionName{"\L$sectionNumber"}; - $sectionName = "Manual Reference Pages" unless ($sectionName); - $pageName = "$p[1] ($sectionNumber)"; - outputPageHead(); - if ($c eq "TH") - { - $right = $p[3]; - $left = $p[4]; - $left = $osver unless ($left); - $macroPackage = "using man macros"; - } - else - { - $macroPackage = "using doc macros"; - } - } - elsif ($c eq "Nd") - { - outputLine("- $joined\n"); - } - elsif ($c eq "SH" || $c eq "SS" || $c eq "Sh" || $c eq "Ss") # Section/subsection - { - lineBreak(); - endNoFill(); - endParagraph(); - $id = $contents{"\U$joined"}; - $currentSection = $joined; - - if ($c eq "SH" || $c eq "Sh") - { - endBlockquote(); - if ($firstSection++==1) # after first 'Name' section - { - outputContents(); - } - outputLine( "<A name=$id>\n\n <H3>$joined</H3>\n\n</A>\n" ); - blockquote(); - } - elsif ($joined =~ m/\\f/) - { - $joined =~ s/\\f.//g; - $id = $contents{"\U$joined"}; - outputLine( "<A name=$id>\n<H4><I>$joined</I></H4></A>\n" ); - } - else - { - endBlockquote(); - outputLine( "<A name=$id>\n\n <H4> $joined</H4>\n</A>\n" ); - blockquote(); - } - lineBreak(); - } - elsif ($c eq "TX" || $c eq "TZ") # Document reference - { - $title = $title{$p[1]}; - $title = "Document [$p[1]]" unless ($title); - outputLine( "\\fI$title\\fP$joined2\n" ); - } - elsif ($c eq "PD") # Line spacing - { - $noSpace = ($p[1] eq "0"); - $doneLine = 0; - } - elsif ($c eq "TS") # Table start - { - unless ($macroPackage =~ /tbl/) - { - if ($macroPackage =~ /eqn/) - { $macroPackage =~ s/eqn/eqn & tbl/; } - else - { $macroPackage .= " with tbl support"; } - } - resetStyles(); - endNoFill(); - $troffTable = 1; - $troffSeparator = "\t"; - plainOutput( "<P><BLOCKQUOTE><TABLE bgcolor=#E0E0E0 border=1 cellspacing=0 cellpadding=3>\n" ); - } - elsif ($c eq "EQ") # Eqn start - { - unless ($macroPackage =~ /eqn/) - { - if ($macroPackage =~ /tbl/) - { $macroPackage =~ s/tbl/tbl & eqn/; } - else - { $macroPackage .= " with eqn support"; } - } - $eqnMode = 2; - } - elsif ($c eq "ps") # Point size - { - plainOutput(&sizeChange($p[1])); - } - elsif ($c eq "ft") # Font change - { - plainOutput(&fontChange($p[1])); - } - elsif ($c eq "I" || $c eq "B") # Single word font change - { - $id = $contents{"\U$joined"}; - if ($id && $joined =~ m/^[A-Z]/) - { $joined = "<A HREF=#$id>$joined</A>"; } - outputLine( "\\f$c$joined\\fP " ); - plainOutput("\n") if ($noFill); - } - elsif ($c eq "SM") # Single word smaller - { - outputLine("\\s-1$joined\\s0 "); - $doneLine = 0 unless ($joined); - } - elsif ($c eq "SB") # Single word bold and small - { - outputLine("\\fB\\s-1$joined\\s0\\fP "); - } - elsif (m/^\.[BI]R (\S+)\s?\(\s?([0-9lL][0-9a-zA-Z]*)\s?\)(.*)$/) - { - # Special form, .BR is generally used for references to other pages - # Annoyingly, some people have more than one per line... - # Also, some people use .IR ... - for ($i=1; $i<=$#p; $i+=2) - { - $pair = $p[$i]." ".$p[$i+1]; - if ($p[$i+1] eq "(") - { - $pair .= $p[$i+2].$p[$i+3]; - $i += 2; - } - if ($pair =~ m/^(\S+)\s?\(\s?([0-9lL][0-9a-zA-Z]*)\s?\)(.*)$/) - { - if ($cmdLineMode) - { outputLine( "\\fB$1\\fR($2)$3\n" ); } - else - { outputLine( "<A HREF=\"$root/$1.$2\">$1($2)</A>$3\n" ); } - } - else - { outputLine( "$pair\n" ); } - } - } - elsif ($c eq "BR" || $c eq "BI" || $c eq "IB" || - $c eq "IR" || $c eq "RI" || $c eq "RB") - { - $f1 = (substr($c ,0,1)); - $f2 = (substr($c,1,1)); - - # Check if first param happens to be a section name - $id = $contents{"\U$p[1]"}; - if ($id && $p[1] =~ m/^[A-Z]/) - { - $p[1] = "<A HREF=#$id>$p[1]</A>"; - } - - for ($i=1; $i<=$#p; ++$i) - { - $f = ($i%2 == 1) ? $f1 : $f2; - outputLine("\\f$f$p[$i]"); - } - outputLine("\\fP "); - plainOutput("\n") if ($noFill); - } - elsif ($c eq "nf" || $c eq "Bd") # No fill - { - startNoFill(); - } - elsif ($c eq "fi" || $c eq "Ed") # Fill - { - endNoFill(); - } - elsif ($c eq "HP") - { - $indent = evalnum($p[1]); - if ($trapOnBreak) - { - plainOutput("<BR>\n"); - } - else - { - # Outdent first line, ie. until next break - $trapOnBreak = 1; - $trapAction = *trapHP; - newParagraph($indent); - plainOutput( "<TD colspan=2>\n" ); - $colState = 2; - } - } - elsif ($c eq "IP") - { - $trapOnBreak = 0; - $tag = $p[1]; - $indent = evalnum($p[2]); - newParagraph($indent); - outputLine("<TD$width>\n$tag\n</TD><TD>\n"); - $colState = 1; - lineBreak(); - } - elsif ($c eq "TP") - { - $trapOnBreak = 0; - $trapLine = 1; # Next line is tag, then next column - $doneLine = 0; # (But don't count this line) - $trapAction = *trapTP; - $indent = evalnum($p[1]); - $tag = lookahead(); - chop $tag; - $i = ($indent ? $indent : $prevailingIndent) ; - $w = width($tag); - if ($w > $i) - { - plainOutput("<!-- Length of tag '$tag' ($w) > indent ($i) -->\n") if ($debug); - newParagraph($indent); - $trapAction = *trapHP; - plainOutput( "<TD colspan=2>\n" ); - $colState = 2; - } - else - { - newParagraph($indent); - plainOutput( "<TD$width nowrap>\n" ); - $colState = 0; - } - $body = lookahead(); - $lookaheadPtr = 0; - if ($body =~ m/^\.[HILP]?P/) - { - chop $body; - plainOutput("<!-- Suppressing TP body due to $body -->\n"); - $trapLine = 0; - } - } - elsif ($c eq "LP" || $c eq "PP" || $c eq "P" || $c eq "Pp") # Paragraph - { - $trapOnBreak = 0; - $prevailingIndent = 6; - if ($indent[$indentLevel] > 0 && $docListStyle eq "") - { - $line = lookahead(); - if ($line =~ m/^\.(TP|IP|HP)/) - { - plainOutput("<!-- suppressed $c before $1 -->\n"); - } - elsif ($line =~ m/^\.RS/) - { - plainOutput("<P>\n"); - } - else - { - endRow(); - $foundTag = ""; - $lookaheadPtr = 0; - do - { - $line = lookahead(); - if ($line =~ m/^\.(TP|HP|IP|RS)( \d+)?/) - { - $indent = $2; - $indent = $prevailingIndent unless ($2); - if ($indent == $indent[$indentLevel]) - { $foundTag = $1; } - $line = ""; - } - } - while ($line ne "" && $line !~ m/^\.(RE|SH|SS|PD)/); - $lookaheadPtr = 0; - if ($foundTag) - { - plainOutput("<!-- Found tag $foundTag -->\n"); - plainOutput("<TR><TD colspan=2>\n"); - $colState = 2; - } - else - { - plainOutput("<!-- $c ends table -->\n"); - setIndent(0); - } - } - } - else - { - plainOutput("<P>\n"); - } - lineBreak(); - } - elsif ($c eq "br") # Break - { - if ($trapOnBreak) - { - # Should this apply to all macros that cause a break? - $trapOnBreak = 0; - &$trapAction(); - } - $needBreak = 1 if ($textSinceBreak); - } - elsif ($c eq "sp") # Space - { - lineBreak(); - plainOutput("<P>\n"); - } - elsif ($c eq "RS") # Block indent start - { - if ($indentLevel==0 && $indent[0]==0) - { - blockquote(); - } - else - { - $indent = $p[1]; - $indent = $prevailingIndent unless ($indent); - if ($indent > $indent[$indentLevel] && !$extraIndent) - { - $extraIndent = 1; - ++$indentLevel; - $indent[$indentLevel] = 0; - setIndent($indent-$indent[$indentLevel-1]); - plainOutput("<TR><TD$width> </TD><TD>\n"); - $colState = 1; - } - elsif ($indent < $indent[$indentLevel] || $colState==2) - { - endRow(); - setIndent($indent); - plainOutput("<TR><TD$width> </TD><TD>\n"); - $colState = 1; - } - ++$indentLevel; - $indent[$indentLevel] = 0; - } - $prevailingIndent = 6; - } - elsif ($c eq "RE") # Block indent end - { - if ($extraIndent) - { - endRow(); - setIndent(0); - --$indentLevel; - $extraIndent = 0; - } - if ($indentLevel==0) - { - endParagraph(); - if ($blockquote>0) - { - plainOutput("</BLOCKQUOTE>\n"); - --$blockquote; - } - } - else - { - endRow(); - setIndent(0); - --$indentLevel; - } - $prevailingIndent = $indent[$indentLevel]; - $prevailingIndent = 6 unless($prevailingIndent); - } - elsif ($c eq "DT") # default tabs - { - @tabstops = (); - } - elsif ($c eq "ta") # Tab stops - { - @tabstops = (); - for ($i=0; $i<$#p; ++$i) - { - $ts = $p[$i+1]; - $tb = 0; - if ($ts =~ m/^\+/) - { - $tb = $tabstops[$i-1]; - $ts =~ s/^\+//; - } - $ts = evalnum($ts); - $tabstops[$i] = $tb + $ts; - } - plainOutput("<!-- Tabstops set at ".join(",", @tabstops)." -->\n") if ($debug); - } - elsif ($c eq "It") # List item (mdoc) - { - lineBreak(); - if ($docListStyle eq "-tag") - { - endRow() unless($multilineIt); - if ($tagWidth) - { - setIndent($tagWidth); - } - else - { - setIndent(6); - $width = ""; # let table take care of own width - } - if ($p[1] eq "Xo") - { - plainOutput("<TR valign=top><TD colspan=2>"); - } - else - { - $tag = &mdocStyle(@p[1..$#p]); - $body = lookahead(); - if ($body =~ m/^\.It/) - { $multilineItNext = 1; } - else - { $multilineItNext = 0; } - if ($multilineIt) - { - outputLine("<BR>\n$tag\n"); - } - elsif ($multilineItNext || $tagWidth>0 && width($tag)>$tagWidth) - { - outputLine("<TR valign=top><TD colspan=2>$tag\n"); - $colState = 2; - } - else - { - outputLine("<TR valign=top><TD>$tag\n"); - $colState = 1; - } - if ($multilineItNext) - { - $multilineIt = 1; - } - else - { - $multilineIt = 0; - if ($colState==2) - { plainOutput("</TD></TR><TR><TD> </TD><TD>\n"); } - else - { plainOutput("</TD><TD>\n"); } - } - } - } - else - { - plainOutput("<LI>"); - } - lineBreak(); - } - elsif ($c eq "Xc") - { - if ($docListStyle eq "-tag") - { - plainOutput("</TD></TR><TR><TD> </TD><TD>\n"); - } - } - elsif ($c eq "Bl") # Begin list (mdoc) - { - push @docListStyles, $docListStyle; - if ($p[1] eq "-enum") - { - plainOutput("<OL>\n"); - $docListStyle = $p[1]; - } - elsif($p[1] eq "-bullet") - { - plainOutput("<UL>\n"); - $docListStyle = $p[1]; - } - else - { - $docListStyle = "-tag"; - if ($p[2] eq "-width") - { - $tagWidth = width($p[3]); - if ($tagWidth < 6) { $tagWidth = 6; } - } - else - { - $tagWidth = 0; - } - $multilineIt = 0; - } - } - elsif ($c eq "El") # End list - { - if ($docListStyle eq "-tag") - { - endRow(); - setIndent(0); - } - elsif ($docListStyle eq "-bullet") - { - plainOutput("</UL>\n"); - } - else - { - plainOutput("</OL>\n"); - } - $docListStyle = pop @docListStyles; - } - elsif ($c eq "Os") - { - $right = $joined; - } - elsif ($c eq "Dd") - { - $left = $joined; - } - elsif ($c eq "Sx") # See section - { - $id = $contents{"\U$joined"}; - if ($id && $joined =~ m/^[A-Z]/) - { - outputLine("<A HREF=#$id>".&mdocStyle(@p[1..$#p])."</A>\n"); - } - else - { - my $x = &mdocStyle(@p[1..$#p]); - $x =~ s/^ //; - outputLine($x."\n"); - } - } - elsif (&mdocCallable($c)) - { - my $x = &mdocStyle(@p); - $x =~ s/^ //; - outputLine($x."\n"); - } - elsif ($c eq "Bx") - { - outputLine("<I>BSD $joined</I>\n"); - } - elsif ($c eq "Ux") - { - outputLine("<I>Unix $joined</I>\n"); - } - elsif ($c eq "At") - { - outputLine("<I>AT&T $joined</I>\n"); - } - elsif ($c =~ m/[A-Z][a-z]/) # Unsupported doc directive - { - outputLine("<BR>.$c $joined\n"); - } - elsif ($c eq "") # Empty line (eg. troff comment) - { - $doneLine = 0; - } - else # Unsupported directive - { - # Unknown macros are ignored, and don't count as a line as far as trapLine goes - $doneLine = 0; - plainOutput("<!-- ignored unsupported tag .$c -->\n"); - } -} - -sub trapTP -{ - $lookaheadPtr = 0; - $body = lookahead(); - if ($body =~ m/^\.TP/) - { - consume(); - $trapLine = 1; # restore TP trap - $doneLine = 0; # don't count this line - plainOutput("<BR>\n"); - } - else - { - plainOutput("</TD><TD valign=bottom>\n"); - $colState = 1; - } - lineBreak(); -} - -sub trapHP -{ - $lookaheadPtr = 0; - $body = lookahead(); - if ($body =~ m/^\.([TH]P)/) - { - consume(); - # Restore appropriate type of trap - if ($1 eq "TP") - { - $trapLine = 1; - $doneLine = 0; # don't count this line - } - else - { - $trapOnBreak = 1; - } - plainOutput("<BR>\n"); - } - else - { - plainOutput("</TD></TR><TR valign=top><TD$width> </TD><TD>\n"); - $colState = 1; - } - lineBreak(); -} - -sub newParagraph -{ - $indent = $_[0]; - endRow(); - startRow($indent); -} - -sub startRow -{ - $indent = $_[0]; - $indent = $prevailingIndent unless ($indent); - $prevailingIndent = $indent; - setIndent($indent); - plainOutput( "<TR valign=top>" ); -} - -# End an existing HP/TP/IP/RS row -sub endRow -{ - if ($indent[$indentLevel] > 0) - { - lineBreak(); - plainOutput( "</TD></TR>\n" ); - } -} - -# Called when we output a line break tag. Only needs to be called once if -# calling plainOutput, but should call before and after if using outputLine. -sub lineBreak -{ - $needBreak = 0; - $textSinceBreak = 0; -} - -# Called to reset all indents and pending paragraphs (eg. at the start of -# a new top level section). -sub endParagraph -{ - ++$indentLevel; - while ($indentLevel > 0) - { - --$indentLevel; - if ($indent[$indentLevel] > 0) - { - endRow(); - setIndent(0); - } - } -} - -# Interpolate a number register (possibly autoincrementing) -sub numreg -{ - return 0 + $number{$_[0]}; -} - -# Evaluate a numeric expression -sub evalnum -{ - $n = $_[0]; - return "" if ($n eq ""); - if ($n =~ m/i$/) # inches - { - $n =~ s/i//; - $n *= 10; - } - return 0+$n; -} - -sub setIndent -{ - $tsb = $textSinceBreak; - $indent = evalnum($_[0]); - if ($indent==0 && $_[0] !~ m/^0/) - { - $indent = 6; - } - plainOutput("<!-- setIndent $indent, indent[$indentLevel] = $indent[$indentLevel] -->\n") if ($debug); - if ($indent[$indentLevel] != $indent) - { - lineBreak(); - if ($indent[$indentLevel] > 0) - { - plainOutput("<TR></TR>") unless ($noSpace); - plainOutput("</TABLE>"); - } - if ($indent > 0) - { - endNoFill(); - $border = ""; - $border = " border=1" if ($debug>2); - #plainOutput("<P>") unless ($indent[$indentLevel] > 0); - plainOutput("<TABLE$border"); - # Netscape bug, makes 2 cols same width? : plainOutput("<TABLE$border COLS=2"); - # Overcome some of the vagaries of Netscape tables - plainOutput(" width=100%") if ($indentLevel>0); - if ($noSpace) - { - plainOutput(" cellpadding=0 cellspacing=0>\n"); - } - else - { - plainOutput(" cellpadding=3>".($tsb ? "<!-- tsb: $tsb -->\n<TR></TR><TR></TR>\n" : "\n") ); - } - #$width = " width=".($indent*5); # causes text to be chopped if too big - $percent = $indent; - if ($indentLevel > 0) - { $percent = $indent * 100 / (100-$indentLevel[0]); } - $width = " width=$percent%"; - } - $indent[$indentLevel] = $indent; - } -} - -# Process mdoc style macros recursively, as one of the macro arguments -# may itself be the name of another macro to invoke. -sub mdocStyle -{ - return "" unless @_; - my ($tag, @param) = @_; - my ($rest, $term); - - # Don't format trailing punctuation - if ($param[$#param] =~ m/^[.,;:]$/) - { - $term = pop @param; - } - if ($param[$#param] =~ m/^[)\]]$/) - { - $term = (pop @param).$term; - } - - if ($param[0] =~ m,\\\\,) - { - print STDERR "$tag: ",join(",", @param),"\n"; - } - $rest = &mdocStyle(@param); - - if ($tag eq "Op") - { - $rest =~ s/ //; # remove first space - return " \\fP[$rest]$term"; - } - elsif ($tag eq "Xr") # cross reference - { - my $p = shift @param; - my $url = $p; - if (@param==1) - { - $url .= ".".$param[0]; - $rest = "(".$param[0].")"; - } - else - { - $rest = &mdocStyle(@param); - } - if ($cmdLineMode) - { - return " <B>".$p."</B>".$rest.$term; - } - else - { - return " <A HREF=\"".$root."/".$url."\">".$p."</A>".$rest.$term; - } - } - elsif ($tag eq "Fl") - { - my ($sofar); - while (@param) - { - $f = shift @param; - if ($f eq "Ns") # no space - { - chop $sofar; - } - elsif (&mdocCallable($f)) - { - unshift @param, $f; - return $sofar.&mdocStyle(@param).$term; - } - else - { - $sofar .= "-<B>$f</B> " - } - } - return $sofar.$term; - } - elsif ($tag eq "Pa" || $tag eq "Er" || $tag eq "Fn" || $tag eq "Dv") - { - return "\\fC$rest\\fP$term"; - } - elsif ($tag eq "Ad" || $tag eq "Ar" || $tag eq "Em" || $tag eq "Fa" || $tag eq "St" || - $tag eq "Ft" || $tag eq "Va" || $tag eq "Ev" || $tag eq "Tn" || $tag eq "%T") - { - return "\\fI$rest\\fP$term"; - } - elsif ($tag eq "Nm") - { - $defaultNm = $param[0] unless ($defaultNm); - $rest = $defaultNm unless ($param[0]); - return "\\fB$rest\\fP$term"; - } - elsif ($tag eq "Ic" || $tag eq "Cm" || $tag eq "Sy") - { - return "\\fB$rest\\fP$term"; - } - elsif ($tag eq "Ta") # Tab - { - # Tabs are used inconsistently so this is the best we can do. Columns won't line up. Tough. - return " $rest$term"; - } - elsif ($tag eq "Ql") - { - $rest =~ s/ //; - return "`<TT>$rest</TT>'$term"; - } - elsif ($tag eq "Dl") - { - return "<P> <TT>$rest</TT>$term<P>\n"; - } - elsif ($tag =~ m/^[ABDEOPQS][qoc]$/) - { - $lq = ""; - $rq = ""; - if ($tag =~ m/^A/) - { $lq = "<"; $rq = ">"; } - elsif ($tag =~ m/^B/) - { $lq = "["; $rq = "]"; } - elsif ($tag =~ m/^D/) - { $lq = "\""; $rq = "\""; } - elsif ($tag =~ m/^P/) - { $lq = "("; $rq = ")"; } - elsif ($tag =~ m/^Q/) - { $lq = "\""; $rq = "\""; } - elsif ($tag =~ m/^S/) - { $lq = "\\'"; $rq = "\\'"; } - elsif ($tag =~ m/^O/) - { $lq = "["; $rq = "]"; } - if ($tag =~ m/^.o/) - { $rq = ""; } - if ($tag =~ m/^.c/) - { $lq = ""; } - $rest =~ s/ //; - return $lq.$rest.$rq.$term ; - } - elsif (&mdocCallable($tag)) # but not in list above... - { - return $rest.$term; - } - elsif ($tag =~ m/^[.,;:()\[\]]$/) # punctuation - { - return $tag.$rest.$term; - } - elsif ($tag eq "Ns") - { - return $rest.$term; - } - else - { - return " ".$tag.$rest.$term; - } -} - -# Determine if a macro is mdoc parseable/callable -sub mdocCallable -{ - return ($_[0] =~ m/^(Op|Fl|Pa|Er|Fn|Ns|No|Ad|Ar|Xr|Em|Fa|Ft|St|Ic|Cm|Va|Sy|Nm|Li|Dv|Ev|Tn|Pf|Dl|%T|Ta|Ql|[ABDEOPQS][qoc])$/); -} - - -# Estimate the output width of a string -sub width -{ - local($word) = $_[0]; - $word =~ s,<[/A-Z][^>]*>,,g; # remove any html tags - $word =~ s/^\.\S+\s//; - $word =~ s/\\..//g; - $x = length($word); - $word =~ s/[ ()|.,!;:"']//g; # width of punctuation is about half a character - return ($x + length($word)) / 2; -} - -# Process a tbl table (between TS/TE tags) -sub processTable -{ - if ($troffTable == "1") - { - @troffRowDefs = (); - @tableRows = (); - $hadUnderscore = 0; - while(1) - { - outputOrigLine(); - if (m/;\s*$/) - { - $troffSeparator = quotemeta($1) if (m/tab\s*\((.)\)/); - } - else - { - s/\.\s*$//; - s/\t/ /g; - s/^[^lrcan^t]*//; # remove any 'modifiers' coming before tag - # delimit on tags excluding s (viewed as modifier of previous column) - s/([lrcan^t])/\t$1/g; - s/^\t//; - push @troffRowDefs, $_; - last if ($origLine =~ m/\.\s*$/); - } - $_ = getLine(); - preProcessLine(); - } - $troffTable = 2; - return; - } - - s/$troffSeparator/\t/g; - if ($_ eq ".TE") - { - endTblRow(); - flushTable(); - $troffTable = 0; - plainOutput("</TABLE></BLOCKQUOTE>\n"); - } - elsif ($_ eq ".T&") - { - endTblRow(); - flushTable(); - $troffTable = 1; - } - elsif (m/[_=]/ && m/^[_=\t]*$/ && $troffCol==0) - { - if (m/^[_=]$/) - { - flushTable(); - plainOutput("<TR></TR><TR></TR>\n"); - $hadUnderscore = 1; - } - elsif ($troffCol==0 && @troffRowDefs) - { - # Don't output a row, but this counts as a row as far as row defs go - $rowDef = shift @troffRowDefs; - @troffColDefs = split(/\t/, $rowDef); - } - } - elsif (m/^\.sp/ && $troffCol==0 && !$hadUnderscore) - { - flushTable(); - plainOutput("<TR></TR><TR></TR>\n"); - } - elsif ($_ eq ".br" && $troffMultiline) - { - $rowref->[$troffCol] .= "<BR>\n"; - } - elsif ($_ !~ m/^\./) - { - $rowref = $tableRows[$#tableRows]; # reference to current row (last row in array) - if ($troffCol==0 && @troffRowDefs) - { - $rowDef = shift @troffRowDefs; - if ($rowDef =~ m/^[_=]/) - { - $xxx = $_; - flushTable(); - plainOutput("<TR></TR><TR></TR>\n"); - $hadUnderscore = 1; - $_ = $xxx; - $rowDef = shift @troffRowDefs; - } - @troffColDefs = split(/\t/, $rowDef); - } - - if ($troffCol == 0 && !$troffMultiline) - { - $rowref = []; - push(@tableRows, $rowref); - #plainOutput("<TR valign=top>"); - } - - #{ - if (m/T}/) - { - $troffMultiline = 0; - } - if ($troffMultiline) - { - $rowref->[$troffCol] .= "$_\n"; - return; - } - - @columns = split(/\t/, $_); - plainOutput("<!-- Adding (".join(",", @columns)."), type (".join(",", @troffColDefs).") -->\n") if ($debug); - while ($troffCol <= $#troffColDefs && @columns > 0) - { - $def = $troffColDefs[$troffCol]; - $col = shift @columns; - $col =~ s/\s*$//; - $align = ""; - $col = "\\^" if ($col eq "" && $def =~ m/\^/); - $col = " " if ($col eq ""); - $style1 = ""; - $style2 = ""; - if ($col ne "\\^") - { - if ($def =~ m/[bB]/ || $def =~ m/f3/) - { $style1 = "\\fB"; $style2 = "\\fP"; } - if ($def =~ m/I/ || $def =~ m/f2/) - { $style1 = "\\fI"; $style2 = "\\fP"; } - } - if ($def =~ m/c/) { $align = " align=center"; } - if ($def =~ m/[rn]/) { $align = " align=right"; } - $span = $def; - $span =~ s/[^s]//g; - if ($span) { $align.= " colspan=".(length($span)+1); } - - #{ - if ($col =~ m/T}/) - { - $rowref->[$troffCol] .= "$style2</TD>"; - ++$troffCol; - } - elsif ($col =~ m/T\{/) #} - { - $col =~ s/T\{//; #} - $rowref->[$troffCol] = "<TD$align>$style1$col"; - $troffMultiline = 1; - } - else - { - $rowref->[$troffCol] = "<TD$align>$style1$col$style2</TD>"; - ++$troffCol; - } - } - - endTblRow() unless ($troffMultiline); - } -} - -sub endTblRow -{ - return if ($troffCol == 0); - while ($troffCol <= $#troffColDefs) - { - $rowref->[$troffCol] = "<TD> </TD>"; - #print OUT "<TD> </TD>"; - ++$troffCol; - } - $troffCol = 0; - #print OUT "</TR>\n" -} - -sub flushTable -{ - plainOutput("<!-- flushTable $#tableRows rows -->\n") if ($debug); - - # Treat rows with first cell blank or with more than one vertically - # spanned row as a continuation of the previous line. - # Note this is frequently a useful heuristic but isn't foolproof. - for($r=0; $r<$#tableRows; ++$r) - { - $vspans = 0; - for ($c=0; $c<=$#{$tableRows[$r+1]}; ++$c) - {++$vspans if ($tableRows[$r+1][$c] =~ m,<TD.*?>\\\^</TD>,);} - if ((($vspans>1) || ($tableRows[$r+1][0] =~ m,<TD.*?> </TD>,)) && - $#{$tableRows[$r]} == $#{$tableRows[$r+1]} && 0) - { - if ($debug) - { - plainOutput("<!-- merging row $r+1 into previous -->\n"); - plainOutput("<!-- row $r: (".join(",", @{$tableRows[$r]}).") -->\n"); - plainOutput("<!-- row $r+1: (".join(",", @{$tableRows[$r+1]}).") -->\n"); - } - for ($c=0; $c<=$#{$tableRows[$r]}; ++$c) - { - $tableRows[$r][$c] .= $tableRows[$r+1][$c]; - $tableRows[$r][$c] =~ s,\\\^,,g; # merging is stronger than spanning! - $tableRows[$r][$c] =~ s,</TD><TD.*?>,<BR>,; - } - @tableRows = (@tableRows[0..$r], @tableRows[$r+2 .. $#tableRows]); - --$r; # process again - } - } - - # Turn \^ vertical span requests into rowspan tags - for($r=0; $r<$#tableRows; ++$r) - { - for ($c=0; $c<=$#{$tableRows[$r]}; ++$c) - { - $r2 = $r+1; - while ( $r2<=$#tableRows && ($tableRows[$r2][$c] =~ m,<TD.*?>\\\^</TD>,) ) - { - ++$r2; - } - $rs = $r2-$r; - if ($rs > 1) - { - plainOutput("<!-- spanning from $r,$c -->\n") if ($debug); - $tableRows[$r][$c] =~ s/<TD/<TD rowspan=$rs/; - } - } - } - - # As tbl and html differ in whether they expect spanned cells to be - # supplied, remove any cells that are 'rowspanned into'. - for($r=0; $r<=$#tableRows; ++$r) - { - for ($c=$#{$tableRows[$r]}; $c>=0; --$c) - { - if ($tableRows[$r][$c] =~ m/<TD rowspan=(\d+)/) - { - for ($r2=$r+1; $r2<$r+$1; ++$r2) - { - $rowref = $tableRows[$r2]; - plainOutput("<!-- removing $r2,$c: ".$rowref->[$c]." -->\n") if ($debug); - @$rowref = (@{$rowref}[0..$c-1], @{$rowref}[$c+1..$#$rowref]); - } - } - } - } - - # Finally, output the cells that are left - for($r=0; $r<=$#tableRows; ++$r) - { - plainOutput("<TR valign=top>\n"); - for ($c=0; $c <= $#{$tableRows[$r]}; ++$c) - { - outputLine($tableRows[$r][$c]); - } - plainOutput("</TR>\n"); - } - @tableRows = (); - $troffCol = 0; - plainOutput("<!-- flushTable done -->\n") if ($debug); -} - - -# Use these for all font changes, including .ft, .ps, .B, .BI, .SM etc. -# Need to add a mechanism to stack up these changes so tags match: <X> <Y> ... </Y> </X> etc. - -sub pushStyle -{ - $result = ""; - $type = $_[0]; - $tag = $_[1]; - print OUT "<!-- pushStyle $type($tag) [".join(",", @styleStack)."] " if ($debug>1); - @oldItems = (); - if (grep(m/^$type/, @styleStack)) - { - print OUT "undoing up to old $type " if ($debug>1); - while (@styleStack) - { - # search back, undoing intervening tags in reverse order - $oldItem = pop @styleStack; - ($oldTag) = ($oldItem =~ m/^.(\S+)/); - $result .= "</$oldTag>"; - if (substr($oldItem,0,1) eq $type) - { - print OUT "found $oldItem " if ($debug>1); - while (@oldItems) - { - # restore the intermediates again - $oldItem = shift @oldItems; - push(@styleStack, $oldItem); - $result .= "<".substr($oldItem,1).">"; - } - last; - } - else - { - unshift(@oldItems, $oldItem); - } - } - } - print OUT "oldItems=(@oldItems) " if ($debug>1); - push(@styleStack, @oldItems); # if we didn't find anything of type - if ($tag) - { - $result .= "<$tag>"; - push(@styleStack, $type.$tag); - } - print OUT "-> '$result' -->\n" if ($debug>1); - return $result; -} - -sub resetStyles -{ - if (@styleStack) - { - print OUT "<!-- resetStyles [".join(",", @styleStack)."] -->\n"; - print OUT "<HR> resetStyles [".join(",", @styleStack)."] <HR>\n" if ($debug); - } - while (@styleStack) - { - $oldItem = pop @styleStack; - ($oldTag) = ($oldItem =~ m/^.(\S+)/); - print OUT "</$oldTag>"; - } - $currentSize = 0; - $currentShift = 0; -} - -sub blockquote -{ - print OUT "<BLOCKQUOTE>\n"; - ++$blockquote; -} - -sub endBlockquote -{ - resetStyles(); - while ($blockquote > 0) - { - print OUT "</BLOCKQUOTE>\n"; - --$blockquote; - } -} - -sub indent -{ - plainOutput(pushStyle("I", "TABLE")); - $width = $_[0]; - $width = " width=$width%" if ($width); - plainOutput("<TR><TD$width> </TD><TD>\n"); -} - -sub outdent -{ - plainOutput("</TD></TR>\n"); - plainOutput(pushStyle("I")); -} - -sub inlineStyle -{ - $_[0] =~ m/^(.)(.*)$/; - if ($1 eq "f") - { fontChange($2); } - elsif ($1 eq "s" && ! $noFill) - { sizeChange($2); } - else - { superSub($1); } -} - -sub fontChange -{ - $fnt = $_[0]; - $fnt =~ s/^\(//; - - if ($fnt eq "P" || $fnt eq "R" || $fnt eq "1" || $fnt eq "") - { $font = ""; } - elsif ($fnt eq "B" || $fnt eq "3") - { $font = "B"; } - elsif ($fnt eq "I" || $fnt eq "2") - { $font = "I"; } - else - { $font = "TT"; } - return pushStyle("F", $font); -} - -sub sizeChange -{ - $size= $_[0]; - if ($size =~ m/^[+-]/) - { $currentSize += $size; } - else - { $currentSize = $size-10; } - $currentSize = 0 if (! $size); - - $sz = $currentSize; - $sz = -2 if ($sz < -2); - $sz = 2 if ($sz > 2); - - if ($currentSize eq "0") - { $size = ""; } - else - { $size = "FONT size=$sz"; } - return pushStyle("S", $size); -} - -sub superSub -{ - $sub = $_[0]; - ++$currentShift if ($sub eq "u"); - --$currentShift if ($sub eq "d"); - $tag = ""; - $tag = "SUP" if ($currentShift > 0); - $tag = "SUB" if ($currentShift < 0); - return pushStyle("D", $tag); -} - -sub startNoFill -{ - print OUT "<PRE>\n" unless($noFill); - $noFill = 1; -} - -sub endNoFill -{ - print OUT "</PRE>\n" if ($noFill); - $noFill = 0; -} - - -sub processEqns -{ - if ($eqnMode==2 && $_[0] =~ m/^\.EN/) - { - $eqnMode = 0; - outputLine(flushEqn()); - plainOutput("\n"); - return; - } - $eqnBuffer .= $_[0]." "; -} - -sub processEqnd -{ - processEqns(@_); - return flushEqn(); -} - -sub flushEqn -{ - @p = grep($_ !~ m/^ *$/, split(/("[^"]*"|\s+|[{}~^])/, $eqnBuffer) ); - $eqnBuffer = ""; - #return "[".join(',', @p)." -> ".&doEqn(@p)."]\n"; - $res = &doEqn(@p); - #$res =~ s,\\\((..),$special{$1}||"\\($1",ge; - #$res =~ s,<,<,g; - #$res =~ s,>,>,g; - return $res; -} - -sub doEqn -{ - my @p = @_; - my $result = ""; - my $res; - my $c; - while (@p) - { - ($res, @p) = doEqn1(@p); - $result .= $res; - } - return $result; -} - -sub doEqn1 -{ - my @p = @_; - my $res = ""; - my $c; - - $c = shift @p; - if ($eqndefs{$c}) - { - @x = split(/\0/, $eqndefs{$c}); - unshift @p, @x; - $c = shift @p; - } - if ($c =~ m/^"(.*)"$/) - { - $res = $1; - } - elsif ($c eq "delim") - { - $c = shift @p; - if ($c eq "off") - { - $eqnStart = ""; - $eqnEnd = ""; - } - else - { - $c =~ m/^(.)(.)/; - $eqnStart = quotemeta($1); - $eqnEnd = quotemeta($2); - } - } - elsif ($c eq "define" || $c eq "tdefine" || $c eq "ndefine") - { - $t = shift @p; - $d = shift @p; - $def = ""; - if (length($d) != 1) - { - $def = $d; - $def =~ s/^.(.*)./\1/; - } - else - { - while (@p && $p[0] ne $d) - { - $def .= shift @p; - $def .= "\0"; - } - chop $def; - shift @p; - } - $eqndefs{$t} = $def unless ($c eq "ndefine"); - } - elsif ($c eq "{") - { - my $level = 1; - my $i; - for ($i=0; $i<=$#p; ++$i) - { - ++$level if ($p[$i] eq "{"); - --$level if ($p[$i] eq "}"); - last if ($level==0); - } - $res = doEqn(@p[0..$i-1]); - @p = @p[$i+1..$#p]; - } - elsif ($c eq "sup") - { - ($c,@p) = &doEqn1(@p); - $res = "\\u$c\\d"; - } - elsif ($c eq "to") - { - ($c,@p) = &doEqn1(@p); - $res = "\\u$c\\d "; - } - elsif ($c eq "sub" || $c eq "from") - { - ($c,@p) = &doEqn1(@p); - $res = "\\d$c\\u"; - } - elsif ($c eq "matrix") - { - ($c,@p) = &doEqn1(@p); - $res = "matrix ( $c )"; - } - elsif ($c eq "bold") - { - ($c,@p) = &doEqn1(@p); - $res = "\\fB$c\\fP"; - } - elsif ($c eq "italic") - { - ($c,@p) = &doEqn1(@p); - $res = "\\fI$c\\fP"; - } - elsif ($c eq "roman") - { - } - elsif ($c eq "font" || $c eq "gfont" || $c eq "size" || $c eq "gsize") - { - shift @p; - } - elsif ($c eq "mark" || $c eq "lineup") - { - } - elsif ($c eq "~" || $c eq "^") - { - $res = " "; - } - elsif ($c eq "over") - { - $res = " / "; - } - elsif ($c eq "half") - { - $res = "\\(12"; - } - elsif ($c eq "prime") - { - $res = "\\' "; - } - elsif ($c eq "dot") - { - $res = "\\u.\\d "; - } - elsif ($c eq "dotdot") - { - $res = "\\u..\\d "; - } - elsif ($c eq "tilde") - { - $res = "\\u~\\d "; - } - elsif ($c eq "hat") - { - $res = "\\u^\\d "; - } - elsif ($c eq "bar" || $c eq "vec") - { - $res = "\\(rn "; - } - elsif ($c eq "under") - { - $res = "_ "; - } - elsif ( $c eq "sqrt" || $c eq "lim" || $c eq "sum" || $c eq "pile" || $c eq "lpile" || - $c eq "rpile" || $c eq "cpile" || $c eq "int" || $c eq "prod" ) - { - $res = " $c "; - } - elsif ($c eq "cdot") - { - $res = " . "; - } - elsif ($c eq "inf") - { - $res = "\\(if"; - } - elsif ($c eq "above" || $c eq "lcol" || $c eq "ccol") - { - $res = " "; - } - elsif ($c eq "sin" || $c eq "cos" || $c eq "tan" || $c eq "log" || $c eq "ln" ) - { - $res = " $c "; - } - elsif ($c eq "left" || $c eq "right" || $c eq "nothing") - { - } - elsif ($c =~ m/^[A-Za-z]/) - { - $res = "\\fI$c\\fP"; - } - else - { - $res = $c; - } - - return ($res, @p); -} - -##### Search manpath and initialise special char array ##### - -sub initialise -{ - # Determine groff version if possible - my $groffver = `groff -v`; - $groffver =~ /^GNU groff version (\S+)/; - $groffver = $1; - - # Parse the macro definition file for section names - if (open(MACRO, "/usr/lib/tmac/tmac.an") || - open(MACRO, "/usr/lib/tmac/an") || - open(MACRO, "/usr/lib/groff/tmac/tmac.an") || - open(MACRO, "/usr/lib/groff/tmac/an.tmac") || - open(MACRO, "/usr/share/tmac/tmac.an") || - open(MACRO, "/usr/share/tmac/an.tmac") || - open(MACRO, "/usr/share/groff/tmac/tmac.an") || - open(MACRO, "/usr/share/groff/tmac/an.tmac") || - open(MACRO, "/usr/share/groff/$groffver/tmac/an.tmac") ) - { - while (<MACRO>) - { - chop; - if (m/\$2'([0-9a-zA-Z]+)' .ds ]D (.*)$/) - { - $sn = $2; - unless ($sn =~ m/[a-z]/) - { - $sn = "\u\L$sn"; - $sn =~ s/ (.)/ \u\1/g; - } - $sectionName{"\L$1"} = $sn; - } - if (m/\$1'([^']+)' .ds Tx "?(.*)$/) - { - $title{"$1"} = $2; - } - if (m/^.ds ]W (.*)$/) - { - $osver = $1; - } - } - } - else - { - print STDERR "Failed to read tmac.an definitions\n" unless ($cgiMode); - } - if (open(MACRO, "/usr/lib/tmac/tz.map")) - { - while (<MACRO>) - { - chop; - if (m/\$1'([^']+)' .ds Tz "?(.*)$/) - { - $title{"$1"} = $2; - } - } - } - - # Prevent redefinition of macros that have special meaning to us - $reservedMacros = '^(SH|SS|Sh|Ss)$'; - - # Predefine special number registers - $number{'.l'} = 75; - - # String variables defined by man package - $vars{'lq'} = '“'; - $vars{'rq'} = '”'; - $vars{'R'} = '\\(rg'; - $vars{'S'} = '\\s0'; - - # String variables defined by mdoc package - $vars{'Le'} = '\\(<='; - $vars{'<='} = '\\(<='; - $vars{'Ge'} = '\\(>='; - $vars{'Lt'} = '<'; - $vars{'Gt'} = '>'; - $vars{'Ne'} = '\\(!='; - $vars{'>='} = '\\(>='; - $vars{'q'} = '"'; # see also special case in preProcessLine - $vars{'Lq'} = '“'; - $vars{'Rq'} = '”'; - $vars{'ua'} = '\\(ua'; - $vars{'ga'} = '\\(ga'; - $vars{'Pi'} = '\\(*p'; - $vars{'Pm'} = '\\(+-'; - $vars{'Na'} = 'NaN'; - $vars{'If'} = '\\(if'; - $vars{'Ba'} = '|'; - - # String variables defined by ms package (access to accented characters) - $vars{'bu'} = '»'; - $vars{'66'} = '“'; - $vars{'99'} = '”'; - $vars{'*!'} = '¡'; - $vars{'ct'} = '¢'; - $vars{'po'} = '£'; - $vars{'gc'} = '¤'; - $vars{'ye'} = '¥'; - #$vars{'??'} = '¦'; - $vars{'sc'} = '§'; - $vars{'*:'} = '¨'; - $vars{'co'} = '©'; - $vars{'_a'} = 'ª'; - $vars{'<<'} = '«'; - $vars{'no'} = '¬'; - $vars{'hy'} = '­'; - $vars{'rg'} = '®'; - $vars{'ba'} = '¯'; - $vars{'de'} = '°'; - $vars{'pm'} = '±'; - #$vars{'??'} = '²'; - #$vars{'??'} = '³'; - $vars{'aa'} = '´'; - $vars{'mu'} = 'µ'; - $vars{'pg'} = '¶'; - $vars{'c.'} = '·'; - $vars{'cd'} = '¸'; - #$vars{'??'} = '¹'; - $vars{'_o'} = 'º'; - $vars{'>>'} = '»'; - $vars{'14'} = '¼'; - $vars{'12'} = '½'; - #$vars{'??'} = '¾'; - $vars{'*?'} = '¿'; - $vars{'`A'} = 'À'; - $vars{"'A"} = 'Á'; - $vars{'^A'} = 'Â'; - $vars{'~A'} = 'Ã'; - $vars{':A'} = 'Ä'; - $vars{'oA'} = 'Å'; - $vars{'AE'} = 'Æ'; - $vars{',C'} = 'Ç'; - $vars{'`E'} = 'È'; - $vars{"'E"} = 'É'; - $vars{'^E'} = 'Ê'; - $vars{':E'} = 'Ë'; - $vars{'`I'} = 'Ì'; - $vars{"'I"} = 'Í'; - $vars{'^I'} = 'Î'; - $vars{':I'} = 'Ï'; - $vars{'-D'} = 'Ð'; - $vars{'~N'} = 'Ñ'; - $vars{'`O'} = 'Ò'; - $vars{"'O"} = 'Ó'; - $vars{'^O'} = 'Ô'; - $vars{'~O'} = 'Õ'; - $vars{':O'} = 'Ö'; - #$vars{'mu'} = '×'; - $vars{'NU'} = 'Ø'; - $vars{'`U'} = 'Ù'; - $vars{"'U"} = 'Ú'; - $vars{'^U'} = 'Û'; - $vars{':U'} = 'Ü'; - #$vars{'??'} = 'Ý'; - $vars{'Th'} = 'Þ'; - $vars{'*b'} = 'ß'; - $vars{'`a'} = 'à'; - $vars{"'a"} = 'á'; - $vars{'^a'} = 'â'; - $vars{'~a'} = 'ã'; - $vars{':a'} = 'ä'; - $vars{'oa'} = 'å'; - $vars{'ae'} = 'æ'; - $vars{',c'} = 'ç'; - $vars{'`e'} = 'è'; - $vars{"'e"} = 'é'; - $vars{'^e'} = 'ê'; - $vars{':e'} = 'ë'; - $vars{'`i'} = 'ì'; - $vars{"'i"} = 'í'; - $vars{'^i'} = 'î'; - $vars{':i'} = 'ï'; - #$vars{'??'} = 'ð'; - $vars{'~n'} = 'ñ'; - $vars{'`o'} = 'ò'; - $vars{"'o"} = 'ó'; - $vars{'^o'} = 'ô'; - $vars{'~o'} = 'õ'; - $vars{':o'} = 'ö'; - $vars{'di'} = '÷'; - $vars{'nu'} = 'ø'; - $vars{'`u'} = 'ù'; - $vars{"'u"} = 'ú'; - $vars{'^u'} = 'û'; - $vars{':u'} = 'ü'; - #$vars{'??'} = 'ý'; - $vars{'th'} = 'þ'; - $vars{':y'} = 'ÿ'; - - # troff special characters and their closest equivalent - - $special{'em'} = '—'; - $special{'hy'} = '-'; - $special{'\-'} = '–'; # was - - $special{'bu'} = 'o'; - $special{'sq'} = '[]'; - $special{'ru'} = '_'; - $special{'14'} = '¼'; - $special{'12'} = '½'; - $special{'34'} = '¾'; - $special{'fi'} = 'fi'; - $special{'fl'} = 'fl'; - $special{'ff'} = 'ff'; - $special{'Fi'} = 'ffi'; - $special{'Fl'} = 'ffl'; - $special{'de'} = '°'; - $special{'dg'} = '†'; # was 182, para symbol - $special{'fm'} = "\\'"; - $special{'ct'} = '¢'; - $special{'rg'} = '®'; - $special{'co'} = '©'; - $special{'pl'} = '+'; - $special{'mi'} = '-'; - $special{'eq'} = '='; - $special{'**'} = '*'; - $special{'sc'} = '§'; - $special{'aa'} = '´'; # was ' - $special{'ga'} = '`'; # was ` - $special{'ul'} = '_'; - $special{'sl'} = '/'; - $special{'*a'} = 'a'; - $special{'*b'} = 'ß'; - $special{'*g'} = 'y'; - $special{'*d'} = 'd'; - $special{'*e'} = 'e'; - $special{'*z'} = 'z'; - $special{'*y'} = 'n'; - $special{'*h'} = 'th'; - $special{'*i'} = 'i'; - $special{'*k'} = 'k'; - $special{'*l'} = 'l'; - $special{'*m'} = 'µ'; - $special{'*n'} = 'v'; - $special{'*c'} = '3'; - $special{'*o'} = 'o'; - $special{'*p'} = 'pi'; - $special{'*r'} = 'p'; - $special{'*s'} = 's'; - $special{'*t'} = 't'; - $special{'*u'} = 'u'; - $special{'*f'} = 'ph'; - $special{'*x'} = 'x'; - $special{'*q'} = 'ps'; - $special{'*w'} = 'o'; - $special{'*A'} = 'A'; - $special{'*B'} = 'B'; - $special{'*G'} = '|\\u_\\d'; - $special{'*D'} = '/\'; - $special{'*E'} = 'E'; - $special{'*Z'} = 'Z'; - $special{'*Y'} = 'H'; - $special{'*H'} = 'TH'; - $special{'*I'} = 'I'; - $special{'*K'} = 'K'; - $special{'*L'} = 'L'; - $special{'*M'} = 'M'; - $special{'*N'} = 'N'; - $special{'*C'} = 'Z'; - $special{'*O'} = 'O'; - $special{'*P'} = '||'; - $special{'*R'} = 'P'; - $special{'*S'} = 'S'; - $special{'*T'} = 'T'; - $special{'*U'} = 'Y'; - $special{'*F'} = 'PH'; - $special{'*X'} = 'X'; - $special{'*Q'} = 'PS'; - $special{'*W'} = 'O'; - $special{'ts'} = 's'; - $special{'sr'} = 'v/'; - $special{'rn'} = '\\u–\\d'; # was 175 - $special{'>='} = '>='; - $special{'<='} = '<='; - $special{'=='} = '=='; - $special{'~='} = '~='; - $special{'ap'} = '~'; # was ~ - $special{'!='} = '!='; - $special{'->'} = '->'; - $special{'<-'} = '<-'; - $special{'ua'} = '^'; - $special{'da'} = 'v'; - $special{'mu'} = '×'; - $special{'di'} = '÷'; - $special{'+-'} = '±'; - $special{'cu'} = 'U'; - $special{'ca'} = '^'; - $special{'sb'} = '('; - $special{'sp'} = ')'; - $special{'ib'} = '(='; - $special{'ip'} = '=)'; - $special{'if'} = 'oo'; - $special{'pd'} = '6'; - $special{'gr'} = 'V'; - $special{'no'} = '¬'; - $special{'is'} = 'I'; - $special{'pt'} = '~'; - $special{'es'} = 'Ø'; - $special{'mo'} = 'e'; - $special{'br'} = '|'; - $special{'dd'} = '‡'; # was 165, yen - $special{'rh'} = '=>'; - $special{'lh'} = '<='; - $special{'or'} = '|'; - $special{'ci'} = 'O'; - $special{'lt'} = '('; - $special{'lb'} = '('; - $special{'rt'} = ')'; - $special{'rb'} = ')'; - $special{'lk'} = '|'; - $special{'rk'} = '|'; - $special{'bv'} = '|'; - $special{'lf'} = '|'; - $special{'rf'} = '|'; - $special{'lc'} = '|'; - $special{'rc'} = '|'; - - # Not true troff characters but very common typos - $special{'cp'} = '©'; - $special{'tm'} = '®'; - $special{'en'} = '-'; - - # Build a list of directories containing man pages - @manpath = (); - if (open(MPC, "/etc/manpath.config") || open(MPC, "/etc/man.config")) - { - while (<MPC>) - { - if (m/^(MANDB_MAP|MANPATH)\s+(\S+)/) - { - push(@manpath, $2); - } - } - } - @manpath = split(/:/, $ENV{'MANPATH'}) unless (@manpath); - @manpath = ("/usr/man") unless (@manpath); -} - -# Search through @manpath and construct @mandirs (non-empty subsections) -sub loadManDirs -{ - return if (@mandirs); - print STDERR "Searching ",join(":", @manpath)," for mandirs\n" unless($cgiMode); - foreach $tld (@manpath) - { - $tld =~ m/^(.*)$/; - $tld = $1; # untaint manpath - if (opendir(DIR, $tld)) - { - # foreach $d (<$tld/man[0-9a-z]*>) - foreach $d (sort readdir(DIR)) - { - if ($d =~ m/^man\w/ && -d "$tld/$d") - { - push (@mandirs, "$tld/$d"); - } - } - closedir DIR; - } - } -} - -##### Utility to search manpath for a given command ##### - -sub findPage -{ - $request = $_[0]; - $request =~ s,^/,,; - @multipleMatches = (); - - $file = $_[0]; - return $file if (-f $file || -f "$file.gz" || -f "$file.bz2"); - - # Search the path for the requested man page, which may be of the form: - # "/usr/man/man1/ls.1", "ls.1" or "ls". - ($page,$sect) = ($request =~ m/^(.+)\.([^.]+)$/); - $sect = "\L$sect"; - - # Search the specified section first (if specified) - if ($sect) - { - foreach $md (@manpath) - { - $dir = $md; - $file = "$dir/man$sect/$page.$sect"; - push(@multipleMatches, $file) if (-f $file || -f "$file.gz" || -f "$file.bz2"); - } - } - else - { - $page = $request; - } - if (@multipleMatches == 1) - { - return pop @multipleMatches; - } - - # If not found need to search through each directory - loadManDirs(); - foreach $dir (@mandirs) - { - ($s) = ($dir =~ m/man([0-9A-Za-z]+)$/); - $file = "$dir/$page.$s"; - push(@multipleMatches, $file) if (-f $file || -f "$file.gz" || -f "$file.bz2"); - $file = "$dir/$request"; - push(@multipleMatches, $file) if (-f $file || -f "$file.gz" || -f "$file.bz2"); - if ($sect && "$page.$sect" ne $request) - { - $file = "$dir/$page.$sect"; - push(@multipleMatches, $file) if (-f $file || -f "$file.gz" || -f "$file.bz2"); - } - } - if (@multipleMatches == 1) - { - return pop @multipleMatches; - } - if (@multipleMatches > 1) - { - return ""; - } - # Ok, didn't find it using section numbers. Perhaps there's a page with the - # right name but wrong section number lurking there somewhere. (This search is slow) - # eg. page.1x in man1 (not man1x) directory - foreach $dir (@mandirs) - { - opendir(DIR, $dir); - foreach $f (readdir DIR) - { - if ($f =~ m/^$page\./) - { - $f =~ s/\.(gz|bz2)$//; - push(@multipleMatches, "$dir/$f"); - } - } - } - if (@multipleMatches == 1) - { - return pop @multipleMatches; - } - return ""; -} - -sub loadPerlPages -{ - my ($dir,$f,$name,@files); - loadManDirs(); - return if (%perlPages); - foreach $dir (@mandirs) - { - if (opendir(DIR, $dir)) - { - @files = sort readdir DIR; - foreach $f (@files) - { - next if ($f eq "." || $f eq ".." || $f !~ m/\./); - next unless ("$dir/$f" =~ m/perl/); - $f =~ s/\.(gz|bz2)$//; - ($name) = ($f =~ m,(.+)\.[^.]*$,); - $perlPages{$name} = "$dir/$f"; - } - closedir DIR; - } - } - delete $perlPages{'perl'}; # too ubiquitous to be useful -} - -sub fmtTime -{ - my $time = $_[0]; - my @days = qw (Sun Mon Tue Wed Thu Fri Sat); - my @months = qw (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$istdst) = localtime($time); - return sprintf ("%s, %02d %s %4d %02d:%02d:%02d GMT", - $days[$wday],$mday,$months[$mon],1900+$year,$hour,$min,$sec); -} - diff --git a/dist-tools/shipper/COPYING b/dist-tools/shipper/COPYING deleted file mode 100644 index d60c31a9..00000000 --- a/dist-tools/shipper/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/dist-tools/shipper/Makefile b/dist-tools/shipper/Makefile deleted file mode 100644 index 1e6f6896..00000000 --- a/dist-tools/shipper/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# Makefile for the shipper project - -VERS=$(shell sed <shipper.spec -n -e '/Version: \(.*\)/s//\1/p') - -MANDIR=$(DESTDIR)/usr/share/man/man1 -BINDIR=$(DESTDIR)/usr/bin - -DOCS = README COPYING shipper.xml rpm2lsm.xml shipper.1 rpm2lsm.1 -SOURCES = shipper buildrpms rpm2lsm Makefile $(DOCS) shipper.spec - -all: shipper-$(VERS).tar.gz - -install: shipper.1 rpm2lsm.1 - cp shipper buildrpms rpm2lsm $(BINDIR) - gzip <shipper.1 >$(MANDIR)/shipper.1.gz - gzip <rpm2lsm.1 >$(MANDIR)/rpm2lsm.1.gz - -shipper.1: shipper.xml - xmlto man shipper.xml -shipper.html: shipper.xml - xmlto html-nochunks shipper.xml - -rpm2lsm.1: rpm2lsm.xml - xmlto man rpm2lsm.xml -rpm2lsm.html: rpm2lsm.xml - xmlto html-nochunks rpm2lsm.xml - -shipper-$(VERS).tar.gz: $(SOURCES) - @mkdir shipper-$(VERS) - @cp $(SOURCES) shipper-$(VERS) - @tar -czf shipper-$(VERS).tar.gz shipper-$(VERS) - @rm -fr shipper-$(VERS) - -dist: shipper-$(VERS).tar.gz - -release: shipper-$(VERS).tar.gz shipper.html rpm2lsm.html - shipper -f; rm CHANGES ANNOUNCE* *.html *.lsm *.1 - diff --git a/dist-tools/shipper/README b/dist-tools/shipper/README deleted file mode 100644 index c06f813a..00000000 --- a/dist-tools/shipper/README +++ /dev/null @@ -1,7 +0,0 @@ - README for shipper - -shipper automates the tedious process of shipping a software release to -several standard places, including ibiblio, the Red Hat submission directory, -and your own hosted website. It also knows how to post a release announcement -to freshmeat.net via freshmeat-submit. Two auxiliary tools, buildrpms and -rpm2lsm, build RPMs and generate LSM files from them respectively. diff --git a/dist-tools/shipper/buildrpms b/dist-tools/shipper/buildrpms deleted file mode 100755 index 11b3ddfd..00000000 --- a/dist-tools/shipper/buildrpms +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# -# Build RPMs from the source in the current directory. This script sets -# up an RPM "_topdir" and builds the RPMs under there, then copies the -# binary and source RPMs to the current directory. -# -# Written by Sean Reifschneider <jafo-rpms@tummy.com>, 2003 - -TARBALL=$1 # tarball to build from - -# set up temporary directory -TMPDIR=`pwd`/rpm-build.$$ -[ ! -z "$TMPDIR" -a "$TMPDIR" != / ] && rm -rf "$TMPDIR" -mkdir -p "$TMPDIR"/BUILD -mkdir -p "$TMPDIR"/RPMS -mkdir -p "$TMPDIR"/SOURCES -mkdir -p "$TMPDIR"/SPECS -mkdir -p "$TMPDIR"/SRPMS - -# set up rpmmacros file -MACROFILE="$TMPDIR"/rpmmacros -RCFILE="$TMPDIR"/rpmrc -sed "s|~/.rpmmacros|$MACROFILE|" /usr/lib/rpm/rpmrc >"$RCFILE" -echo "%_topdir $TMPDIR" >"$MACROFILE" -echo "%_topdir $TMPDIR" >"$MACROFILE" - -ARCH=--target=$(uname -m) - -# build RPMs -rpmbuild --rcfile "$RCFILE" $ARCH -ta $TARBALL \ -|| rpm --rcfile "$RCFILE" $ARCH -ta $TARBALL -status=$? - -if [ $status = '0' ] -then - # move RPMs to this directory - mv "$TMPDIR"/RPMS/*/*.rpm . - mv "$TMPDIR"/SRPMS/*.rpm . -fi - -# clean up build directory -[ ! -z "$TMPDIR" -a "$TMPDIR" != / ] && rm -rf "$TMPDIR" - -exit $status diff --git a/dist-tools/shipper/rpm2lsm b/dist-tools/shipper/rpm2lsm deleted file mode 100755 index 6a05d6c7..00000000 --- a/dist-tools/shipper/rpm2lsm +++ /dev/null @@ -1,108 +0,0 @@ -#/bin/sh -# -# rpm2lsm -- generate Linux Software Map file from RPM meta information -# -# Author: Eric S. Raymond <esr@thyrsus.com>, 31 July 2002 -# Project page: http://www.catb.org/~esr/ -# -# Requires fmt(1), awk(1), and rpm(8). - -while getopts a:m:k:p: c; -do - case $c in - 'a') author=$OPTARG;; - 'm') maintainer=$OPTARG;; - 'k') keywords=$OPTARG;; - 'p') platforms=$OPTARG;; - '?') echo "rpm2lsm: invalid switch specified - aborting."; exit 1;; - esac -done -shift `expr $OPTIND - 1` - -# If no RPM was given, look in the current directory and pick the last -# one in sort order. That's likely to be the most recent. -if [ -z "$1" ] -then - set -- *.rpm - while [ "$2" ] - do - shift - done -fi - -# Mine out all the single-token fields we'll need -rpm=$1 -set -- `rpm --queryformat="%{name} %{version} %{release}" -qp $rpm` -name=$1 -version=$2 -release=$3 - -# Extract and reformat the desciption -description=`rpm --queryformat="%{description}" -qp $rpm | fmt -w 65 | sed '2,$s/^/ /'` - -# Who am I? -fullname=`cat /etc/passwd | awk -F : "/^${USER}/ "'{print $5}'` -fullname="${USER}@${HOSTNAME} ($fullname)" - -if [ -z "$author" ] -then - if [ -f AUTHORS ] - then - author=`cat AUTHORS` - else - author=$fullname - fi -fi - -# Fill in keywords if present -if [ -n "$keywords" ] -then - keywords="Keywords: $keywords\n" -fi - -# Default the maintainer field properly -if [ -z "$maintainer" ] -then - maintainer=`rpm --queryformat="%{packager}" -qp $rpm` - if [ "$maintainer" = "(none)" ] - then - maintainer=$author - fi -fi - -# The date -date=`date '+%Y-%m-%d'` - -cat >/usr/tmp/rpm2lsm.$$ <<EOF -Begin3 -Title: %{name} -Version: %{version} -Entered-date: ${date} -Description: ${description} -${keywords}Author: ${author} -Maintained-by: ${maintainer} -Primary-site: %{url} -EOF - -# File patterns that we ship -tarballs="${name}-${version}.tar.gz ${name}-${version}.tgz" -rpms=${name}-${version}-${release}.*.rpm - -trap "rm -f /usr/tmp/rpm2lsm.$$" 0 2 15 -for file in $tarballs $rpms -do - if [ -f $file ] - then - set -- `du $file`; size=$1 - echo " ${size} ${file}" >>/usr/tmp/rpm2lsm.$$ - fi -done - -cat >>/usr/tmp/rpm2lsm.$$ <<EOF -Platforms: ${platforms:-All} -Copying-policy: %{license} -End -EOF - -format=`cat /usr/tmp/rpm2lsm.$$` -rpm --queryformat="$format" -qp $rpm diff --git a/dist-tools/shipper/rpm2lsm.1 b/dist-tools/shipper/rpm2lsm.1 deleted file mode 100644 index d11df03e..00000000 --- a/dist-tools/shipper/rpm2lsm.1 +++ /dev/null @@ -1,95 +0,0 @@ -.\"Generated by db2man.xsl. Don't modify this, modify the source. -.de Sh \" Subsection -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.TH "RPM2LSM" 1 "" "" "" -.SH NAME -rpm2lsm \- generate Linux Software Map entries from RPMs -.SH "SYNOPSIS" - -.nf -\fBrpm2lsm\fR [-a \fIauthor\fR] [-k \fIkeywords\fR] [-p \fIplatforms\fR] [-m \fImaintainer\fR] - \fIrpmfile\fR -.fi - -.SH "DESCRIPTION" - -.PP -This tool extracts tag information from an RPM file to generate a Linux Software Map (version 3) entry on standard output. Command-line switches support adding LSM fields that have no equivalents in RPMs. Here are the field-generation rules: - -.TP -Title: -Taken straight from the RPM Name field. - -.TP -Version: -Taken straight from the RPM Version field. - -.TP -Entered-Date: -LSM-generation time in YYYY-MM-DD format. - -.TP -Description: -Taken straight from the RPM Description field. - -.TP -Keywords: -Taken from the value of the \fB-k\fR command-line option. If no such option is given, it is omitted. - -.TP -Author: -Taken from the value of the \fB-a\fR command-line option. If no such option is given, it looks for an AUTHORS file in the current directory (GNU convention) and uses that. If no AUTHORS file is present, your email addess and full name from the password file - -.TP -Maintained-By: -Taken from the value of the \fB-m\fR command-line option. If that was not given, taken from the RPM Packager field. If that was not given, fill in the Author name. - -.TP -Primary-Site: -The first (site) line is taken from the RPM URL field. Second and subsequent lines list tarballs and RPMs that match on name, version number, and release number with the RPM algument. For each file, size in 1K blocks is filled in. - -.TP -Alternate-Site: -This field is not generated. - -.TP -Original-Site: -This field is not generated. - -.TP -Platforms: -Taken from the value of the \fB-p\fR command-line option. If no such option is given, 'All' is filled in. - -.TP -Copying-Policy: -Taken straight from the RPM License field. - -.PP -These are all the fields supported in LSM version 3. You can see the : LSM template http://ibiblio.org/pub/Linux/LSM-TEMPLATE for full details. - -.SH "AUTHOR" - -.PP -Eric S. Raymond <esr@thyrsus.com>. For updates, see : http://www.catb.org/~esr/software.htmlhttp://www.catb.org/~esr/software.html. - -.SH "SEE ALSO" - -.PP -\fBrpm\fR(8). - diff --git a/dist-tools/shipper/rpm2lsm.xml b/dist-tools/shipper/rpm2lsm.xml deleted file mode 100644 index 6856cbab..00000000 --- a/dist-tools/shipper/rpm2lsm.xml +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" - "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> -<refentry id='rpm2lsm.1'> -<refmeta> -<refentrytitle>rpm2lsm</refentrytitle> -<manvolnum>1</manvolnum> -</refmeta> -<refnamediv id='name'> -<refname>rpm2lsm</refname> -<refpurpose>generate Linux Software Map entries from RPMs</refpurpose> -</refnamediv> -<refsynopsisdiv id='synopsis'> - -<cmdsynopsis> - <command>rpm2lsm</command> - <arg choice='opt'>-a <replaceable>author</replaceable></arg> - <arg choice='opt'>-k <replaceable>keywords</replaceable></arg> - <arg choice='opt'>-p <replaceable>platforms</replaceable></arg> - <arg choice='opt'>-m <replaceable>maintainer</replaceable></arg> - <arg choice='plain'><replaceable>rpmfile</replaceable></arg> -</cmdsynopsis> - -</refsynopsisdiv> - -<refsect1 id='description'><title>DESCRIPTION</title> -<para>This tool extracts tag information from an RPM file to generate a -Linux Software Map (version 3) entry on standard output. Command-line -switches support adding LSM fields that have no equivalents in RPMs. -Here are the field-generation rules:</para> -<variablelist remap='TP'> -<varlistentry> -<term>Title:</term> -<listitem> -<para>Taken straight from the RPM Name field.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Version:</term> -<listitem> -<para>Taken straight from the RPM Version field.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Entered-Date:</term> -<listitem> -<para>LSM-generation time in YYYY-MM-DD format.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Description:</term> -<listitem> -<para>Taken straight from the RPM Description field.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Keywords:</term> -<listitem> -<para>Taken from the value of the <option>-k</option> command-line option. -If no such option is given, it is omitted.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Author:</term> -<listitem> -<para>Taken from the value of the <option>-a</option> command-line -option. If no such option is given, it looks for an AUTHORS file in -the current directory (GNU convention) and uses that. If no AUTHORS -file is present, your email addess and full name from the password -file</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Maintained-By:</term> -<listitem> -<para>Taken from the value of the <option>-m</option> command-line -option. If that was not given, taken from the RPM Packager field. -If that was not given, fill in the Author name.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Primary-Site:</term> -<listitem> -<para>The first (site) line is taken from the RPM URL field. Second -and subsequent lines list tarballs and RPMs that match on name, version -number, and release number with the RPM algument. For each file, -size in 1K blocks is filled in. -</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Alternate-Site:</term> -<listitem> -<para>This field is not generated.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Original-Site:</term> -<listitem> -<para>This field is not generated.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Platforms:</term> -<listitem> -<para>Taken from the value of the <option>-p</option> command-line option. -If no such option is given, 'All' is filled in.</para> -</listitem> -</varlistentry> -<varlistentry> -<term>Copying-Policy:</term> -<listitem> -<para>Taken straight from the RPM License field.</para> -</listitem> -</varlistentry> -</variablelist> - -<para>These are all the fields supported in LSM version 3. You can see the -<ulink url='http://ibiblio.org/pub/Linux/LSM-TEMPLATE'> -LSM template -</ulink> -for full details.</para> -</refsect1> - -<refsect1 id='author'><title>AUTHOR</title> -<para>Eric S. Raymond <email>esr@thyrsus.com</email>. -For updates, see <ulink url="http://www.catb.org/~esr/software.html"> -http://www.catb.org/~esr/software.html</ulink>.</para> -</refsect1> - -<refsect1 id='see_also'><title>SEE ALSO</title> -<para><citerefentry><refentrytitle>rpm</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> -</refsect1> -</refentry> - diff --git a/dist-tools/shipper/shipper b/dist-tools/shipper/shipper deleted file mode 100755 index 9d5ce1b3..00000000 --- a/dist-tools/shipper/shipper +++ /dev/null @@ -1,583 +0,0 @@ -#!/usr/bin/env python -# -# shipper -- a tool for shipping software - -import sys, os, readline, re, commands, time, glob, optparse, stat - -# -# State variables -# -destinations = [] # List of remote directories to update -channels = ['ibiblio', 'redhat', 'freshmeat'] -whoami = None # Who am I? (Used for FTP logins) -date = None # User has not yet set a date -package = None # Nor a package name -homepage = None # Nor a home page -arch = None # The machine architecture -keywords = None # Keywords for LSMs -freshmeat_name = None # Name of the project ob Freshmeat -changelog = None # Project changelog -lastchange = None # Last entry in changelog -summary = None # One-line summary of the package -description = None # Nor a description - -indextemplate = """ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> -<html> -<head> -<link rel='stylesheet' href='/~esr/sitestyle.css' type='text/css' /> -<meta name='description' content='Resource page for %(package)s' /> -<meta name='generator' content='shipper' /> -<meta name='MSSmartTagsPreventParsing' content='TRUE' /> -<title>Resource page for %(package)s %(version)s</title> -</head> -<body> - -<h1>Resource page for %(package)s %(version)s</td></h1> - -<p>%(description)s</p> - -<br /> -%(resourcetable)s -<br /> - -<p>Last modified %(date)s.</p> - -</div> -</body> -</html> -""" -mailtemplate = """Subject: Announcing release %(version)s of %(package)s - -Release %(version)s of %(package)s is now available at: - - %(homepage)s - -Here are the most recent changes: - -%(lastchange)s --- - shipper, acting for %(whoami)s -""" - -# It's unpleasant that we have to include these here, but -# the freshmeat release focus has to be validated even if the -# user is offline and the XML-RPC service not accessible. -freshmeat_focus_types = ( -"N/A", -"Initial freshmeat announcement", -"Documentation", -"Code cleanup", -"Minor feature enhancements", -"Major feature enhancements", -"Minor bugfixes", -"Major bugfixes", -"Minor security fixes", -"Major security fixes", -) - -def croak(msg): - sys.stderr.write("shipper: " + msg + "\n") - sys.exit(1) - -# -# Shipping methods -# - -def do_or_die(cmd): - "Wither execute a command or fail noisily" - if options.verbose: - print "***", cmd - if os.system(cmd): - croak("command '%s' failed!" % cmd) - -def upload_or_die(cmd): - if options.noupload: - print cmd - else: - do_or_die(cmd) - -def upload(destination, files): - # Upload a file via ftp or sftp, handles - print "# Uploading to %s" % destination - files = filter(os.path.exists, files) - if destination.startswith("ftp://"): - destination = destination[6:].split("/") - host = destination.pop(0) - directory = "/".join(destination) - commands = ["lftp", "open -u anonymous," + whoami + " " + host + "\n"] - if directory: - commands.append("cd " + directory + "\n") - commands.append("mput " + " ".join(files) + "\n") - commands.append("close\n") - if options.noupload: - print "".join(commands) - else: - pfp = os.popen(commands.pop(0), "w") - pfp.writelines(commands) - pfp.close() - elif destination.find("::") > -1: - upload_or_die("rsync " + " ".join(files) + " " + destination) - elif destination.find(":") > -1: - (host, directory) = destination.split(":") - for file in files: - # This is a really ugly way to deal with the problem - # of write-protected files in the remote directory. - # Unfortunately, sftp(1) is rather brain-dead -- no - # way to ignore failure on a remove, and refuses to - # do renames with an obscure error message. - remote = os.path.join(directory, package, file) - upload_or_die("scp " + file + " " + host + ":" + remote+".new;") - upload_or_die("ssh %s 'mv -f %s.new %s'" % (host, remote, remote)) - else: - sys.stderr.write("Don't know what to do with destination %s!") - -def freshmeat_ship(manifest): - "Ship a specified update to freshmeat." - if options.verbose: - print "Announcing to freshmeat..." - upload_or_die("freshmeat-submit <" + manifest[0]) - -# -# Metadata extraction -# - -def grep(pattern, file): - "Mine for a specified pattern in a file." - fp = open(file) - try: - while True: - line = fp.readline() - if not line: - return None - m = re.search(pattern, line) - if m: - return m.group(1) - finally: - fp.close() - return None - -class Specfile: - def __init__(self, filename): - self.filename = filename - self.type = None - if filename.endswith(".spec"): - self.type = "RPM" - self.package = self.extract("Name") - self.version = self.extract("Version") - self.homepage = self.extract("URL") - self.summary = self.extract("Summary") - self.arch = self.extract("BuildArch") or commands.getoutput("rpm --showrc | sed -n '/^build arch/s/.* //p'") - self.description = self.rpm_get_multiline("description") - self.changelog = self.rpm_get_multiline("changelog") - elif filename == "control": - self.type = "deb" - self.name = self.extract("Package") - self.version = self.extract("Version").split("-")[0] - self.homepage = self.extract("XBS-Home-Page") - self.summary = self.extract("Description") - self.arch = self.extract("Architecture") - if not self.arch: - croak("this control file lacks an Architecture field") - # FIXME: parse Debian description entries and changelog file - self.description = self.changelog = None - def extract(self, fld): - "Extract a one-line field, possibly embedded as a magic comment." - if self.type == "RPM": - return grep("^#?"+fld+":\s*(.*)", self.filename) - elif self.type == "deb": - return grep("^(?:XBS-)?"+fld+": (.*)", self.filename) - def rpm_get_multiline(self, fieldname): - "Grab everything from leader line to just before the next leader line." - global desc - fp = open(self.filename) - desc = "" - gather = False - while True: - line = fp.readline() - if not line: - break - # Pick up fieldnames *without* translation options. - if line.strip() == "%" + fieldname: - gather = True - continue - elif line[0] == "%": - gather = False - if gather: - desc += line - fp.close() - if desc: - return desc.strip() + "\n" - else: - return None -# -# Main sequence -# - -try: - # - # Process options - # - - parser = optparse.OptionParser(usage="%prog: [-h] [-n] [-f] [-v]") - parser.add_option("-v", "--verbose", - action="store_true", dest="verbose", default=False, - help="print progress messages to stdout") - parser.add_option("-n", "--noupload", - action="store_true", dest="noupload", default=False, - help="don't do uploads, just build deliverables") - parser.add_option("-N", "--nobuild", - action="store_true", dest="nobuild", default=False, - help="dump configuration only, no builds or uploads") - parser.add_option("-f", "--force", - action="store_true", dest="force", default=False, - help="force rebuilding of all local deliverables") - (options, args) = parser.parse_args() - - # - # Extract metadata and compute control information - # - - def disable(s): channels.remove(s) - - # Security check, don't let an attacker elevate privileges - def securecheck(file): - if stat.S_IMODE(os.stat(file).st_mode) & 00002: - croak("%s must not be world-writeable!" % file) - - # Read in variable overrides - securecheck(".") - home_profile = os.path.join(os.getenv('HOME'), ".shipper") - if os.path.exists(home_profile): - securecheck(home_profile) - execfile(home_profile) - here_profile = ".shipper" - if os.path.exists(here_profile): - securecheck(here_profile) - execfile(here_profile) - - # Set various sensible defaults - if not whoami: - whoami = os.getenv('USERNAME') + "@" + os.getenv('HOSTNAME') - - # Where to get the metadata - specfiles = glob.glob("*.spec") - if len(specfiles) == 1: - metadata = Specfile(specfiles[0]) - elif os.path.exists("control"): - metadata = Specfile("control") - else: - croak("must be exactly one RPM or dpkg specfile in the directory!") - - # Get the package name - if not package: - package = metadata.package - if not package: - croak("can't get package name!") - - # Extract the package vers from the specfile or Makefile - specvers = metadata.version - makevers = None - if os.path.exists("Makefile"): - makevers = grep("^VERS[A-Z]* *= *(.*)", "Makefile") - # Maybe it's a shell command intended to extract version from specfile - if makevers and makevers[0] == '$': - makevers = commands.getoutput(makevers[7:-1]) - if specvers != makevers: - croak("specfile version %s != Makefile version %s"%(specvers,makevers)) - elif specvers == None: - croak("can't get package version") - elif specvers[0] not in "0123456789": - croak("package version %s appears garbled" % specvers) - else: - version = specvers - - # Specfiles may set their own destinations - local_destinations = metadata.extract("Destinations") - if local_destinations: - local_destinations = map(lambda x: x.strip(), local_destinations.split(",")) - destinations += local_destinations - if not destinations: - print "warning: destinations empty, shipping to public channels only." - - print"# Uploading version %s of %s" % (version, package) - - # Extract remaining variables for templating - if not homepage: - homepage = metadata.homepage - if not date: - date = time.asctime() - if not summary: - summary = metadata.summary - if not description: - description = metadata.description - if not arch: - arch = metadata.arch - if not keywords: - keywords = metadata.extract("Keywords") - if not freshmeat_name: - freshmeat_name = metadata.extract("Freshmeat-Name") - - # Finally, derive the change log and lastchange entry; - # we'll need the latter for freshmeat.net - freshmeat_lastchange = lastchange = changelog = None - # ChangeLog, if present, takes precedence; - # we assume if both are present that the specfile log is about packaging. - if os.path.exists("ChangeLog"): - ifp = open("ChangeLog", "r") - changelog = ifp.read() - ifp.close() - lastchange = "" - for line in changelog.split("\n"): - while line.strip() or not "*" in lastchange: - lastchange += line + "\n" - else: - break - # freshmeat.net doesn't like bulleted items in a changes field. - freshmeat_lastchange = "See the ChangeLog file for recent changes." - elif metadata.changelog: - changelog = metadata.changelog - lastchange = "" - for line in changelog.split("\n"): - if not lastchange and (not line.strip() or line[0] == '*'): - continue - elif line.strip(): - lastchange += line + "\n" - else: - break - # This usually produces a lastchange entry that freshmeat will take. - freshmeat_lastchange = lastchange - - # - # Now compute the names of deliverables - # - - # These are all potential deliverable files that include the version number - tarball = package + "-" + version + ".tar.gz" - srcrpm = package + "-" + version + "-1.src.rpm" - binrpm = package + "-" + version + "-1." + arch + ".rpm" - zip = package + "-" + version + ".zip" - lsm = package + "-" + version + ".lsm" - - # Map web deliverables to explanations for the resource table - # Stuff not included here: ANNOUNCE.EMAIL, ANNOUNCE.FRESHMEAT, lsm. - stock_deliverables = [ - ("README", "roadmap file"), - (tarball, "source tarball"), - (zip, "ZIP archive"), - (binrpm, "installable RPM"), # Generated - (srcrpm, "source RPM"), # Generated - ("ChangeLog", "change log"), - ("CHANGES", "change log"), # Generated - ("NEWS", "Project news"), - ("HISTORY", "Project history"), - ("BUGS", "Known bugs"), - ("TODO", "To-do file"), - ] - - # - # Might be time to dump - # - if options.nobuild: - for variable in ('destinations', 'channels', 'whoami', 'date', - 'package', 'homepage', 'arch', 'keywords', \ - 'freshmeat_name', 'summary'): - print "%s = %s" % (variable, `eval(variable)`) - for variable in ('description', 'changelog', 'lastchange', 'mailtemplate', 'indextemplate'): - if not eval(variable): - print "No %s" % variable - else: - print "%s = <<EOF\n%sEOF" % (variable, eval(variable)) - sys.exit(0) - # - # Build deliverables - # - - suppress = " >/dev/null 2>&1" - if options.verbose: - suppress = "" - - # Sanity checks - if not os.path.exists(tarball): - croak("no tarball %s!" % tarball) - if metadata.type == "RPM" and not metadata.extract("BuildRoot"): - croak("specfile %s doesn't have a BuildRoot!" % metadata.filename) - - def newer(f1, f2): - return os.path.exists(f1) and (os.stat(f1).st_mtime > os.stat(f2).st_mtime) - - # Compute the deliverables, we need this even if not rebuilding the index - web_deliverables = [] - # Anything in the list of standard deliverables is eligible. - for (file, explanation) in stock_deliverables: - if os.path.exists(file): - web_deliverables.append((file, explanation)) - # So is anything with an HTML extendion - for file in glob.glob('*.html'): - if file == 'index.html': - continue - stem = file[:-4] - for ext in ("man", "1", "2", "3", "4", "5", "6", "7", "8", "9", "xml"): - if os.path.exists(stem + ext): - explanation = "HTML rendering of " + stem + ext - break - else: - explanation = "HTML page." - web_deliverables.append((file, explanation)) - # Compute final deliverables - deliverables = map(lambda x: x[0], web_deliverables)+["index.html"] - - try: - delete_at_end = [] - - # RPMs first. - if options.force or \ - (not os.path.exists(binrpm) or not os.path.exists(srcrpm)): - print "# Building RPMs..." - if newer(srcrpm, tarball) and newer(binrpm, tarball): - print "RPMs are up to date" - else: - do_or_die("buildrpms %s %s" % (tarball, suppress)) - delete_at_end.append(srcrpm) - delete_at_end.append(binrpm) - - # Next, the LSM if needed - if 'ibiblio' in channels and \ - (options.force or not os.path.exists(lsm)): - print "# Building LSM..." - if keywords: - do_or_die("rpm2lsm -k '"+keywords+"' "+binrpm+" >"+lsm) - else: - print "# Warning: LSM being built with no keywords." - do_or_die("rpm2lsm " + binrpm + ">" + lsm) - delete_at_end.append(lsm) - - # Next the index page if it doesn't exist. - if homepage and (options.force or not os.path.exists("index.html")): - print "# Building index page..." - # Now build the resource table - resourcetable = '<table border="1" align="center" summary="Downloadable resources">\n' - for (file, explanation) in web_deliverables: - resourcetable += "<tr><td><a href='%s'>%s</a></td><td>%s</td></tr>\n" % (file,file,explanation) - resourcetable += "</table>" - # OK, now build the index page itself - ofp = open("index.html", "w") - ofp.write(indextemplate % globals()) - ofp.close() - delete_at_end.append("index.html") - - # Next the CHANGES file. Build this only if (a) there is no ChangeLog, - # and (b) there is a specfile %changelog. - if not os.path.exists("ChangeLog") and \ - (options.force or not os.path.exists("CHANGES")) and changelog: - print "# Building CHANGES..." - ofp = open("CHANGES", "w") - ofp.write(" Changelog for " + package + "\n\n") - ofp.write(changelog) - ofp.close() - delete_at_end.append("CHANGES") - - # The freshmeat announcement - if 'freshmeat' in channels \ - and options.force or not os.path.exists("ANNOUNCE.FRESHMEAT"): - print "# Building ANNOUNCE.FRESHMEAT..." - if not homepage: - print "# Can't announce to freshmeat without a primary website!" - elif not lastchange: - print "# Can't announce to freshmeat without a changes field!" - else: - while True: - focus = raw_input("# freshmeat.net release focus (? for list): ") - if focus == '?': - i = 0 - for f in freshmeat_focus_types: - print "%d: %s" % (i, f) - i += 1 - elif focus in "0123456789": - print "# OK:", freshmeat_focus_types[int(focus)] - break - elif focus.lower() in map(lambda x: x.lower(), freshmeat_focus_types): - break - else: - croak("not a valid freshmeat.net release focus!") - ofp = open("ANNOUNCE.FRESHMEAT", "w") - ofp.write("Project: %s\n"%(freshmeat_name or package)) - ofp.write("Version: %s\n"% version) - ofp.write("Release-Focus: %s\n" % focus) - ofp.write("Home-Page-URL: %s\n" % homepage) - if os.path.exists(tarball): - ofp.write("Gzipped-Tar-URL: %s\n" % os.path.join(homepage,tarball)) - if os.path.exists(zip): - ofp.write("Zipped-Tar-URL: %s\n" % os.path.join(homepage, zip)) - if os.path.exists("CHANGES"): - ofp.write("Changelog-URL: %s\n" % os.path.join(homepage, "CHANGES")) - if os.path.exists(binrpm): - ofp.write("RPM-URL: %s\n" % os.path.join(homepage, binrpm)) - # freshmeat.net doesn't like bulleted entries. - freshmeatlog = lastchange[2:].replace("\n ", "\n") - ofp.write("\n" + freshmeatlog) - ofp.close() - delete_at_end.append("ANNOUNCE.FRESHMEAT") - - # Finally, email notification - if filter(lambda x: x.startswith("mailto:"), destinations) \ - and (options.force or not os.path.exists("ANNOUNCE.EMAIL")): - print "# Building ANNOUNCE.EMAIL..." - ofp = open("ANNOUNCE.EMAIL", "w") - ofp.write(mailtemplate % globals()) - ofp.close() - delete_at_end.append("ANNOUNCE.FRESHMEAT") - - # - # Now actually ship - # - - # Shipping methods, locations, and deliverables for public channels. - hardwired = { - 'freshmeat' : (lambda: freshmeat_ship(("ANNOUNCE.FRESHMEAT",))), - 'ibiblio' : (lambda: upload("ftp://ibiblio.org/incoming/linux", - (tarball, binrpm, srcrpm, lsm))), - 'redhat' : (lambda: upload("ftp://incoming.redhat.com/libc6", - (tarball, binrpm, srcrpm))), - } - - - # First ship to private channels. Order is important here, we - # need to hit the user's primary website first so everything - # will be in place when announcements are generated. - for destination in destinations: - if destination.startswith("ftp:"): - upload(destination, (tarball, binrpm, srcrpm,)) - elif destination.startswith("mailto:"): - print "# Mailing to %s" % destination - command = "sendmail -i -oem -f %s %s <ANNOUNCE.EMAIL" % (whoami, destination[7:]) - if options.noupload: - print command - else: - do_or_die(command) - else: - upload(destination, deliverables) - - # Now ship to public channels - for channel in channels: - print "# Shipping to public channel", channel - apply(hardwired[channel]) - finally: - cleanup = "rm -f " + " ".join(delete_at_end) - if options.noupload: - print cleanup - else: - for file in delete_at_end: - os.system(cleanup) - print "# Done" -except KeyboardInterrupt: - print "# Bye!" - - - -# The following sets edit modes for GNU EMACS -# Local Variables: -# mode:python -# End: diff --git a/dist-tools/shipper/shipper.1 b/dist-tools/shipper/shipper.1 deleted file mode 100644 index a2ca011d..00000000 --- a/dist-tools/shipper/shipper.1 +++ /dev/null @@ -1,294 +0,0 @@ -.\"Generated by db2man.xsl. Don't modify this, modify the source. -.de Sh \" Subsection -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.TH "SHIPPER" 1 "" "" "" -.SH NAME - shipper \- automatic drop-shipping of project releases -.SH "SYNOPSIS" - -.nf -\fBshipper\fR [-h] [-n] [-N] [-f] [-v] -.fi - -.nf -\fBbuildrpms\fR {\fItarball\fR} -.fi - -.SH "DESCRIPTION" - -.PP -shipper is a tool for shipping project releases. Its job is to make it possible for you to run the command \fBshipper\fR in the top-level directory of a project and have a release be properly exported to all the places that you normally deliver it -- your personal website, Linux source code archive sites, and distribution submission queues. A second goal is to arrange your shipping process in such a way that metadata like your project version only have to be kept in one place and modified once per release. The overall goal is to reduce the friction cost of shipping releases to as near zero as possible. - -.PP -buildrpms is a helper script that builds source and binary RPMs from a specified tarball with a BuildRoot field. shipper also calls \fBrpm2lsm\fR(1) to do part of its work. - -.PP -As much as possible, shipper tries to deduce what it should do rather than requiring you to tell it. In order to do this, it relies on your project obeying standard GNU-like naming conventions. It also relies on being able to mine project metadata out of a package specfile. (Presently the only variety of package specfile supported is an RPM spec; this may change in the future, when we fully support shipping Debian packages.) - -.PP -In normal use, you need set only one configuration variable, which is the list of private destinations to ship to. You may also want to add some magic ``Keywords'' comments to your project specfiles. Once you have shipper up and running, you can experiment with more advanced features such as having the program generate project web pages for you. - -.SH "THEORY OF OPERATION" - -.PP -shipper pushes deliverables out to destinations. Deliverables include: source tarballs, source zip archives, source RPMs, binary RPMs, ChangeLog files, README files, LSM files, and various other project metadata files. Destinations include both private destinations like websites, FTP archive sites and mailing lists, and public channels like ibiblio, freshmeat.net, and the submission queues for various well-known operating-system distributions. The shipper framework is extensible and it is relatively easy to add new channel types and new deliverables; in the future, we hope to support (for example) Debian packages as deliverables and SourceForge as a channel. - -.PP -shipper's first step is to find the project name and version, then to check that the minimum set of files that shipper requires to continue is in place. To start with, shipper needs a source tarball and a specfile. Once it knows those are in place, it can extract various pieces of information it will need to do its real work. It also reads in a handful of configuration variables. The -N (nobuild) option causes it to dump all configuration values and stop there. - -.PP -The first real work that gets done is finding or building local deliverables. These are either generated deliverables (like RPMs) that can be rebuilt automatically, or or stock deliverables (like a README file) that have to be changed by hand. shipper rebuilds any generated deliverable that doesn't exist when it starts up. Building local deliverables is separated from uploading because it means that you can stop and inspect what you're going to ship before committing to an upload. - -.PP -The -n (noupload) option stops before uploading, leaving all local deliverables in place but displaying the exact upload commands that would have been used to ship them. The -f (force) option forces a rebuild of all generated deliverables, even those that already exist. The command \fBshipper -f -n\fR will show you exactly what shipper would do for a real upload. - -.PP -Once all local deliverables have been built, shipper can begin uploading files and posting announcements. It does private destinations first, then public channels. This means, for example, that if you give shipper your personal website as a destination, the website will get updated each time before any submissions or announcements are sent to public sites like ibiblio.org or freshmeat.net. - -.PP -When uploads are complete, shipper cleans up after itself by deleting any deliverables it created for this run. Deliverables that were found and up to date are not removed. - -.PP -Finally, note that shipper makes one important assumption about the structure of your website(s). Beneath each directory in your \fIdestinations\fR list, there will be one subdirectory for each project, with the directory leaf name being the same as the project. Thus, for example, if you have three projects named ruby, diamond and sapphire, and your personal site is at \fIgemstones.net:/public/www/precious/\fR, shipper will expect to be able to drop deliverables in three directories \fIgemstones.net:/public/www/precious/ruby\fR, \fIgemstones.net:/public/www/precious/diamond/\fR, and \fIgemstones.net:/public/www/precious/sapphire/\fR. Note that shipper will not create these project directories for you if they're missing; this is deliberate, so that uploads to sites that are not prepared for them will fail noisily. - -.SH "HOW SHIPPER DEDUCES WHAT TO DO" - -.PP -The behavior of shipper depends on a handful of internal variables. Some of these variables have defaults computed at startup time. All can be set or overridden in the per-user \fI~/.shipper\fR file, and overridden in any per-project \fI.shipper\fR file. Both files are Python code and the syntax of variable settings is Python's. - -.PP -If a variable is set in a config file, that value is locked in (except for the \fIdestinations\fR variable which can be appended to from a specfile, see below) Variables that are not set in a config file may be set by the values of fields in your project specfile. - -.PP -For basic use, it is only necessary to set one such variable: \fIdestinations\fR, the list of destinations to ship to. Normally you'll set this globally, pointing all your projects at your main distribution website, in your \fI~/.shipper\fR file; it is also possible to add destinations on a per-project basis by giving a comma-separated list in a #Destinations: comment in the specfile. You can set the variable in a per-project \fI.shipper\fR to ignore your global destination list. - -.PP -The first thing shipper looks for is a specfile in the current directory; there must be exactly one. It extracts the project name from the Name field. Next step is to find the project version (the variable \fIpackage\fR). This is extracted from the specfile, or by looking for a makefile macro with a name beginning with VERS; if the value of that macro is a shell command wrapped in $(shell ...), it is executed and the output is captured to yield the version. If both versions are present, they are consistency-checked. - -.PP -shipper gets most of the rest of the data it uses to decide what to do from headers in the specfile. The following table lists all the variables and their corresponding specfile fields. shipper uses the RPM spec file fields: the Debian entries are informational only. -VariableRPM specfile fieldDebian specfile fieldMeaning\fIdestinations\fR#Destinations:XBS-Destinations: -.PP -A list of remote directories to ship to using \fBscp\fR(1). Each location is a place to drop deliverables: either a [user@]site:path destination that \fBscp\fR(1) can use, or an FTP url that \fBlftp\fR(1) can use. Note that actual project directories are computed by appending the value of \fIpackage\fR to the destination you're shipping to. - -.PP -There is no default.. If you do not set this variable, shipper will ship only to public channels. -\fIchannels\fR-- -.PP -The list of public channels to be shipped to after the private channels in the \fIdestination\fR list. You can disable one or more of these in a config file by calling the function \fBdisable()\fR; for example with \fBdisable('freshmeat')\fR. -\fIwhoami\fR-- -.PP -A plausible email address for the user. If not specified in the config file, it's generated from \fB$USERNAME\fR and \fB$HOSTNAME\fR. -\fIdate\fR-- -.PP -The program's startup time. This can be used in the web page and email announcement templates. - -.PP -You can use the Python function time.strftime("...") in your \fI~/.shipper\fR file to format this date to your taste. If you don't set this in the config file, the program will set it for you. -\fIindextemplate\fR-- -.PP -Template HTML from which to generate index.html for shipping. There is a default which generates a very simple page containing a title, a date, and a table listing downloadable resources. This is used when shipping to a web directory, if no index page exists when shipper is run. -\fImailtemplate\fR-- -.PP -Template text from which to generate the file ANNOUNCE.EMAIL to be shipped to destinations that are mailto URLs. There is a default which generates a very simple email containing a subject, a pointer to the project web page, and the last entry in the project changelog. -\fIpackage\fRName:Package: -.PP -Project name, used to generate the stem part of the names of RPMs and other deliverables that shipper builds. If the specfile is a Debian control file, the Debian-specific part of the version number (after the dash) is removed. -\fIversion\fRVersion:Version: -.PP -Project version, used in generating the names of RPMs and other deliverables that shipper builds. -\fIhomepage\fRURL:XBS-Home-Page: -.PP -Project home page URL. Used when generating project announcements. -\fIarch\fRBuildArch:Architecture: -.PP -Build architecture. If this field is ``noarch'', noarch rather than binary RPMs will be built. -\fIkeywords\fR#Keywords:XBS-Keywords: -.PP -Topic keywords. Used when generating LSM files. -\fIfreshmeat_name\fR#Freshmeat-Name:XBS-Freshmeat-Name: -.PP -Freshmeat shortname, used in generating freshmeat.net announcements. If this isn't present, it defaults to the project name; you only need to set it if they differ. -\fIsummary\fRSummaryDescription: -.PP -The one-line project summary field from your specfile. -\fIdescription\fR%descriptionDescription: -.PP -The Description field from your specfile. -\fIchangelog\fRChangeLog or %changelog- -.PP -If a \fIChangeLog\fR file exists in the project directory, its entire contents. Otherwise, if it exists, the entire changelog section from the specfile. -\fIlastchange\fRChangeLog or %changelog- -.PP -If the source of your changlog was your specfile, this is the most recent entry from your changelog without its date/author/release header. If the source was Changelog, a line of text directing the user to see the ChangeLog file. This becomes the Changes field in your freshmeat.net announcement, and freshmeat.net doesn't like the bulleted format of GNU ChangeLog entries. -\fIresourcetable\fR-- -.PP -The HTML table of links to downloadable resources. This variable is only computed if the index page is built. Any setting of it in the startup files is ignored. - -.PP -All these variables are available for substitution at the time a web page or email announcement is generated. In general, any variable you set in your \fI~/.shipper\fR file will be available at the time the web page or email announcement is generated. Use the Python "%(variable)s" syntax, not shell-substitution syntax. - -.SH "FINDING AND BUILDING LOCAL DELIVERABLES" - -.PP -The following files are considered stock deliverables and may be shipped if they are present when shipper starts up: -FileExplanationREADME -.PP -Project roadmap file. -tarball -.PP -The current source tarball, that is the file named ${package}-${version}.tar.gz. -zipfile -.PP -The current source zip archive, that is the file named ${package}-${version}.zip. -NEWS -.PP -Project news file. -ChangeLog -.PP -Project change log. -HISTORY -.PP -Project history file. -BUGS -.PP -Project bug list. -TODO -.PP -Current to-do list. -*.html -.PP -Any files with an .html extension will be shipped to all website destinations. - -.PP -Here are the generated deliverables that shipper will build and ship, if they don't exist when it starts up. Any of these that are created will be deleted after a successful upload. -TypeExplanationindex.html -.PP -An index web page, to be shipped to any website destination. -RPMs -.PP -Source and either binary or noarch RPMs. -LSM -.PP -If the ibiblio channel is enabled, shipper will generate a Linux Software Map file for it. -CHANGES -.PP -If there is no ChangeLog file but there was a %changelog in your specfile, shipper will generate a CHANGES from the changelog entries in the specfile and ship that. -ANNOUNCE.FRESHMEAT -.PP -If there is no ANNOUNCE.FRESHMEAT file, shipper will generate one. It will be a job card that can be fed to freshmeat.net's XML-RPC interface via \fBfreshmeat-submit\fR(1). -ANNOUNCE.EMAIL -.PP -If there is no ANNOUNCE.EMAIL file, shipper will generate one to be emailed to destinations that are mailto URLs. - -.SH "SHIPPING TO DESTINATIONS" - -.PP -In operation, shipper walks through a list of destinations, building the required deliverables for each one and performing the required shipping actions to push them out to the destination. Here are the channel types shipper knows about: -Channel TypeDeliverablesSpecified byExplanationibibliotarball, RPMs, LSM file- -.PP -If the ibiblio channel is enabled (it is by default), shipper will attempt to ship a source tarball, RPMs, and an an LSM file to ibiblio.org via FTP. The LSM file will be automatically generated. -redhatRPMs- -.PP -If the Red Hat channel is enabled (it is by default), shipper will attempt to ship source and binary RPMs to the Red Hat submission directory via FTP. -freshmeatANNOUNCE.FRESHMEAT- -.PP -If the freshmeat channel is enabled (it is by default), shipper will attempt to post a release announcement on freshmeat.net using \fBfreshmeat-submit\fR(1). The announcement will include URLs for whichever of the following deliverables are shipped, using the URL field from your specfile: tarball, zipfile, RPMs, CHANGES. The user will be prompted for a Freshmeat release-focus. This announcement is generated into the local deliverable ANNOUNCE.FRESHMEAT. -Generic Web siteREADME, tarball, zipfile, RPMs, CHANGES, NEWS, HISTORY, *.html, -BUGS, TODO.scp destination ([user@]host:dir) -.PP -This channel type represents a website. shipper uses \fBscp\fR(1) to put deliverables on websites. If the user part of the scp destination is absent, it will be taken from the environment variable \fBUSERNAME\fR. - -.PP -No generic Web sites are shipped to by default. You must declare them by putting scp destinations in the \fIdestinations\fR variable. -Generic FTP sitetarball, RPMsFTP URL -.PP -Old-fashioned FTP site with no metadata. The FTP URL is parsed to get the sitename and directory where deliverables should be dropped. The FTP username to be used will be taken from the environment variable \fBUSERNAME\fR. The FTP password will be looked up in your \fI~/.netrc\fR file. - -.PP -No generic FTP sites are shipped to by default. You must declare them by putting FTP urls in the \fIdestinations\fR variable. -Email addressANNOUNCE.EMAILmailto URL -.PP -The contents of the generated ANNOUNCE.EMAIL file is emailed to each email address specified as a channel. - -.PP -No email channels are set up by default. You must declare them by putting mailto: urls in the \fIdestinations\fR variable. -rsync unitSRPMrsync address ([user@]host::unit) -.PP -An SRPM is shipped to each destination that is rcognized as an rsync address (by the double colon). - -.PP -No rsync channels are set up by default. You must declare them by putting rsync addresses in the \fIdestinations\fR variable. - -.SH "COMMAND-LINE OPTIONS" - -.PP -The -n option of shipper suppresses uploads, just building all deliverables locally. The -N option suppresses both uploads and builds, generating a configuration dumop instead. The -f option forces rebuilding of local deliverables even if they already exist. The -v option makes shipper chatty about what it's doing. The -h option prints a usage message and exits. - -.SH "HINTS AND TIPS" - -.PP -The following variable definition in your makefile will ensure that the makefile version is derived from (and thus always consistent with) the specfile version. - -.nf - -VERS=$(shell sed <*.spec -n -e '/Version: \\(.*\\)/s//\\1/p') - -.fi - -.PP -A makefile production like the following will allow you to type \fBmake release\fR and be sure that all the deliverables shipper knows about will be rebuilt before being shipped. - -.nf - -release: package-$(VERS).tar.gz package.html - shipper -f - -.fi - -.PP -You will want to change package to your project name. Note that you should not use this recipe if your project has its own (non-generated) index page, as the -f option will overwrite \fIindex.html\fR. - -.PP -To make \fBrpm\fR(1) build noarch rather than binary RPMs, insert the following header in your specfile: - -.nf - -BuildArch: noarch - -.fi - -.SH "AUTHOR" - -.PP -Eric S. Raymond <esr@thyrsus.com>. The buildrpms script was originally by Sean Reifschneider. - -.PP -There is a project web page at : http://www.catb.org/~esr/shipper/http://www.catb.org/~esr/shipper/. - -.SH "BUGS" - -.PP -The rsync channel type is untested. Shipping Debian packages should be supported. - -.SH "SEE ALSO" - -.PP - \fBfreshmeat-submit\fR(1), \fBlftp\fR(1), \fBrpm2lsm\fR(1), \fBscp\fR(1), \fBssh\fR(1). - diff --git a/dist-tools/shipper/shipper.spec b/dist-tools/shipper/shipper.spec deleted file mode 100644 index 3a3646a5..00000000 --- a/dist-tools/shipper/shipper.spec +++ /dev/null @@ -1,69 +0,0 @@ -Name: shipper -Version: 0.5 -Release: 1 -URL: http://www.catb.org/~esr/shipper/ -Source0: %{name}-%{version}.tar.gz -License: GPL -Group: Utilities -Summary: automated shipping of open-source project releases -Requires: lftp, openssh-clients, freshmeat-submit -BuildRoot: %{_tmppath}/%{name}-root -BuildArch: noarch -#Keywords: packaging, distribution - -%description -shipper is a power distribution tool for developers with multiple -projects who do frequent releases. It automates the tedious process -of shipping a software release to several standard places, including -ibiblio, the Red Hat submission directory, and your own hosted -website. It also knows how to post a release announcement to -freshmeat.net via freshmeat-submit. Two auxiliary tools, buildrpms -and rpm2lsm, build RPMs and generate LSM files from them respectively. - -%prep -%setup -q - -%build -make %{?_smp_mflags} shipper.1 rpm2lsm.1 - -%install -[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" -mkdir -p "$RPM_BUILD_ROOT"%{_bindir} -mkdir -p "$RPM_BUILD_ROOT"%{_mandir}/man1/ -cp shipper rpm2lsm buildrpms "$RPM_BUILD_ROOT"%{_bindir} -cp shipper.1 rpm2lsm.1 "$RPM_BUILD_ROOT"%{_mandir}/man1/ - -%clean -[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" - -%files -%defattr(-,root,root,-) -%doc README COPYING -%{_bindir}/shipper -%{_bindir}/rpm2lsm -%{_bindir}/buildrpms -%{_mandir}/man1/shipper.1* -%{_mandir}/man1/rpm2lsm.1* - -%changelog -* Fri Feb 6 2004 Eric S. Raymond <esr@snark.thyrsus.com> 0.5-1 -- Added security check so the ~/.shipper and .shipper files can't be used - for privilege elevation. Fixed upload omission bug in case where neither - -n nor -f was on and the webpage wasn't being built. Deliverables - created for upload are deleted at end of run. - -* Sun Jan 11 2004 Eric S. Raymond <esr@snark.thyrsus.com> 0.4-1 -- Correct extraction of freshmeat name. Build generated deliverables - only if we know they will be needed. Help is now available at the - freshmeat-focus prompt. - -* Sat Jan 10 2004 Eric S. Raymond <esr@snark.thyrsus.com> 0.3-1 -- First alpha release of unified shipper package. It can ship itself. - -* Wed Dec 17 2003 Eric S. Raymond <esr@snark.thyrsus.com> -- rpm2lsm now grabs an RPM from the current directory if no argument, - and parses an AUTHORS file if present (GNU convention). Also, - this release fixes a bug in USERNAME handling. - -* Thu Aug 1 2002 Eric S. Raymond <esr@snark.thyrsus.com> -- Initial release of rpm2lsm, since folded into shipper package. diff --git a/dist-tools/shipper/shipper.xml b/dist-tools/shipper/shipper.xml deleted file mode 100644 index 765f0f54..00000000 --- a/dist-tools/shipper/shipper.xml +++ /dev/null @@ -1,752 +0,0 @@ -<!DOCTYPE refentry PUBLIC - "-//OASIS//DTD DocBook XML V4.1.2//EN" - "docbook/docbookx.dtd"> -<refentry id='shipper.1'> -<refmeta> -<refentrytitle>shipper</refentrytitle> -<manvolnum>1</manvolnum> -</refmeta> -<refnamediv id='name'> -<refname> shipper</refname> -<refpurpose>automatic drop-shipping of project releases</refpurpose> -</refnamediv> -<refsynopsisdiv id='synopsis'> - -<cmdsynopsis> - <command>shipper</command> - <arg choice='opt'>-h</arg> - <arg choice='opt'>-n</arg> - <arg choice='opt'>-N</arg> - <arg choice='opt'>-f</arg> - <arg choice='opt'>-v</arg> -</cmdsynopsis> -<cmdsynopsis> - <command>buildrpms</command> - <arg choice='req'><replaceable>tarball</replaceable></arg> -</cmdsynopsis> -</refsynopsisdiv> - -<refsect1><title>Description</title> - -<para><application>shipper</application> is a tool for shipping -project releases. Its job is to make it possible for you to run the -command <command>shipper</command> in the top-level directory of a -project and have a release be properly exported to all the places that -you normally deliver it — your personal website, Linux source -code archive sites, and distribution submission queues. A second goal -is to arrange your shipping process in such a way that metadata like -your project version only have to be kept in one place and modified -once per release. The overall goal is to reduce the friction cost -of shipping releases to as near zero as possible.</para> - -<para><application>buildrpms</application> is a helper script that -builds source and binary RPMs from a specified tarball with a -BuildRoot field. <application>shipper</application> also calls -<citerefentry> -<refentrytitle>rpm2lsm</refentrytitle> -<manvolnum>1</manvolnum></citerefentry> to do part of its work.</para> - -<para>As much as possible, <application>shipper</application> tries to -deduce what it should do rather than requiring you to tell it. In -order to do this, it relies on your project obeying standard GNU-like -naming conventions. It also relies on being able to mine project -metadata out of a package specfile. (Presently the only variety of -package specfile supported is an RPM spec; this may change in the future, -when we fully support shipping Debian packages.)</para> - -<para>In normal use, you need set only one configuration variable, -which is the list of private destinations to ship to. You may also -want to add some magic <quote>Keywords</quote> comments to your -project specfiles. Once you have <application>shipper</application> -up and running, you can experiment with more advanced features -such as having the program generate project web pages for you.</para> -</refsect1> - -<refsect1><title>Theory of Operation</title> - -<para><application>shipper</application> pushes -<emphasis>deliverables</emphasis> out to -<emphasis>destinations</emphasis>. Deliverables include: source tarballs, -source zip archives, source RPMs, binary RPMs, ChangeLog files, README -files, LSM files, and various other project metadata files. Destinations -include both <emphasis>private destinations</emphasis> like websites, FTP -archive sites and mailing lists, and <emphasis>public -channels</emphasis> like ibiblio, freshmeat.net, and the submission -queues for various well-known operating-system distributions. The -shipper framework is extensible and it is relatively easy to add new -channel types and new deliverables; in the future, we hope to support -(for example) Debian packages as deliverables and SourceForge as a -channel.</para> - -<para><application>shipper</application>'s first step is to find the -project name and version, then to check that the minimum set of files that -<application>shipper</application> requires to continue is in place. -To start with, <application>shipper</application> needs a source -tarball and a specfile. Once it knows those are in place, it -can extract various pieces of information it will need to do its -real work. It also reads in a handful of configuration variables. -The -N (nobuild) option causes it to dump all configuration values and -stop there.</para> - -<para>The first real work that gets done is finding or building local -deliverables. These are either <emphasis>generated -deliverables</emphasis> (like RPMs) that can be rebuilt automatically, -or or <emphasis>stock deliverables</emphasis> (like a README file) -that have to be changed by hand. <application>shipper</application> -rebuilds any generated deliverable that doesn't exist when it starts -up. Building local deliverables is separated from uploading because -it means that you can stop and inspect what you're going to ship -before committing to an upload.</para> - -<para>The -n (noupload) option stops before uploading, leaving all -local deliverables in place but displaying the exact upload commands -that would have been used to ship them. The -f (force) option forces -a rebuild of all generated deliverables, even those that already -exist. The command <command>shipper -f -n</command> will show you -exactly what <application>shipper</application> would do for a real -upload.</para> - -<para>Once all local deliverables have been built, -<application>shipper</application> can begin uploading files and -posting announcements. It does private destinations first, then public -channels. This means, for example, that if you give -<application>shipper</application> your personal website as a destination, the -website will get updated each time <emphasis>before</emphasis> -any submissions or announcements are sent to public sites like -ibiblio.org or freshmeat.net.</para> - -<para>When uploads are complete, <application>shipper</application> -cleans up after itself by deleting any deliverables it created for -this run. Deliverables that were found and up to date are not -removed.</para> - -<para>Finally, note that <application>shipper</application> makes one -important assumption about the structure of your website(s). Beneath -each directory in your <varname>destinations</varname> list, there -will be one subdirectory for each project, with the directory leaf -name being the same as the project. Thus, for example, if you have -three projects named ruby, diamond and sapphire, and your personal -site is at <filename>gemstones.net:/public/www/precious/</filename>, -<application>shipper</application> will expect to be able to drop -deliverables in three directories -<filename>gemstones.net:/public/www/precious/ruby</filename>, -<filename>gemstones.net:/public/www/precious/diamond/</filename>, and -<filename>gemstones.net:/public/www/precious/sapphire/</filename>. -Note that <application>shipper</application> will not create these -project directories for you if they're missing; this is deliberate, so -that uploads to sites that are not prepared for them will fail -noisily.</para> - -</refsect1> - -<refsect1><title>How Shipper Deduces What To Do</title> - -<para>The behavior of shipper depends on a handful of internal -variables. Some of these variables have defaults computed at startup -time. All can be set or overridden in the per-user -<filename>~/.shipper</filename> file, and overridden in any -per-project <filename>.shipper</filename> file. Both files are Python -code and the syntax of variable settings is Python's.</para> - -<para>If a variable is set in a config file, that value is locked in -(except for the <varname>destinations</varname> variable which can be -appended to from a specfile, see below) Variables that are -<emphasis>not</emphasis> set in a config file may be set by the values -of fields in your project specfile.</para> - -<para>For basic use, it is only necessary to set one such variable: -<varname>destinations</varname>, the list of destinations to ship to. -Normally you'll set this globally, pointing all your projects at your -main distribution website, in your <filename>~/.shipper</filename> -file; it is also possible to add destinations on a per-project basis -by giving a comma-separated list in a #Destinations: comment in the -specfile. You can set the variable in a per-project -<filename>.shipper</filename> to ignore your global destination -list.</para> - -<para>The first thing shipper looks for is a specfile in the -current directory; there must be exactly one. It extracts the project -name from the Name field. Next step is to find the project version -(the variable <varname>package</varname>). This is extracted from the -specfile, or by looking for a makefile macro with a name -beginning with VERS; if the value of that macro is a shell command -wrapped in $(shell ...), it is executed and the output is captured to -yield the version. If both versions are present, they are -consistency-checked.</para> - -<para><application>shipper</application> gets most of the rest of the -data it uses to decide what to do from headers in the specfile. -The following table lists all the variables and their corresponding -specfile fields. <application>shipper</application> uses the RPM spec -file fields: the Debian entries are informational only.</para> - -<informaltable> -<tgroup cols="4"> -<thead> -<row> -<entry>Variable</entry> -<entry>RPM specfile field</entry> -<entry>Debian specfile field</entry> -<entry>Meaning</entry> -</row> -</thead> -<tbody> -<row> -<entry><varname>destinations</varname></entry> -<entry>#Destinations:</entry> -<entry>XBS-Destinations:</entry> -<entry> -<para>A list of remote directories to ship to using -<citerefentry> -<refentrytitle>scp</refentrytitle> <manvolnum>1</manvolnum> -</citerefentry>. Each location is a place to drop deliverables: -either a [user@]site:path destination that -<citerefentry> -<refentrytitle>scp</refentrytitle> <manvolnum>1</manvolnum> -</citerefentry> can use, or an FTP url that -<citerefentry> -<refentrytitle>lftp</refentrytitle> <manvolnum>1</manvolnum> -</citerefentry> -can use. Note that actual project directories are computed by -appending the value of <varname>package</varname> to -the destination you're shipping to.</para> - -<para><emphasis role='bold'>There is no default.</emphasis>. If you -do not set this variable, <application>shipper</application> will -ship only to public channels.</para> -</entry> -</row> -<row> -<entry><varname>channels</varname></entry> -<entry align='center'>-</entry> -<entry align='center'>-</entry> -<entry> -<para>The list of public channels to be shipped to after the private -channels in the <varname>destination</varname> list. You can disable -one or more of these in a config file by calling the function -<function>disable()</function>; for example with -<command>disable('freshmeat')</command>.</para> -</entry> -</row> -<row> -<entry><varname>whoami</varname></entry> -<entry align='center'>-</entry> -<entry align='center'>-</entry> -<entry> -<para>A plausible email address for the user. If not specified in the -config file, it's generated from -<envar>$USERNAME</envar> and <envar>$HOSTNAME</envar>.</para> -</entry> -</row> -<row> -<entry><varname>date</varname></entry> -<entry align='center'>-</entry> -<entry align='center'>-</entry> -<entry> -<para>The program's startup time. This can be used in the web page and -email announcement templates.</para> - -<para>You can use the Python function time.strftime("...") in your -<filename>~/.shipper</filename> file to format this date to your -taste. If you don't set this in the config file, the program will -set it for you.</para> -</entry> -</row> -<row> -<entry><varname>indextemplate</varname></entry> -<entry align='center'>-</entry> -<entry align='center'>-</entry> -<entry> -<para>Template HTML from which to generate index.html for shipping. There is a -default which generates a very simple page containing a title, a -date, and a table listing downloadable resources. This is used when -shipping to a web directory, if no index page exists when shipper -is run.</para> -</entry> -</row> -<row> -<entry><varname>mailtemplate</varname></entry> -<entry align='center'>-</entry> -<entry align='center'>-</entry> -<entry> -<para>Template text from which to generate the file ANNOUNCE.EMAIL to be -shipped to destinations that are mailto URLs. There is a default which -generates a very simple email containing a subject, a pointer to the -project web page, and the last entry in the project changelog.</para> -</entry> -</row> -<row> -<entry><varname>package</varname></entry> -<entry>Name:</entry> -<entry>Package:</entry> -<entry> -<para>Project name, used to generate the stem part of the names of RPMs and -other deliverables that <application>shipper</application> -builds. If the specfile is a Debian control file, the Debian-specific -part of the version number (after the dash) is removed.</para> -</entry> -</row> -<row> -<entry><varname>version</varname></entry> -<entry>Version:</entry> -<entry>Version:</entry> -<entry> -<para>Project version, used in generating the names of RPMs and -other deliverables that <application>shipper</application> -builds.</para> -</entry> -</row> -<row> -<entry><varname>homepage</varname></entry> -<entry>URL:</entry> -<entry>XBS-Home-Page:</entry> -<entry> -<para>Project home page URL. Used when generating project -announcements.</para> -</entry> -</row> -<row> -<entry><varname>arch</varname></entry> -<entry>BuildArch:</entry> -<entry>Architecture:</entry> -<entry> -<para>Build architecture. If this field is <quote>noarch</quote>, -noarch rather than binary RPMs will be built.</para> -</entry> -</row> -<row> -<entry><varname>keywords</varname></entry> -<entry>#Keywords:</entry> -<entry>XBS-Keywords:</entry> -<entry> -<para>Topic keywords. Used when generating LSM files.</para> -</entry> -</row> -<row> -<entry><varname>freshmeat_name</varname></entry> -<entry>#Freshmeat-Name:</entry> -<entry>XBS-Freshmeat-Name:</entry> -<entry> -<para>Freshmeat shortname, used in generating freshmeat.net -announcements. If this isn't present, it defaults to the project -name; you only need to set it if they differ.</para> -</entry> -</row> -<row> -<entry><varname>summary</varname></entry> -<entry>Summary</entry> -<entry>Description:</entry> -<entry> -<para>The one-line project summary field from your specfile.</para> -</entry> -</row> -<row> -<entry><varname>description</varname></entry> -<entry>%description</entry> -<entry>Description:</entry> -<entry> -<para>The Description field from your specfile.</para> -</entry> -</row> -<row> -<entry><varname>changelog</varname></entry> -<entry>ChangeLog or %changelog</entry> -<entry align='center'>-</entry> -<entry> -<para>If a <filename>ChangeLog</filename> file exists in the project -directory, its entire contents. Otherwise, if it exists, -the entire changelog section from the specfile.</para> -</entry> -</row> -<row> -<entry><varname>lastchange</varname></entry> -<entry>ChangeLog or %changelog</entry> -<entry align='center'>-</entry> -<entry> -<para> -If the source of your changlog was your specfile, this is the -most recent entry from your changelog without -its date/author/release header. If the source was Changelog, a -line of text directing the user to see the ChangeLog file. -This becomes the Changes field in your freshmeat.net announcement, -and freshmeat.net doesn't like the bulleted format of GNU ChangeLog -entries.</para> -</entry> -</row> -<row> -<entry><varname>resourcetable</varname></entry> <entry -align='center'>-</entry> <entry align='center'>-</entry> -<entry> -<para>The HTML table of links to downloadable resources. This -variable is only computed if the index page is built. Any setting -of it in the startup files is ignored.</para> -</entry> -</row> -</tbody> -</tgroup> -</informaltable> - -<para>All these variables are available for substitution at the time a -web page or email announcement is generated. In general, any variable -you set in your <filename>~/.shipper</filename> file will be available -at the time the web page or email announcement is generated. Use the -Python "%(variable)s" syntax, not shell-substitution syntax.</para> - -</refsect1> - -<refsect1><title>Finding and Building Local Deliverables</title> - -<para>The following files are considered stock deliverables and may be -shipped if they are present when <application>shipper</application> -starts up:</para> - -<informaltable> -<tgroup cols="2"> -<thead> -<row> -<entry>File</entry> -<entry>Explanation</entry> -</row> -</thead> -<tbody> -<row> -<entry>README</entry> -<entry> -<para>Project roadmap file.</para> -</entry> -</row> -<row> -<entry>tarball</entry> -<entry> -<para>The current source tarball, that is the file named ${package}-${version}.tar.gz.</para> -</entry> -</row> -<row> -<entry>zipfile</entry> -<entry> -<para>The current source zip archive, that is the file named ${package}-${version}.zip.</para> -</entry> -</row> -<row> -<entry>NEWS</entry> -<entry> -<para>Project news file.</para> -</entry> -</row> -<row> -<entry>ChangeLog</entry> -<entry> -<para>Project change log.</para> -</entry> -</row> -<row> -<entry>HISTORY</entry> -<entry> -<para>Project history file.</para> -</entry> -</row> -<row> -<entry>BUGS</entry> -<entry> -<para>Project bug list.</para> -</entry> -</row> -<row> -<entry>TODO</entry> -<entry> -<para>Current to-do list.</para> -</entry> -</row> -<row> -<entry>*.html</entry> -<entry> -<para>Any files with an .html extension will be shipped to all -website destinations.</para> -</entry> -</row> -</tbody> -</tgroup> -</informaltable> - -<para>Here are the generated deliverables that -<application>shipper</application> will build and ship, if they don't -exist when it starts up. Any of these that are created will be -deleted after a successful upload.</para> - -<informaltable> -<tgroup cols="2"> -<thead> -<row> -<entry>Type</entry> -<entry>Explanation</entry> -</row> -</thead> -<tbody> -<row> -<entry>index.html</entry> -<entry> -<para>An index web page, to be shipped to any website destination.</para> -</entry> -</row> -<row> -<entry>RPMs</entry> -<entry> -<para>Source and either binary or noarch RPMs.</para> -</entry> -</row> -<row> -<entry>LSM</entry> -<entry> -<para>If the ibiblio channel is enabled, -<application>shipper</application> will generate a Linux Software Map -file for it.</para> -</entry> -</row> -<row> -<entry>CHANGES</entry> -<entry> -<para>If there is no ChangeLog file but there was a %changelog in your -specfile, <application>shipper</application> will generate a CHANGES -from the changelog entries in the specfile and ship that.</para> -</entry> -</row> -<row> -<entry>ANNOUNCE.FRESHMEAT</entry> -<entry> -<para>If there is no ANNOUNCE.FRESHMEAT file, -<application>shipper</application> will generate one. It will be a -job card that can be fed to freshmeat.net's XML-RPC interface via -<citerefentry><refentrytitle>freshmeat-submit</refentrytitle><manvolnum>1</manvolnum></citerefentry>. -</para> -</entry> -</row> -<row> -<entry>ANNOUNCE.EMAIL</entry> -<entry> -<para>If there is no ANNOUNCE.EMAIL file, <application>shipper</application> -will generate one to be emailed to destinations that are mailto URLs.</para> -</entry> -</row> -</tbody> -</tgroup> -</informaltable> -</refsect1> - -<refsect1><title>Shipping to Destinations</title> -<para>In operation, <application>shipper</application> walks through a -list of destinations, building the required deliverables for each one and -performing the required shipping actions to push them out to the -destination. Here are the channel types -<application>shipper</application> knows about:</para> - -<informaltable> -<tgroup cols="4"> -<colspec align='left'/> -<colspec align='left'/> -<colspec align='center'/> -<colspec align='left'/> -<thead> -<row> -<entry>Channel Type</entry> -<entry>Deliverables</entry> -<entry>Specified by</entry> -<entry>Explanation</entry> -</row> -</thead> -<tbody> -<row> -<entry>ibiblio</entry> -<entry>tarball, RPMs, LSM file</entry> -<entry>-</entry> -<entry> -<para>If the ibiblio channel is enabled (it is by default), -<application>shipper</application> will attempt to ship a source -tarball, RPMs, and an an LSM file to ibiblio.org via FTP. The LSM -file will be automatically generated.</para> -</entry> -</row> -<row> -<entry>redhat</entry> -<entry>RPMs</entry> -<entry>-</entry> -<entry> -<para>If the Red Hat channel is enabled (it is by default), -<application>shipper</application> will attempt to ship source -and binary RPMs to the Red Hat submission directory via FTP.</para> -</entry> -</row> -<row> -<entry>freshmeat</entry> -<entry>ANNOUNCE.FRESHMEAT</entry> -<entry>-</entry> -<entry> -<para>If the freshmeat channel is enabled (it is by default), -<application>shipper</application> will attempt to post a release -announcement on freshmeat.net using -<citerefentry><refentrytitle>freshmeat-submit</refentrytitle><manvolnum>1</manvolnum></citerefentry>. -The -announcement will include URLs for whichever of the following -deliverables are shipped, using the URL field from your specfile: tarball, -zipfile, RPMs, CHANGES. The user will be -prompted for a Freshmeat release-focus. This announcement is -generated into the local deliverable ANNOUNCE.FRESHMEAT.</para> -</entry> -</row> -<row> -<entry>Generic Web site</entry> -<entry>README, tarball, zipfile, RPMs, CHANGES, NEWS, HISTORY, *.html, -BUGS, TODO.</entry> -<entry>scp destination ([user@]host:dir)</entry> -<entry> -<para>This channel type represents a website. -<application>shipper</application> uses -<citerefentry><refentrytitle>scp</refentrytitle><manvolnum>1</manvolnum></citerefentry> -to put deliverables on websites. If the user part of the scp -destination is absent, it will be taken from the environment variable -<envar>USERNAME</envar>.</para> - -<para>No generic Web sites are shipped to by default. You must declare -them by putting scp destinations in the <varname>destinations</varname> -variable.</para> -</entry> -</row> -<row> -<entry>Generic FTP site</entry> -<entry>tarball, RPMs</entry> -<entry>FTP URL</entry> -<entry> -<para>Old-fashioned FTP site with no metadata. The FTP URL is parsed -to get the sitename and directory where deliverables should be dropped. The -FTP username to be used will be taken from the environment variable -<envar>USERNAME</envar>. The FTP password will be looked up in your -<filename>~/.netrc</filename> file.</para> - -<para>No generic FTP sites are shipped to by default. You must -declare them by putting FTP urls in the -<varname>destinations</varname> variable.</para> -</entry> -</row> -<row> -<entry>Email address</entry> -<entry>ANNOUNCE.EMAIL</entry> -<entry>mailto URL</entry> -<entry> -<para>The contents of the generated ANNOUNCE.EMAIL file is emailed to -each email address specified as a channel.</para> - -<para>No email channels are set up by default. You must -declare them by putting mailto: urls in the -<varname>destinations</varname> variable.</para> -</entry> -</row> -<row> -<entry>rsync unit</entry> -<entry>SRPM</entry> -<entry>rsync address ([user@]host::unit)</entry> -<entry> -<para>An SRPM is shipped to each destination that is rcognized as -an rsync address (by the double colon).</para> - -<para>No rsync channels are set up by default. You must -declare them by putting rsync addresses in the -<varname>destinations</varname> variable.</para> -</entry> -</row> -</tbody> -</tgroup> -</informaltable> -</refsect1> - -<refsect1><title>Command-line Options</title> - -<para>The -n option of <application>shipper</application> suppresses -uploads, just building all deliverables locally. The -N option -suppresses both uploads and builds, generating a configuration dumop -instead. The -f option forces rebuilding of local deliverables even -if they already exist. The -v option makes -<application>shipper</application> chatty about what it's doing. The --h option prints a usage message and exits.</para> - -</refsect1> - -<refsect1><title>Hints and Tips</title> -<para>The following variable definition in your makefile will ensure -that the makefile version is derived from (and thus always consistent -with) the specfile version.</para> - -<programlisting> -VERS=$(shell sed <*.spec -n -e '/Version: \(.*\)/s//\1/p') -</programlisting> - -<para>A makefile production like the following will allow -you to type <command>make release</command> and be sure that all -the deliverables <application>shipper</application> knows about -will be rebuilt before being shipped.</para> - -<programlisting> -release: <emphasis>package</emphasis>-$(VERS).tar.gz <emphasis>package</emphasis>.html - shipper -f -</programlisting> - -<para>You will want to change <emphasis>package</emphasis> to your -project name. Note that you should not use this recipe if your -project has its own (non-generated) index page, as the -f option will -overwrite <filename>index.html</filename>.</para> - -<para>To make -<citerefentry> -<refentrytitle>rpm</refentrytitle><manvolnum>1</manvolnum> -</citerefentry> -build noarch rather than binary RPMs, insert the following header in -your specfile:</para> - -<programlisting> -BuildArch: noarch -</programlisting> -</refsect1> - -<refsect1><title>Author</title> -<para>Eric S. Raymond <email>esr@thyrsus.com</email>. The buildrpms -script was originally by Sean Reifschneider.</para> - -<para>There is a project web page at -<ulink -url="http://www.catb.org/~esr/shipper/">http://www.catb.org/~esr/shipper/</ulink>.</para> -</refsect1> - -<refsect1><title>Bugs</title> -<para>The rsync channel type is untested. Shipping Debian packages -should be supported.</para> -</refsect1> - -<refsect1><title>See Also</title> - -<para> -<citerefentry> -<refentrytitle>freshmeat-submit</refentrytitle> -<manvolnum>1</manvolnum> -</citerefentry>, -<citerefentry> -<refentrytitle>lftp</refentrytitle> -<manvolnum>1</manvolnum> -</citerefentry>, -<citerefentry> -<refentrytitle>rpm2lsm</refentrytitle> -<manvolnum>1</manvolnum> -</citerefentry>, -<citerefentry> -<refentrytitle>scp</refentrytitle> -<manvolnum>1</manvolnum> -</citerefentry>, -<citerefentry> -<refentrytitle>ssh</refentrytitle> -<manvolnum>1</manvolnum> -</citerefentry>.</para> -</refsect1> -</refentry> - -<!-- -Local Variables: -compile-command: "make shipper.html" -End: ---> |
