Print this page
8564 developer/build/onbld shouldn't require ghostscript
Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>

@@ -24,11 +24,11 @@
 # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
 # Copyright 2008, 2010, Richard Lowe
 # Copyright 2012 Marcel Telka <marcel@telka.sk>
 # Copyright 2014 Bart Coddens <bart.coddens@gmail.com>
 # Copyright 2017 Nexenta Systems, Inc.
-# Copyright 2016 Joyent, Inc.
+# Copyright 2019 Joyent, Inc.
 # Copyright 2016 RackTop Systems.
 #
 
 #
 # This script takes a file list and a workspace and builds a set of html files

@@ -1278,71 +1278,10 @@
         EOF
 }
 
 
 #
-# fix_postscript
-#
-# Merge codereview output files to a single conforming postscript file, by:
-#       - removing all extraneous headers/trailers
-#       - making the page numbers right
-#       - removing pages devoid of contents which confuse some
-#         postscript readers.
-#
-# From Casper.
-#
-function fix_postscript
-{
-        infile=$1
-
-        cat > /tmp/$$.crmerge.pl << \EOF
-
-        print scalar(<>);               # %!PS-Adobe---
-        print "%%Orientation: Landscape\n";
-
-        $pno = 0;
-        $doprint = 1;
-
-        $page = "";
-
-        while (<>) {
-                next if (/^%%Pages:\s*\d+/);
-
-                if (/^%%Page:/) {
-                        if ($pno == 0 || $page =~ /\)S/) {
-                                # Header or single page containing text
-                                print "%%Page: ? $pno\n" if ($pno > 0);
-                                print $page;
-                                $pno++;
-                        } else {
-                                # Empty page, skip it.
-                        }
-                        $page = "";
-                        $doprint = 1;
-                        next;
-                }
-
-                # Skip from %%Trailer of one document to Endprolog
-                # %%Page of the next
-                $doprint = 0 if (/^%%Trailer/);
-                $page .= $_ if ($doprint);
-        }
-
-        if ($page =~ /\)S/) {
-                print "%%Page: ? $pno\n";
-                print $page;
-        } else {
-                $pno--;
-        }
-        print "%%Trailer\n%%Pages: $pno\n";
-EOF
-
-        $PERL /tmp/$$.crmerge.pl < $infile
-}
-
-
-#
 # input_cmd | insert_anchors | output_cmd
 #
 # Flag blocks of difference with sequentially numbered invisible
 # anchors.  These are used to drive the frames version of the
 # sdiffs output.

@@ -2355,12 +2294,10 @@
 
 [[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff`
 [[ -z $WX ]] && WX=`look_for_prog wx`
 [[ -z $GIT ]] && GIT=`look_for_prog git`
 [[ -z $WHICH_SCM ]] && WHICH_SCM=`look_for_prog which_scm`
-[[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview`
-[[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf`
 [[ -z $PERL ]] && PERL=`look_for_prog perl`
 [[ -z $RSYNC ]] && RSYNC=`look_for_prog rsync`
 [[ -z $SCCS ]] && SCCS=`look_for_prog sccs`
 [[ -z $AWK ]] && AWK=`look_for_prog nawk`
 [[ -z $AWK ]] && AWK=`look_for_prog gawk`

@@ -2387,17 +2324,10 @@
 if [[ ! -x $WHICH_SCM ]]; then
         print -u2 "Error: Could not find which_scm.  Exiting."
         exit 1
 fi
 
-#
-# These aren't fatal, but we want to note them to the user.
-# We don't warn on the absence of 'wx' until later when we've
-# determined that we actually need to try to invoke it.
-#
-[[ ! -x $CODEREVIEW ]] && print -u2 "WARNING: codereview(1) not found."
-[[ ! -x $PS2PDF ]] && print -u2 "WARNING: ps2pdf(1) not found."
 [[ ! -x $WDIFF ]] && print -u2 "WARNING: wdiff not found."
 
 # Declare global total counters.
 integer TOTL TINS TDEL TMOD TUNC
 

@@ -3061,12 +2991,10 @@
 # Save the file list in the webrev dir
 #
 [[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list
 
 rm -f $WDIR/$WNAME.patch
-rm -f $WDIR/$WNAME.ps
-rm -f $WDIR/$WNAME.pdf
 
 touch $WDIR/$WNAME.patch
 
 print "   Output Files:"
 

@@ -3302,35 +3230,10 @@
                 fi
                 rm -f $ofile.man.txt $nfile.man.txt
                 rm -f $WDIR/$DIR/$F.man.cdiff $WDIR/$DIR/$F.man.udiff
         fi
 
-        #
-        # Now we generate the postscript for this file.  We generate diffs
-        # only in the event that there is delta, or the file is new (it seems
-        # tree-killing to print out the contents of deleted files).
-        #
-        if [[ -f $nfile ]]; then
-                ocr=$ofile
-                [[ ! -f $ofile ]] && ocr=/dev/null
-
-                if [[ -z $mv_but_nodiff ]]; then
-                        textcomm=`getcomments text $P $PP`
-                        if [[ -x $CODEREVIEW ]]; then
-                                $CODEREVIEW -y "$textcomm" \
-                                    -e $ocr $nfile \
-                                    > /tmp/$$.psfile 2>/dev/null &&
-                                    cat /tmp/$$.psfile >> $WDIR/$WNAME.ps
-                                if [[ $? -eq 0 ]]; then
-                                        print " ps\c"
-                                else
-                                        print " ps[fail]\c"
-                                fi
-                        fi
-                fi
-        fi
-
         if [[ -f $ofile ]]; then
                 source_to_html Old $PP < $ofile > $WDIR/$DIR/$F-.html
                 print " old\c"
         fi
 

@@ -3345,20 +3248,10 @@
 done
 
 frame_nav_js > $WDIR/ancnav.js
 frame_navigation > $WDIR/ancnav.html
 
-if [[ ! -f $WDIR/$WNAME.ps ]]; then
-        print " Generating PDF: Skipped: no output available"
-elif [[ -x $CODEREVIEW && -x $PS2PDF ]]; then
-        print " Generating PDF: \c"
-        fix_postscript $WDIR/$WNAME.ps | $PS2PDF - > $WDIR/$WNAME.pdf
-        print "Done."
-else
-        print " Generating PDF: Skipped: missing 'ps2pdf' or 'codereview'"
-fi
-
 # If we're in OpenSolaris mode and there's a closed dir under $WDIR,
 # delete it - prevent accidental publishing of closed source
 
 if [[ -n "$Oflag" ]]; then
         $FIND $WDIR -type d -name closed -exec /bin/rm -rf {} \;

@@ -3435,15 +3328,10 @@
 if [[ -f $WDIR/$WNAME.patch ]]; then
         wpatch_url="$(print $WNAME.patch | url_encode)"
         print "<tr><th>Patch of changes:</th><td>"
         print "<a href=\"$wpatch_url\">$WNAME.patch</a></td></tr>"
 fi
-if [[ -f $WDIR/$WNAME.pdf ]]; then
-        wpdf_url="$(print $WNAME.pdf | url_encode)"
-        print "<tr><th>Printable review:</th><td>"
-        print "<a href=\"$wpdf_url\">$WNAME.pdf</a></td></tr>"
-fi
 
 if [[ -n "$iflag" ]]; then
         print "<tr><th>Author comments:</th><td><div>"
         cat /tmp/$$.include
         print "</div></td></tr>"