Print this page
allow webrev to be run directly from usr/src/tools/scripts/webrev


   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  25 #
  26 
  27 # Copyright 2008, 2010, Richard Lowe
  28 # Copyright 2012 Marcel Telka <marcel@telka.sk>

  29 
  30 #
  31 # This script takes a file list and a workspace and builds a set of html files
  32 # suitable for doing a code review of source changes via a web page.
  33 # Documentation is available via the manual page, webrev.1, or just
  34 # type 'webrev -h'.
  35 #
  36 # Acknowledgements to contributors to webrev are listed in the webrev(1)
  37 # man page.
  38 #
  39 
  40 REMOVED_COLOR=brown
  41 CHANGED_COLOR=blue
  42 NEW_COLOR=blue
  43 
  44 HTML='<?xml version="1.0"?>
  45 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  46     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  47 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
  48 


2921                 exit 1
2922         else
2923                 #
2924                 # $INCLUDE_FILE may be a relative path, and the script alters
2925                 # PWD, so we just stash a copy in /tmp.
2926                 #
2927                 cp $INCLUDE_FILE /tmp/$$.include
2928         fi
2929 fi
2930 
2931 # DO_EVERYTHING: break point
2932 if [[ -n $Nflag ]]; then
2933         break
2934 fi
2935 
2936 typeset -A itsinfo
2937 typeset -r its_sed_script=/tmp/$$.its_sed
2938 valid_prefixes=
2939 if [[ -z $nflag ]]; then
2940         DEFREGFILE="$(/bin/dirname "$(whence $0)")/../etc/its.reg"

2941         if [[ -n $Iflag ]]; then
2942                 REGFILE=$ITSREG
2943         elif [[ -r $HOME/.its.reg ]]; then
2944                 REGFILE=$HOME/.its.reg
2945         else
2946                 REGFILE=$DEFREGFILE


2947         fi
2948         if [[ ! -r $REGFILE ]]; then
2949                 print "ERROR: Unable to read database registry file $REGFILE"
2950                 exit 1
2951         elif [[ $REGFILE != $DEFREGFILE ]]; then
2952                 print "   its.reg from: $REGFILE"
2953         fi
2954 
2955         $SED -e '/^#/d' -e '/^[         ]*$/d' $REGFILE | while read LINE; do
2956 
2957                 name=${LINE%%=*}
2958                 value="${LINE#*=}"
2959 
2960                 if [[ $name == PREFIX ]]; then
2961                         p=${value}
2962                         valid_prefixes="${p} ${valid_prefixes}"
2963                 else
2964                         itsinfo["${p}_${name}"]="${value}"
2965                 fi
2966         done
2967 
2968 
2969         DEFCONFFILE="$(/bin/dirname "$(whence $0)")/../etc/its.conf"


2970         CONFFILES=$DEFCONFFILE



2971         if [[ -r $HOME/.its.conf ]]; then
2972                 CONFFILES="${CONFFILES} $HOME/.its.conf"
2973         fi
2974         if [[ -n $Cflag ]]; then
2975                 CONFFILES="${CONFFILES} ${ITSCONF}"
2976         fi
2977         its_domain=
2978         its_priority=
2979         for cf in ${CONFFILES}; do
2980                 if [[ ! -r $cf ]]; then
2981                         print "ERROR: Unable to read database configuration file $cf"
2982                         exit 1
2983                 elif [[ $cf != $DEFCONFFILE ]]; then
2984                         print "       its.conf: reading $cf"
2985                 fi
2986                 $SED -e '/^#/d' -e '/^[         ]*$/d' $cf | while read LINE; do
2987                     eval "${LINE}"
2988                 done
2989         done
2990 




   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  25 #
  26 
  27 # Copyright 2008, 2010, Richard Lowe
  28 # Copyright 2012 Marcel Telka <marcel@telka.sk>
  29 # Copyright 2013 PALO, Richard. All rights reserved.
  30 
  31 #
  32 # This script takes a file list and a workspace and builds a set of html files
  33 # suitable for doing a code review of source changes via a web page.
  34 # Documentation is available via the manual page, webrev.1, or just
  35 # type 'webrev -h'.
  36 #
  37 # Acknowledgements to contributors to webrev are listed in the webrev(1)
  38 # man page.
  39 #
  40 
  41 REMOVED_COLOR=brown
  42 CHANGED_COLOR=blue
  43 NEW_COLOR=blue
  44 
  45 HTML='<?xml version="1.0"?>
  46 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  47     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  48 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
  49 


