diff options
Diffstat (limited to 'usr/src/tools/scripts')
-rw-r--r-- | usr/src/tools/scripts/bldenv.sh | 3 | ||||
-rw-r--r-- | usr/src/tools/scripts/cddlchk.py | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/copyrightchk.py | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/git-pbchk.py | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/hdrchk.py | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/hg-active.py | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/mapfilechk.py | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/nightly.sh | 8 | ||||
-rw-r--r-- | usr/src/tools/scripts/validate_pkg.py | 2 | ||||
-rw-r--r-- | usr/src/tools/scripts/webrev.sh | 258 | ||||
-rw-r--r-- | usr/src/tools/scripts/wsdiff.py | 2 |
11 files changed, 156 insertions, 129 deletions
diff --git a/usr/src/tools/scripts/bldenv.sh b/usr/src/tools/scripts/bldenv.sh index f841a3cfc5..71987a44b5 100644 --- a/usr/src/tools/scripts/bldenv.sh +++ b/usr/src/tools/scripts/bldenv.sh @@ -291,9 +291,6 @@ if "${flags.t}" ; then export CTFSTABS="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfstabs" export GENOFFSETS="${TOOLS_PROTO}/opt/onbld/bin/genoffsets" - export CTFCONVERT="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfconvert" - export CTFMERGE="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfmerge" - PATH="${TOOLS_PROTO}/opt/onbld/bin/${MACH}:${PATH}" PATH="${TOOLS_PROTO}/opt/onbld/bin:${PATH}" export PATH diff --git a/usr/src/tools/scripts/cddlchk.py b/usr/src/tools/scripts/cddlchk.py index 816d2f33a7..ad6a6e6f56 100644 --- a/usr/src/tools/scripts/cddlchk.py +++ b/usr/src/tools/scripts/cddlchk.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # CDDL HEADER START # diff --git a/usr/src/tools/scripts/copyrightchk.py b/usr/src/tools/scripts/copyrightchk.py index 210ef1b46c..f778947bfc 100644 --- a/usr/src/tools/scripts/copyrightchk.py +++ b/usr/src/tools/scripts/copyrightchk.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # CDDL HEADER START # diff --git a/usr/src/tools/scripts/git-pbchk.py b/usr/src/tools/scripts/git-pbchk.py index 92303f967f..ddaa65a622 100644 --- a/usr/src/tools/scripts/git-pbchk.py +++ b/usr/src/tools/scripts/git-pbchk.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 diff --git a/usr/src/tools/scripts/hdrchk.py b/usr/src/tools/scripts/hdrchk.py index 84acbc8616..aa62f7b090 100644 --- a/usr/src/tools/scripts/hdrchk.py +++ b/usr/src/tools/scripts/hdrchk.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # CDDL HEADER START # diff --git a/usr/src/tools/scripts/hg-active.py b/usr/src/tools/scripts/hg-active.py index 88394e98e5..23f6c7cd98 100644 --- a/usr/src/tools/scripts/hg-active.py +++ b/usr/src/tools/scripts/hg-active.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 diff --git a/usr/src/tools/scripts/mapfilechk.py b/usr/src/tools/scripts/mapfilechk.py index 9cf2000c7a..ed90d8b426 100644 --- a/usr/src/tools/scripts/mapfilechk.py +++ b/usr/src/tools/scripts/mapfilechk.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # CDDL HEADER START # diff --git a/usr/src/tools/scripts/nightly.sh b/usr/src/tools/scripts/nightly.sh index a77d6f223e..842c63a295 100644 --- a/usr/src/tools/scripts/nightly.sh +++ b/usr/src/tools/scripts/nightly.sh @@ -25,6 +25,7 @@ # Copyright 2008, 2010, Richard Lowe # Copyright 2011 Nexenta Systems, Inc. All rights reserved. # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org> +# Copyright 2013 (c) Joyent, Inc. All rights reserved. # # Based on the nightly script from the integration folks, # Mostly modified and owned by mike_s. @@ -517,11 +518,6 @@ function use_tools { GENOFFSETS=${TOOLSROOT}/opt/onbld/bin/genoffsets export GENOFFSETS - CTFCONVERT=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfconvert - export CTFCONVERT - CTFMERGE=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfmerge - export CTFMERGE - if [ "$VERIFY_ELFSIGN" = "y" ]; then ELFSIGN=${TOOLSROOT}/opt/onbld/bin/elfsigncmp else @@ -541,8 +537,6 @@ function use_tools { echo "\n==== New environment settings. ====\n" >> $LOGFILE echo "STABS=${STABS}" >> $LOGFILE echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE - echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE - echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE echo "PATH=${PATH}" >> $LOGFILE echo "ONBLD_TOOLS=${ONBLD_TOOLS}" >> $LOGFILE diff --git a/usr/src/tools/scripts/validate_pkg.py b/usr/src/tools/scripts/validate_pkg.py index 6678b211e8..155df9ba25 100644 --- a/usr/src/tools/scripts/validate_pkg.py +++ b/usr/src/tools/scripts/validate_pkg.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # CDDL HEADER START # diff --git a/usr/src/tools/scripts/webrev.sh b/usr/src/tools/scripts/webrev.sh index 5fbed75864..74b02fc923 100644 --- a/usr/src/tools/scripts/webrev.sh +++ b/usr/src/tools/scripts/webrev.sh @@ -26,6 +26,7 @@ # Copyright 2012 Marcel Telka <marcel@telka.sk> # Copyright 2014 Bart Coddens <bart.coddens@gmail.com> # Copyright 2016 Nexenta Systems, Inc. +# Copyright 2016 Joyent, Inc. # # @@ -294,20 +295,20 @@ function remote_mkdirs "cannot create temporary file for batch file" return 1 fi - OLDIFS=$IFS - IFS=/ + OLDIFS=$IFS + IFS=/ typeset dir - for dir in ${dirs_mk}; do + for dir in ${dirs_mk}; do # # Use the '-' prefix to ignore mkdir errors in order # to avoid an error in case the directory already # exists. We check the directory with chdir to be sure # there is one. # - print -- "-mkdir ${dir}" >> ${batch_file_mkdir} - print "chdir ${dir}" >> ${batch_file_mkdir} - done - IFS=$OLDIFS + print -- "-mkdir ${dir}" >> ${batch_file_mkdir} + print "chdir ${dir}" >> ${batch_file_mkdir} + done + IFS=$OLDIFS typeset -r sftp_err_msg=$( $MKTEMP /tmp/webrev_scp_err.XXXXXX ) if [[ -z ${sftp_err_msg} ]]; then print "\nERROR: remote_mkdirs:" \ @@ -891,7 +892,7 @@ sdiff_to_html() print "$HTML<head>$STDHEAD" print "<title>$WNAME Sdiff $TPATH/$TNAME</title>" print "</head><body id=\"SUNWwebrev\">" - print "<a class=\"print\" href=\"javascript:print()\">Print this page</a>" + print "<a class=\"print\" href=\"javascript:print()\">Print this page</a>" print "<pre>$COMMENT</pre>\n" print "<table><tr valign=\"top\">" print "<td><pre>" @@ -969,10 +970,10 @@ function framed_sdiff <frame src="${RTOP}ancnav.html" scrolling="no" marginwidth="0" marginheight="0" name="nav"></frame> <noframes> - <body id="SUNWwebrev"> + <body id="SUNWwebrev"> Alas 'frames' webrev requires that your browser supports frames and has the feature enabled. - </body> + </body> </noframes> </frameset> </html> @@ -1110,20 +1111,20 @@ function insert_anchors # function relative_dir { - typeset cur="${1##$2?(/)}" - - # - # If the first path was specified absolutely, and it does - # not start with the second path, it's an error. - # - if [[ "$cur" = "/${1#/}" ]]; then - # Should never happen. - print -u2 "\nWARNING: relative_dir: \"$1\" not relative " - print -u2 "to \"$2\". Check input paths. Framed webrev " - print -u2 "will not be relocatable!" - print $2 - return - fi + typeset cur="${1##$2?(/)}" + + # + # If the first path was specified absolutely, and it does + # not start with the second path, it's an error. + # + if [[ "$cur" = "/${1#/}" ]]; then + # Should never happen. + print -u2 "\nWARNING: relative_dir: \"$1\" not relative " + print -u2 "to \"$2\". Check input paths. Framed webrev " + print -u2 "will not be relocatable!" + print $2 + return + fi # # This is kind of ugly. The sed script will do the following: @@ -1157,22 +1158,23 @@ function frame_nav_js { cat << \EOF var myInt; -var scrolling=0; +var scrolling = 0; var sfactor = 3; -var scount=10; +var scount = 10; -function scrollByPix() { - if (scount<=0) { - sfactor*=1.2; - scount=10; +function scrollByPix() +{ + if (scount <= 0) { + sfactor *= 1.2; + scount = 10; } - parent.lhs.scrollBy(0,sfactor); - parent.rhs.scrollBy(0,sfactor); + parent.lhs.scrollBy(0, sfactor); + parent.rhs.scrollBy(0, sfactor); scount--; } -function scrollToAnc(num) { - +function scrollToAnc(num) +{ // Update the value of the anchor in the form which we use as // storage for this value. setAncValue() will take care of // correcting for overflow and underflow of the value and return @@ -1189,8 +1191,8 @@ function scrollToAnc(num) { parent.lhs.location.replace(parent.lhs.location.pathname + "#" + num); parent.rhs.location.replace(parent.rhs.location.pathname + "#" + num); - parent.lhs.scrollBy(0,-30); - parent.rhs.scrollBy(0,-30); + parent.lhs.scrollBy(0, -30); + parent.rhs.scrollBy(0, -30); } function getAncValue() @@ -1226,50 +1228,54 @@ function setAncValue(val) return (val); } -function stopScroll() { - if (scrolling==1) { +function stopScroll() +{ + if (scrolling == 1) { clearInterval(myInt); - scrolling=0; + scrolling = 0; } } -function startScroll() { +function startScroll() +{ stopScroll(); - scrolling=1; - myInt=setInterval("scrollByPix()",10); + scrolling = 1; + myInt = setInterval("scrollByPix()", 10); } -function handlePress(b) { - +function handlePress(b) +{ switch (b) { - case 1 : + case 1: scrollToAnc(-1); break; - case 2 : + case 2: scrollToAnc(getAncValue() - 1); break; - case 3 : - sfactor=-3; + case 3: + sfactor = -3; startScroll(); break; - case 4 : - sfactor=3; + case 4: + sfactor = 3; startScroll(); break; - case 5 : + case 5: scrollToAnc(getAncValue() + 1); break; - case 6 : + case 6: scrollToAnc(999999); break; } } -function handleRelease(b) { +function handleRelease(b) +{ stopScroll(); } -function keypress(ev) { +function keypress(ev) +{ var keynum; var keychar; @@ -1288,10 +1294,15 @@ function keypress(ev) { handlePress(5); return (0); } + return (1); } -function ValidateDiffNum(){ +function ValidateDiffNum() +{ + var val; + var i; + val = parent.nav.document.diff.display.value; if (val == "EOF") { scrollToAnc(999999); @@ -1303,15 +1314,15 @@ function ValidateDiffNum(){ return; } - i=parseInt(val); - if (isNaN(i)) { - parent.nav.document.diff.display.value = getAncValue(); - } else { - scrollToAnc(i); - } - return false; -} + i = parseInt(val); + if (isNaN(i)) { + parent.nav.document.diff.display.value = getAncValue(); + } else { + scrollToAnc(i); + } + return (false); +} EOF } @@ -1582,8 +1593,8 @@ function difflines /^[0-9]*,[0-9]*c$/ { n=split(substr($1,1,length($1)-1), counts, ","); if (n != 2) { - error=2 - exit; + error=2 + exit; } # # 3,5c means lines 3 , 4 and 5 are changed, a total of 3 lines. @@ -2001,25 +2012,25 @@ function build_old_new_git if [[ "$PDIR" == "." ]]; then file="$PF" else - file="$PDIR/$PF" + file="$PDIR/$PF" fi if [[ -n $parent_webrev && -e $PWS/$PDIR/$PF ]]; then cp $PWS/$PDIR/$PF $olddir/$PDIR/$PF else - $GIT ls-tree $GIT_PARENT $file | read o_mode type o_object junk - $GIT cat-file $type $o_object > $olddir/$file 2>/dev/null - - if (( $? != 0 )); then - rm -f $olddir/$file - elif [[ -n $o_mode ]]; then - # Strip the first 3 digits, to get a regular octal mode - o_mode=${o_mode/???/} - chmod $o_mode $olddir/$file - else - # should never happen - print -u2 "ERROR: set mode of $olddir/$file" - fi + $GIT ls-tree $GIT_PARENT $file | read o_mode type o_object junk + $GIT cat-file $type $o_object > $olddir/$file 2>/dev/null + + if (( $? != 0 )); then + rm -f $olddir/$file + elif [[ -n $o_mode ]]; then + # Strip the first 3 digits, to get a regular octal mode + o_mode=${o_mode/???/} + chmod $o_mode $olddir/$file + else + # should never happen + print -u2 "ERROR: set mode of $olddir/$file" + fi fi # @@ -2033,8 +2044,8 @@ function build_old_new_git rm -rf $newdir/$file if [[ -e $CWS/$DIR/$F ]]; then - cp $CWS/$DIR/$F $newdir/$DIR/$F - chmod $(get_file_mode $CWS/$DIR/$F) $newdir/$DIR/$F + cp $CWS/$DIR/$F $newdir/$DIR/$F + chmod $(get_file_mode $CWS/$DIR/$F) $newdir/$DIR/$F fi cd $OWD } @@ -2329,7 +2340,7 @@ if [[ $SCM_MODE == "mercurial" ]]; then exit 1 fi else - testparent=${CODEMGR_WS} + testparent=${CODEMGR_WS} fi [[ -z $codemgr_ws && -n $testparent ]] && \ codemgr_ws=$(hg root -R $testparent 2>/dev/null) @@ -2343,7 +2354,7 @@ elif [[ $SCM_MODE == "git" ]]; then # [[ -z $codemgr_ws && -n $CODEMGR_WS ]] && \ codemgr_ws=$($GIT --git-dir=$CODEMGR_WS/.git rev-parse --git-dir \ - 2>/dev/null) + 2>/dev/null) [[ -z $codemgr_ws ]] && \ codemgr_ws=$($GIT rev-parse --git-dir 2>/dev/null) @@ -2607,13 +2618,16 @@ elif [[ $SCM_MODE == "git" ]]; then this_branch=$($GIT branch | nawk '$1 == "*" { print $2 }') par_branch="origin/master" - # If we're not on a branch there's nothing we can do - if [[ $this_branch != "(no branch)" ]]; then - $GIT for-each-ref \ - --format='%(refname:short) %(upstream:short)' refs/heads/ | \ - while read local remote; do \ - [[ "$local" == "$this_branch" ]] && par_branch="$remote"; \ - done + # If we're not on a branch there's nothing we can do + if [[ $this_branch != "(no branch)" ]]; then + $GIT for-each-ref \ + --format='%(refname:short) %(upstream:short)' \ + refs/heads/ | \ + while read local remote; do + if [[ "$local" == "$this_branch" ]]; then + par_branch="$remote" + fi + done fi if [[ -z $codemgr_parent ]]; then @@ -2697,26 +2711,28 @@ elif [[ $SCM_MODE == "subversion" ]]; then flist_from_subversion $CWS $OLDPWD fi else - if [[ $SCM_MODE == "unknown" ]]; then - print -u2 " Unknown type of SCM in use" - else - print -u2 " Unsupported SCM in use: $SCM_MODE" - fi + if [[ $SCM_MODE == "unknown" ]]; then + print -u2 " Unknown type of SCM in use" + else + print -u2 " Unsupported SCM in use: $SCM_MODE" + fi - env_from_flist + env_from_flist - if [[ -z $CODEMGR_WS ]]; then - print -u2 "SCM not detected/supported and CODEMGR_WS not specified" - exit 1 - fi + if [[ -z $CODEMGR_WS ]]; then + print -u2 "SCM not detected/supported and " \ + "CODEMGR_WS not specified" + exit 1 + fi - if [[ -z $CODEMGR_PARENT ]]; then - print -u2 "SCM not detected/supported and CODEMGR_PARENT not specified" - exit 1 - fi + if [[ -z $CODEMGR_PARENT ]]; then + print -u2 "SCM not detected/supported and " \ + "CODEMGR_PARENT not specified" + exit 1 + fi - CWS=$CODEMGR_WS - PWS=$CODEMGR_PARENT + CWS=$CODEMGR_WS + PWS=$CODEMGR_PARENT fi # @@ -2871,7 +2887,12 @@ done # # Output directory. # -WDIR=${WDIR:-$CWS/webrev} +if [[ $SCM_MODE == "git" ]]; then + ws_top_dir=$(dirname $CWS) + WDIR=${WDIR:-$ws_top_dir/webrev} +else + WDIR=${WDIR:-$CWS/webrev} +fi # # Name of the webrev, derived from the workspace name or output directory; @@ -3068,7 +3089,7 @@ do F=${P##*/} - else + else DIR=${P%/*} if [[ "$DIR" == "$P" ]]; then DIR="." # File at root of workspace @@ -3104,8 +3125,22 @@ do # OWD=$PWD cd $WDIR/raw_files - ofile=old/$PDIR/$PF - nfile=new/$DIR/$F + + # + # The "git apply" command does not tolerate the spurious + # "./" that we otherwise insert; be careful not to include + # it in the paths that we pass to diff(1). + # + if [[ $PDIR == "." ]]; then + ofile=old/$PF + else + ofile=old/$PDIR/$PF + fi + if [[ $DIR == "." ]]; then + nfile=new/$F + else + nfile=new/$DIR/$F + fi mv_but_nodiff= cmp $ofile $nfile > /dev/null 2>&1 @@ -3120,7 +3155,7 @@ do # - renames must be handled specially: we emit a 'remove' # diff and an 'add' diff # - new files and deleted files must be handled specially - # - GNU patch doesn't interpret the output of illumos diff + # - GNU patch doesn't interpret the output of illumos diff # properly when it comes to adds and deletes. We need to # do some "cleansing" transformations: # [to add a file] @@ -1,0 +X,Y @@ --> @@ -0,0 +X,Y @@ @@ -3566,6 +3601,7 @@ do fi if [[ $SCM_MODE == "mercurial" || + $SCM_MODE == "git" || $SCM_MODE == "unknown" ]]; then # Include warnings for important file mode situations: # 1) New executable files diff --git a/usr/src/tools/scripts/wsdiff.py b/usr/src/tools/scripts/wsdiff.py index 27458f43fc..4ae79e889f 100644 --- a/usr/src/tools/scripts/wsdiff.py +++ b/usr/src/tools/scripts/wsdiff.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!ON_PYTHON_26 # # CDDL HEADER START # |