diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/tools/SUNWonbld/prototype_com | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/Makefile | 4 | ||||
-rw-r--r-- | usr/src/tools/scripts/its.conf | 43 | ||||
-rw-r--r-- | usr/src/tools/scripts/its.reg | 156 | ||||
-rw-r--r-- | usr/src/tools/scripts/webrev.1 | 43 | ||||
-rw-r--r-- | usr/src/tools/scripts/webrev.sh | 219 |
6 files changed, 399 insertions, 68 deletions
diff --git a/usr/src/tools/SUNWonbld/prototype_com b/usr/src/tools/SUNWonbld/prototype_com index bbe803b725..741605d619 100644 --- a/usr/src/tools/SUNWonbld/prototype_com +++ b/usr/src/tools/SUNWonbld/prototype_com @@ -165,6 +165,8 @@ f none opt/onbld/etc/abi/exceptions 444 root bin f none opt/onbld/etc/abi/ABI_i386.db 444 root bin f none opt/onbld/etc/abi/ABI_sparc.db 444 root bin f none opt/onbld/etc/hgstyle 644 root bin +f none opt/onbld/etc/its.conf 644 root bin +f none opt/onbld/etc/its.reg 644 root bin d none opt/onbld/gk 755 root bin f none opt/onbld/gk/.cshrc 644 root bin f none opt/onbld/gk/.login 644 root bin diff --git a/usr/src/tools/scripts/Makefile b/usr/src/tools/scripts/Makefile index a3df5d4e4d..f18b4f2583 100644 --- a/usr/src/tools/scripts/Makefile +++ b/usr/src/tools/scripts/Makefile @@ -112,7 +112,9 @@ MAKEFILES= \ xref.mk ETCFILES= \ - hgstyle + hgstyle \ + its.conf \ + its.reg CLEANFILES = $(SHFILES) $(PERLFILES) $(PYFILES) bldenv.1 diff --git a/usr/src/tools/scripts/its.conf b/usr/src/tools/scripts/its.conf new file mode 100644 index 0000000000..2cb704c70e --- /dev/null +++ b/usr/src/tools/scripts/its.conf @@ -0,0 +1,43 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# configuration file for information tracking systems +# + +# +# This setting determines the domain used to resolve internal URLs +# +its_domain="sun.com" + +# +# This setting determines the priority with which an application will +# resolve information system references. +# +# It should be a list (white space separated) of prefixes +# from the corresponding its.reg file. +# +its_priority="sun arc doo" diff --git a/usr/src/tools/scripts/its.reg b/usr/src/tools/scripts/its.reg new file mode 100644 index 0000000000..1b0e5a1461 --- /dev/null +++ b/usr/src/tools/scripts/its.reg @@ -0,0 +1,156 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + + + +# +# This file constitutes an informal registry for information tracking +# systems. Its intended use is to facilitate resolving references to +# multiple such systems in SCM-embedded comments. +# +# Systems are listed alphabetically by unique PREFIX. No priority of +# reference should be inferred from this ordering. Applications +# using this information should provide their own methods to prioritize +# systems of record. +# + + + +# +# The following fields are valid for each information tracking system. +# Fields not designated as required are optional. +# +# PREFIX (required) +# +# A unique, three-character abbreviation. Please avoid generic +# terms like "bug," and instead use something derivative of the name +# or URL of the actual system. +# +# INFO +# +# A URL for additional information about the system. Should be the +# home page, essentially. +# +# EXTERNAL_URL (required) +# +# A URL to resolve reference to a unique key. See NOTES below. +# +# INTERNAL_URL_domain +# +# A URL that is valid only in the specified domain. Arbitrarily many +# INTERNAL_URLs may be provided. Define only if different from EXTERNAL_URL +# in specified domain. +# +# REGEX (required) +# +# A regexp(5) to tokenize a valid, unique key. See NOTES below. +# +# CONTACT +# +# A valid e-mail address for support of the system. +# + + + +# +# NOTES +# +# REGEX should use parenthesization via \(\) to provide one or more +# tokens to be substituted in *_URLs. See regexp(5) for syntax. +# +# A REGEX for a particular system is required to match any unique keys +# that are valid for that system. For the common case, where such a key +# is numeric, it may be matched by the REGEX entries for multiple systems. +# Resolution of such ambiguity may be accomplished through prioritization +# or use of PREFIX, and is left to individual applications. +# + + + +# +# The case logs for Sun Microsystems, Inc. Architecture Review Committees. +# The database for this system is inside Sun's firewall, so the access URLs +# are different on- and off-SWAN. The off-SWAN URL actually references a +# redacted, external mirror of the internal database. +# +PREFIX=arc +INFO=http://opensolaris.org/os/community/arc/ +EXTERNAL_URL=http://arc.opensolaris.org/caselog/\\1/\\2/\\3 +INTERNAL_URL_sun.com=http://sac.eng.sun.com/Archives/CaseLog/arc/\\1/\\2/\\3 +REGEX=\\([A-Z]\\{1\,2\\}ARC\\)[ \\/]\\([0-9]\\{4\\}\\)\\/\\([0-9]\\{3\\}\\) +CONTACT=arc-discuss@opensolaris.org + +# +# grommit is maintained by stevel, and was used for early tools work +# in the scm-migration project. +# +PREFIX=bgc +INFO=http://bugs.grommit.com/ +EXTERNAL_URL=http://bugs.grommit.com/show_bug.cgi?id=\\1 +REGEX=\\([0-9]\\{1\,5\\}\\) +CONTACT= + +# +# This is the bugzilla instance on opensolaris.org. +# +PREFIX=doo +INFO=http://defect.opensolaris.org/bz/ +EXTERNAL_URL=http://defect.opensolaris.org/bz/show_bug.cgi?id=\\1 +REGEX=\\([0-9]\\{1\,6\\}\\) +CONTACT=tools-discuss@opensolaris.org + +# +# This is the bugzilla instance on freedesktop.org, used by X.Org and a +# variety of open source desktop modules shared by multiple desktops. +# +PREFIX=fdo +INFO=http://bugs.freedesktop.org/ +EXTERNAL_URL=http://bugs.freedesktop.org/show_bug.cgi?id=\\1 +REGEX=\\([0-9]\\{1\,6\\}\\) +CONTACT=sitewranglers@lists.freedesktop.org + +# +# The Roundup instance used at Selenic to track defects in Mercurial. +# +PREFIX=mer +INFO=http://roundup.sourceforge.net/doc-1.0/ +EXTERNAL_URL=http://www.selenic.com/mercurial/bts/issue\\1 +REGEX=\\([0-9]\\{1\,5\\}\\) +CONTACT= + +# +# The proprietary defect tracking system used by Sun Microsystems, Inc. +# The database for this system is inside Sun's firewall, so the access URLs +# are different on- and off-SWAN. The off-SWAN URL provides restricted, +# redacted access to the internal database through a controlled boundary +# system. +# +PREFIX=sun +INFO=http://bugs.opensolaris.org/ +EXTERNAL_URL=http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=\\1 +INTERNAL_URL_sun.com=http://monaco.sfbay.sun.com/detail.jsf?cr=\\1 +REGEX=\\([0-9]\\{7\\}\\) +CONTACT=opendev-discuss@opensolaris.org diff --git a/usr/src/tools/scripts/webrev.1 b/usr/src/tools/scripts/webrev.1 index 2e5a1c6895..9832914fbe 100644 --- a/usr/src/tools/scripts/webrev.1 +++ b/usr/src/tools/scripts/webrev.1 @@ -18,11 +18,11 @@ .\" .\" CDDL HEADER END .\" -.\" Copyright 2008 Sun Microsystems, Inc. All rights reserved. +.\" Copyright 2009 Sun Microsystems, Inc. All rights reserved. .\" Use is subject to license terms. .\" .\" -.TH webrev 1 "5 Dec 2008" +.TH webrev 1 "24 Mar 2009" .SH NAME webrev \- Generate HTML codereview materials .SH SYNOPSIS @@ -89,10 +89,10 @@ For example: .fi .PP In the index file, each file is listed on a line with a link to the -relevant review materials. Comments for each delta will be included -automatically. Bug numbers (any sequence of 5 or more digits) and ARC -cases (ARC name followed by year/number, e.g. PSARC/2003/436) in the -comment will become hyperlinks in the associated web interface. +relevant review materials. Comments for each change will be included +automatically. Cross references to bug (or other information) tracking +databases in the comments will become hyperlinks in the associated web +interface, according to the rules in CROSS REFERENCING below. As a review aid, content may be added to the \fIindex\fR file in two ways. First, the author may manually edit the file (for example by including @@ -185,8 +185,24 @@ from the .PP The file list will be created from the output of the "svn status" command. +.SH CROSS REFERENCING +.PP +After extracting comments (see FILE LIST below), +.B webrev +will translate cross references into hyperlinks. By default, information +about available information tracking systems can be found in +/opt/onbld/etc/its.reg, and the specification of a local domain and +selection and prioritization of systems +in /opt/onbld/etc/its.conf. These file formats are self documenting. Also +see the -I and -C options below. .SH OPTIONS .TP 10 +.BI "-C " priority-file +In addition to the system default and an optional user-supplied ~/.its.conf, +use the specified file to specify a local domain list and prioritize the list +of information tracking systems to be searched automatically when resolving cross +references. +.TP 10 .BI "-D" Delete remote webrev via SFTP. Default remote host is \fIcr.opensolaris.org\fR, default remote directory for removal is the same as workspace/repository @@ -199,6 +215,9 @@ expected that the remote host periodically runs a script which deletes the contents of this directory. See the ENVIRONMENT VARIABLES section for more details about this directory. .TP 10 +.BI "-I " information-file +Use the specified file to seed the list of information tracking systems. +.TP 10 .BI "-i " include-file Include the specified file into the index.html file which is generated as part of the webrev. This allows a snippet of XHTML to be added by @@ -220,10 +239,10 @@ Suppress all comments from all output forms html, txt and pdf. Do not generate webrev. Useful whenever only upload is needed. .TP 10 .B -O -Enable \fIOpenSolaris\fR mode: bug links are generated relative to -\fIbugs.opensolaris.org\fR, SAC links are generated relative to -\fIwww.opensolaris.org\fR, and sources which appear in \fIusr/closed\fR -are automatically elided from the review. +Enable \fIOpenSolaris\fR mode: information tracking system hyperlinks +are generated using the EXTERNAL_URL field from the specified its.reg entry, +instead of the default INTERNAL_URL_domain field, and sources which appear in +\fIusr/closed\fR are automatically elided from the review. .TP 10 .BI "-o " output-dir Place output from running the script in the directory specified. If @@ -349,10 +368,6 @@ respectively; their default values are "diff -b -C 5" and "diff -b -U with more (or less) strict whitespace handling, set one or both of these variables in the user environment accordingly. -\fBWEBREV_BUGURL\fR may be set to an alternate bug-to-HTML interface -(providing the BUG number can be appended to the URL). The default -URL is "http://monaco.sfbay.sun.com/detail.jsp?cr=". - \fBWDIR\fR sets the output directory. It is functionally equivalent to the \fI-o\fR option. diff --git a/usr/src/tools/scripts/webrev.sh b/usr/src/tools/scripts/webrev.sh index a7694b24cb..bedb3178da 100644 --- a/usr/src/tools/scripts/webrev.sh +++ b/usr/src/tools/scripts/webrev.sh @@ -511,30 +511,14 @@ html_quote() } # -# input_cmd | bug2url | output_cmd +# input_cmd | its2url | output_cmd # -# Scan for bugids and insert <a> links to the relevent bug database. +# Scan for information tracking system references and insert <a> links to the +# relevant databases. # -bug2url() +its2url() { - $SED -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL'&\">&</a>|g' -} - -# -# input_cmd | sac2url | output_cmd -# -# Scan for ARC cases and insert <a> links to the relevent SAC database. -# This is slightly complicated because inside the SWAN, SAC cases are -# grouped by ARC: PSARC/2006/123. But on OpenSolaris.org, they are -# referenced as 2006/123 (without labelling the ARC). -# -sac2url() -{ - if [[ -z "$Oflag" ]]; then - $SED -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}\)/\([0-9]\{3\}\)|<a href=\"'$SACURL'/\1/\2/\3\">\1 \2/\3</a>|g' - else - $SED -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}\)/\([0-9]\{3\}\)|<a href=\"'$SACURL'/\2/\3\">\1 \2/\3</a>|g' - fi + $SED -f ${its_sed_script} } # @@ -1058,7 +1042,7 @@ function relative_dir # If the first path was specified absolutely, and it does # not start with the second path, it's an error. # - if [[ $1 =~ '^/.+' && "$cur" == "$1" ]]; then + if [[ "$cur" = "/${1#/}" ]]; then # Should never happen. print -u2 "\nWARNING: relative_dir: \"$1\" not relative " print -u2 "to \"$2\". Check input paths. Framed webrev " @@ -1082,11 +1066,12 @@ function relative_dir # the caller doesn't need to duplicate this logic, and does # not end up using $RTOP/file for files in $WDIR. # - print $(print $cur | $SED -e '{ - s:^\./*:: - s:/$:: - s:[^/][^/]*:..:g - }' -e 's:^\(..*\)$:\1/:') + print $cur | $SED -e '{ + s:^\./*:: + s:/$:: + s:[^/][^/]*:..:g + s:^\(..*\)$:\1/: + }' } # @@ -1474,7 +1459,7 @@ comments_from_teamware() fi $SCCS prs -l -r$sid1 $cfile 2>/dev/null | \ - html_quote | bug2url | sac2url | $AWK "$nawkprg" + html_quote | its2url | $AWK "$nawkprg" fi } @@ -1510,7 +1495,7 @@ comments_from_wx() return fi - print -- "$comm" | html_quote | bug2url | sac2url + print -- "$comm" | html_quote | its2url } @@ -2093,8 +2078,10 @@ function usage webrev [common-options] -w <wx file> Options: + -C <filename>: Use <filename> for the information tracking configuration. -D: delete remote webrev -i <filename>: Include <filename> in the index.html file. + -I <filename>: Use <filename> for the information tracking registry. -n: do not generate the webrev (useful with -U) -O: Print bugids/arc cases suitable for OpenSolaris. -o <outdir>: Output webrev to specified directory. @@ -2105,8 +2092,6 @@ Options: Environment: WDIR: Control the output directory. - WEBREV_BUGURL: Control the URL prefix for bugids. - WEBREV_SACURL: Control the URL prefix for ARC cases. WEBREV_TRASH_DIR: Set directory for webrev delete. SCM Specific Options: @@ -2183,10 +2168,12 @@ typeset -r DEFAULT_REMOTE_HOST="cr.opensolaris.org" typeset -r rsync_prefix="rsync://" typeset -r ssh_prefix="ssh://" +Cflag= Dflag= flist_mode= flist_file= iflag= +Iflag= lflag= Nflag= nflag= @@ -2203,14 +2190,20 @@ remote_target= # NOTE: when adding/removing options it is necessary to sync the list # with usr/src/tools/onbld/hgext/cdm.py # -while getopts "i:o:p:lwONnt:UD" opt +while getopts "C:tDi:I:lnNo:Op::Uw" opt do case $opt in + C) Cflag=1 + ITSCONF=$OPTARG;; + D) Dflag=1;; i) iflag=1 INCLUDE_FILE=$OPTARG;; + I) Iflag=1 + ITSREG=$OPTARG;; + # # If -l has been specified, we need to abort further options # processing, because subsequent arguments are going to be @@ -2261,6 +2254,22 @@ if [[ -n $tflag && -z $Uflag && -z $Dflag ]]; then fi # +# If the command line options indicate no webrev generation, either +# explicitly (-n) or implicitly (-D but not -U), then there's a whole +# ton of logic we can skip. +# +# Instead of increasing indentation, we intentionally leave this loop +# body open here, and exit via break from multiple points within. +# Search for DO_EVERYTHING below to find the break points and closure. +# +for do_everything in 1; do + +# DO_EVERYTHING: break point +if [[ -n $nflag || ( -z $Uflag && -n $Dflag ) ]]; then + break +fi + +# # If this manually set as the parent, and it appears to be an earlier webrev, # then note that fact and set the parent to the raw_files/new subdirectory. # @@ -2620,6 +2629,131 @@ if [[ -n $iflag ]]; then fi fi +# DO_EVERYTHING: break point +if [[ -n $Nflag ]]; then + break +fi + +typeset -A itsinfo +typeset -r its_sed_script=/tmp/$$.its_sed +valid_prefixes= +if [[ -z $nflag ]]; then + DEFREGFILE="$(dirname $(whence $0))/../etc/its.reg" + if [[ -n $Iflag ]]; then + REGFILE=$ITSREG + elif [[ -r $HOME/.its.reg ]]; then + REGFILE=$HOME/.its.reg + else + REGFILE=$DEFREGFILE + fi + if [[ ! -r $REGFILE ]]; then + print "ERROR: Unable to read database registry file $REGFILE" + exit 1 + elif [[ $REGFILE != $DEFREGFILE ]]; then + print " its.reg from: $REGFILE" + fi + + $SED -e '/^#/d' -e '/^[ ]*$/d' $REGFILE | while read LINE; do + + name=${LINE%%=*} + value="${LINE#*=}" + + if [[ $name == PREFIX ]]; then + p=${value} + valid_prefixes="${p} ${valid_prefixes}" + else + itsinfo["${p}_${name}"]="${value}" + fi + done + + + DEFCONFFILE="$(dirname $(whence $0))/../etc/its.conf" + CONFFILES=$DEFCONFFILE + if [[ -r $HOME/.its.conf ]]; then + CONFFILES="${CONFFILES} $HOME/.its.conf" + fi + if [[ -n $Cflag ]]; then + CONFFILES="${CONFFILES} ${ITSCONF}" + fi + its_domain= + its_priority= + for cf in ${CONFFILES}; do + if [[ ! -r $cf ]]; then + print "ERROR: Unable to read database configuration file $cf" + exit 1 + elif [[ $cf != $DEFCONFFILE ]]; then + print " its.conf: reading $cf" + fi + $SED -e '/^#/d' -e '/^[ ]*$/d' $cf | while read LINE; do + eval "${LINE}" + done + done + + # + # If an information tracking system is explicitly identified by prefix, + # we want to disregard the specified priorities and resolve it accordingly. + # + # To that end, we'll build a sed script to do each valid prefix in turn. + # + for p in ${valid_prefixes}; do + # + # When an informational URL was provided, translate it to a + # hyperlink. When omitted, simply use the prefix text. + # + if [[ -z ${itsinfo["${p}_INFO"]} ]]; then + itsinfo["${p}_INFO"]=${p} + else + itsinfo["${p}_INFO"]="<a href=\\\"${itsinfo["${p}_INFO"]}\\\">${p}</a>" + fi + + # + # Assume that, for this invocation of webrev, all references + # to this information tracking system should resolve through + # the same URL. + # + # If the caller specified -O, then always use EXTERNAL_URL. + # + # Otherwise, look in the list of domains for a matching + # INTERNAL_URL. + # + [[ -z $Oflag ]] && for d in ${its_domain}; do + if [[ -n ${itsinfo["${p}_INTERNAL_URL_${d}"]} ]]; then + itsinfo["${p}_URL"]="${itsinfo[${p}_INTERNAL_URL_${d}]}" + break + fi + done + if [[ -z ${itsinfo["${p}_URL"]} ]]; then + itsinfo["${p}_URL"]="${itsinfo[${p}_EXTERNAL_URL]}" + fi + + # + # Turn the destination URL into a hyperlink + # + itsinfo["${p}_URL"]="<a href=\\\"${itsinfo[${p}_URL]}\\\">&</a>" + + print "/^${p}[ ]/ { + s;${itsinfo[${p}_REGEX]};${itsinfo[${p}_URL]};g + s;^${p};${itsinfo[${p}_INFO]}; + }" >> ${its_sed_script} + done + + # + # The previous loop took care of explicit specification. Now use + # the configured priorities to attempt implicit translations. + # + for p in ${its_priority}; do + print "/^${itsinfo[${p}_REGEX]}[ ]/ { + s;${itsinfo[${p}_REGEX]};${itsinfo[${p}_URL]};g + }" >> ${its_sed_script} + done +fi + +# +# Search for DO_EVERYTHING above for matching "for" statement +# and explanation of this terminator. +# +done + # # Output directory. # @@ -2741,27 +2875,6 @@ print " Output to: $WDIR" # [[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list -# -# Bug IDs will be replaced by a URL. Order of precedence -# is: default location, $WEBREV_BUGURL, the -O flag. -# -BUGURL='http://monaco.sfbay.sun.com/detail.jsp?cr=' -[[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL" -[[ -n "$Oflag" ]] && \ - BUGURL='http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=' - -# -# Likewise, ARC cases will be replaced by a URL. Order of precedence -# is: default, $WEBREV_SACURL, the -O flag. -# -# Note that -O also triggers different substitution behavior for -# SACURL. See sac2url(). -# -SACURL='http://sac.eng.sun.com' -[[ -n $WEBREV_SACURL ]] && SACURL="$WEBREV_SACURL" -[[ -n "$Oflag" ]] && \ - SACURL='http://www.opensolaris.org/os/community/arc/caselog' - rm -f $WDIR/$WNAME.patch rm -f $WDIR/$WNAME.ps rm -f $WDIR/$WNAME.pdf |