2922                 exit 1
2923         else
2924                 #
2925                 # $INCLUDE_FILE may be a relative path, and the script alters
2926                 # PWD, so we just stash a copy in /tmp.
2927                 #
2928                 cp $INCLUDE_FILE /tmp/$$.include
2929         fi
2930 fi
2931 
2932 # DO_EVERYTHING: break point
2933 if [[ -n $Nflag ]]; then
2934         break
2935 fi
2936 
2937 typeset -A itsinfo
2938 typeset -r its_sed_script=/tmp/$$.its_sed
2939 valid_prefixes=
2940 if [[ -z $nflag ]]; then
2941         DEFREGFILE="$(/bin/dirname "$(whence $0)")/../etc/its.reg"
2942         DEFREGFILE0="$(/bin/dirname "$(whence $0)")/its.reg"
2943         if [[ -n $Iflag ]]; then
2944                 REGFILE=$ITSREG
2945         elif [[ -r $HOME/.its.reg ]]; then
2946                 REGFILE=$HOME/.its.reg
2947         elif [[ -r $DEFREGFILE ]]; then
2948                 REGFILE=$DEFREGFILE
2949         else
2950                 REGFILE=$DEFREGFILE0
2951         fi
2952         if [[ ! -r $REGFILE ]]; then
2953                 print "ERROR: Unable to read database registry file $REGFILE"
2954                 exit 1
2955         elif [[ $REGFILE != $DEFREGFILE ]]; then
2956                 print "   its.reg from: $REGFILE"
2957         fi
2958 
2959         $SED -e '/^#/d' -e '/^[         ]*$/d' $REGFILE | while read LINE; do
2960 
2961                 name=${LINE%%=*}
2962                 value="${LINE#*=}"
2963 
2964                 if [[ $name == PREFIX ]]; then
2965                         p=${value}
2966                         valid_prefixes="${p} ${valid_prefixes}"
2967                 else
2968                         itsinfo["${p}_${name}"]="${value}"
2969                 fi
2970         done
2971 
2972 
2973         DEFCONFFILE="$(/bin/dirname "$(whence $0)")/../etc/its.conf"
2974         DEFCONFFILE0="$(/bin/dirname "$(whence $0)")/its.conf"
2975         if [[ -r $DEFCONFFILE ]]; then
2976                 CONFFILES=$DEFCONFFILE
2977         else
2978                 CONFFILES=$DEFCONFFILE0
2979         fi
2980         if [[ -r $HOME/.its.conf ]]; then
2981                 CONFFILES="${CONFFILES} $HOME/.its.conf"
2982         fi
2983         if [[ -n $Cflag ]]; then
2984                 CONFFILES="${CONFFILES} ${ITSCONF}"
2985         fi
2986         its_domain=
2987         its_priority=
2988         for cf in ${CONFFILES}; do
2989                 if [[ ! -r $cf ]]; then
2990                         print "ERROR: Unable to read database configuration file $cf"
2991                         exit 1
2992                 elif [[ $cf != $DEFCONFFILE ]]; then
2993                         print "       its.conf: reading $cf"
2994                 fi
2995                 $SED -e '/^#/d' -e '/^[         ]*$/d' $cf | while read LINE; do
2996                     eval "${LINE}"
2997                 done
2998         done
2999