summaryrefslogtreecommitdiff
path: root/usr/src/tools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/tools/scripts')
-rw-r--r--usr/src/tools/scripts/Install.1onbld3
-rw-r--r--usr/src/tools/scripts/Makefile17
-rw-r--r--usr/src/tools/scripts/bldenv.sh33
-rw-r--r--usr/src/tools/scripts/git-pbchk.1onbld83
-rw-r--r--usr/src/tools/scripts/git-pbchk.py29
5 files changed, 93 insertions, 72 deletions
diff --git a/usr/src/tools/scripts/Install.1onbld b/usr/src/tools/scripts/Install.1onbld
index f560091427..b2ce79c464 100644
--- a/usr/src/tools/scripts/Install.1onbld
+++ b/usr/src/tools/scripts/Install.1onbld
@@ -21,6 +21,8 @@
.\"
.\" CDDL HEADER END
.\"
+.\" Copyright 2018 Joyent, Inc.
+.\"
.TH INSTALL 1ONBLD "Jan 14, 2010"
.SH NAME
Install \- install a kernel from an ON workspace
@@ -285,7 +287,6 @@ In order to use the most convenient form of
.BR Install " (``" "Install -t machine:/" "''),"
you will need to do the following on the target machine:
.LP
-.br
.nf
(1) add your machine name to the /etc/hosts.equiv file
.fi
diff --git a/usr/src/tools/scripts/Makefile b/usr/src/tools/scripts/Makefile
index be65637a17..e98068051d 100644
--- a/usr/src/tools/scripts/Makefile
+++ b/usr/src/tools/scripts/Makefile
@@ -22,7 +22,8 @@
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
#
# Copyright 2010, Richard Lowe
-# Copyright 2017 Joyent, Inc.
+#
+# Copyright 2018 Joyent, Inc.
SHELL=/usr/bin/ksh93
@@ -116,9 +117,6 @@ EXCEPTFILES= \
CLEANFILES = $(SHFILES) $(PERLFILES) $(PYFILES) bldenv.1onbld onu.sh
-onu.sh: onu.sh.in
- $(SED) -e "s:@PYTHON_VERSION@:$(PYTHON_VERSION):g" < onu.sh.in > $@
-
include ../Makefile.tools
ROOTONBLDSCRIPTLINKS = $(SCRIPTLINKS:%=$(ROOTONBLDBIN)/%)
@@ -135,6 +133,9 @@ $(ROOTONBLDMAN1ONBLDFILES) := FILEMODE= 644
all: $(SHFILES) $(PERLFILES) $(PERLMODULES) $(PYFILES) \
$(MAN1ONBLDFILES) $(MAKEFILES)
+onu.sh: onu.sh.in
+ $(SED) -e "s:@PYTHON_VERSION@:$(PYTHON_VERSION):g" < onu.sh.in > $@
+
$(ROOTONBLDBIN)/git-nits:
$(RM) $(ROOTONBLDBIN)/git-nits
$(SYMLINK) git-pbchk $(ROOTONBLDBIN)/git-nits
@@ -165,7 +166,8 @@ bldenv.1onbld: bldenv
$(RM) "$@"
(set +o errexit ; ksh93 $? --nroff ; true) 2>&1 | \
sed -e 's/\.DS/.nf/g;s/\.DE/.fi/' \
- -e 's/\.TH BLDENV 1/.TH BLDENV 1ONBLD/' \
+ -e 's/\.TH BLDENV 1/.TH BLDENV 1ONBLD "September 4, 2018"/' \
+ -e 's/.OP \([a-z]\) - flag -/.OP \\-\1/g' \
-e 's/(1)/(1ONBLD)/' > "$@"
nightly: nightly.sh stdenv.sh
@@ -173,5 +175,10 @@ nightly: nightly.sh stdenv.sh
sed -e '/# STDENV_START/ r stdenv.sh' nightly.sh > nightly
$(CHMOD) +x "$@"
+#
+# Not run by default: bootstrap...
+check:
+ $(ROOTONBLDBINMACH)/mandoc -Tlint -Wwarning $(MAN1ONBLDFILES)
+
include ../Makefile.targ
diff --git a/usr/src/tools/scripts/bldenv.sh b/usr/src/tools/scripts/bldenv.sh
index 76e5d81e58..4bb89be623 100644
--- a/usr/src/tools/scripts/bldenv.sh
+++ b/usr/src/tools/scripts/bldenv.sh
@@ -24,6 +24,7 @@
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
+# Copyright 2018 Joyent, Inc.
#
# Uses supplied "env" file, based on /opt/onbld/etc/env, to set shell variables
# before spawning a shell for doing a release-style builds interactively
@@ -69,7 +70,8 @@ typeset -r USAGE=$'+
[c?force the use of csh, regardless of the value of $SHELL.]
[f?invoke csh with the -f (fast-start) option. This option is valid
only if $SHELL is unset or if it points to csh.]
-[d?set up environment for doing DEBUG builds (default is non-DEBUG)]
+[d?set up environment for doing DEBUG builds. The default is non-DEBUG,
+ unless the -F flag is specified in the nightly file.]
[t?set up environment to use the tools in usr/src/tools (this is the
default, use +t to use the tools from /opt/onbld)]
@@ -127,21 +129,22 @@ typeset flags=(
typeset d=false
typeset o=false
)
+ typeset d_set=false
+ typeset DF_build=false
)
typeset progname="$(basename -- "${0}")"
OPTIND=1
-SUFFIX="-nd"
-while getopts -a "${progname}" "${USAGE}" OPT ; do
+while getopts -a "${progname}" "${USAGE}" OPT ; do
case ${OPT} in
c) flags.c=true ;;
+c) flags.c=false ;;
f) flags.f=true ;;
+f) flags.f=false ;;
- d) flags.d=true SUFFIX="" ;;
- +d) flags.d=false SUFFIX="-nd" ;;
+ d) flags.d=true ; flags.d_set=true ;;
+ +d) flags.d=false ; flags.d_set=true ;;
t) flags.t=true ;;
+t) flags.t=false ;;
\?) usage ;;
@@ -235,10 +238,18 @@ do
case "$FLAG" in
t) flags.t=true ;;
+t) flags.t=false ;;
+ F) flags.DF_build=true ;;
*) ;;
esac
done
+# DEBUG is a little bit complicated. First, bldenv -d/+d over-rides
+# the env file. Otherwise, we'll default to DEBUG iff we are *not*
+# building non-DEBUG bits at all.
+if [ "${flags.d_set}" != "true" ] && "${flags.DF_build}"; then
+ flags.d=true
+fi
+
POUND_SIGN="#"
# have we set RELEASE_DATE in our env file?
if [ -z "$RELEASE_DATE" ]; then
@@ -252,12 +263,14 @@ export DEV_CM RELEASE_DATE POUND_SIGN
print 'Build type is \c'
if ${flags.d} ; then
print 'DEBUG'
+ SUFFIX=""
unset RELEASE_BUILD
unset EXTRA_OPTIONS
unset EXTRA_CFLAGS
else
# default is a non-DEBUG build
print 'non-DEBUG'
+ SUFFIX="-nd"
export RELEASE_BUILD=
unset EXTRA_OPTIONS
unset EXTRA_CFLAGS
@@ -266,18 +279,18 @@ fi
# update build-type variables
PKGARCHIVE="${PKGARCHIVE}${SUFFIX}"
-# Set PATH for a build
+# Set PATH for a build
PATH="/opt/onbld/bin:/opt/onbld/bin/${MACH}:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/etc:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
-if [[ "${SUNWSPRO}" != "" ]]; then
- export PATH="${SUNWSPRO}/bin:$PATH"
-fi
+if [[ "${SUNWSPRO}" != "" ]]; then
+ export PATH="${SUNWSPRO}/bin:$PATH"
+fi
if [[ -n "${MAKE}" ]]; then
if [[ -x "${MAKE}" ]]; then
export PATH="$(dirname -- "${MAKE}"):$PATH"
else
print "\$MAKE (${MAKE}) is not a valid executible"
- exit 1
+ exit 1
fi
fi
diff --git a/usr/src/tools/scripts/git-pbchk.1onbld b/usr/src/tools/scripts/git-pbchk.1onbld
index 1a05b5b84f..5876caef63 100644
--- a/usr/src/tools/scripts/git-pbchk.1onbld
+++ b/usr/src/tools/scripts/git-pbchk.1onbld
@@ -12,85 +12,72 @@
.\"
.\" Copyright 2011 Richard Lowe.
.\" Copyright 2015 Elysium Digital, L.L.C.
+.\" Copyright 2018 Joyent, Inc.
.\"
-.TH "GIT\-PBCHK" "1ONBLD" "April 23, 2015" "" ""
+.TH "GIT\-PBCHK" "1ONBLD" "September 4, 2018" "" ""
.SH "NAME"
\fBgit\-pbchk\fR \- nits and pre\-putback checks for git
.SH "SYNOPSIS"
-git\-pbchk [\-b \fIbranch\fR]
+git\-pbchk [\-c \fIcheck\fR] [\-p \fIbranch\fR] [file...]
.P
-git\-nits [\-b \fIbranch\fR]
+git\-nits [\-c \fIcheck\fR] [\-p \fIbranch\fR] [file...]
+.SH "OPTIONS"
+
+.TP
+\fB\-c check\fR:
+.IP
+Run the specific \fIcheck\fR, as named below.
+In this mode, individual files can be provided to check.
+.TP
+\fB\-p branch\fR:
+.IP
+Compare the current workspace to the parent \fIbranch\fR for the purposes of generating file and comment lists\.
+.IP
+If this option is not specified an attempt is made to determine this automatically, if the git branch configuration contains this information\.
+.IP
+If no branch is specified and none can be determined automatically \fBorigin/master\fR is used\.
.SH "DESCRIPTION"
Check your workspace for common nits and putback\-ending mistakes, a simple set of checks are run over various parts of your workspace and errors encountered are reported, all of which should, generally, be fixed\.
-
.TP
-Comment format
+Comment format [comchk]
Check that putback comments follow the prescribed format (only run for pbchk)
-
.TP
-Copyrights
+Copyrights [copyright]
Check that each source file contains a copyright notice for the current
year\. You don't need to fix this if you, the potential new copyright holder, chooses not to
-
.TP
-C style
+C style [cstyle]
Check that C source files conform to the Illumos C style rules
-
.TP
-Header check
+Header check [hdrchk]
Check that C header files conform to the Illumos header style rules (in addition to the general C rules)
-
.TP
-Java style
+Java style [jstyle]
Check that Java source files conform to the Illumos Java style rules (which differ from the traditionally recommended Java style)
-
.TP
-SCCS Keywords
+SCCS Keywords [keywords]
Check that no source files contain unexpanded SCCS keywords\. It is possible that this check may false positive on certain inputs\. It is generally obvious when this is the case\.
-
.IP
This check does not check for expanded SCCS keywords, though the common \'ident\'\-style lines should be removed regardless of whether they are expanded\.
-
.TP
-Mapfile check
+Man page check [manlint]
+Check for problems with man pages.
+.TP
+Mapfile check [mapfilechk]
Check that linker mapfiles contain a comment directing anyone editing to read the directions in \fBusr/lib/README\.mapfiles\fR\.
-
-.SH "OPTIONS"
-
.TP
-\fB\-b branch\fR:
-
-.IP
-Compare the current workspace to /branch/ for the purposes of generating file and comment lists\.
-
-.IP
-If this option is not specified an attempt is made to determine this automatically, if the git branch configuration contains this information\.
-
-.IP
-If no branch is specified and none can be determined automatically \fBorigin/master\fR is used\.
-
+Whitespace check [wscheck]
+Check for whitespace issues such as mixed tabs/spaces in source files.
.SH "FILES"
-\fBgit nits\fR and \fBgit pbchk\fR support NOT files of the form used by Cadmium with Mercurial\. These are looked for in \fB$CODEMGR_WS/\.git/\fR and in \fB$CODEMGR_WS/exception_lists/\fR as normal\. The files are named after the check from which they exclude files\.
-
-.IP "\(bu" 4
-\fBcopyright\.NOT\fR: exclude files listed from copyright checking
-
-.IP "\(bu" 4
-\fBcstyle\.NOT\fR: exclude files from the C style check
-
-.IP "\(bu" 4
-\fBhdrchk\.NOT\fR: exclude files from the C header style check
-
-.IP "\(bu" 4
-\fBkeywords\.NOT\fR: exclude files from the SCCS keywords check
-
-.IP "\(bu" 4
-\fBmapfilechk\.NOT\fR: exclude files from the linker mapfile check
+Exception lists can be used to exclude certain files from checking, named after
+the specific check.
+They can be found in \fB$CODEMGR_WS/exception_lists/\fR, or optionally under
+\fB$CODEMGR_WS/\.git/\fR, where they must be suffixed \fB.NOT\fR.
.IP "" 0
diff --git a/usr/src/tools/scripts/git-pbchk.py b/usr/src/tools/scripts/git-pbchk.py
index 4a3533156d..2a05473dae 100644
--- a/usr/src/tools/scripts/git-pbchk.py
+++ b/usr/src/tools/scripts/git-pbchk.py
@@ -18,9 +18,9 @@
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2008, 2012 Richard Lowe
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
-# Copyright (c) 2014, Joyent, Inc.
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
# Copyright 2016 Nexenta Systems, Inc.
+# Copyright 2018 Joyent, Inc.
#
import getopt
@@ -371,29 +371,42 @@ def pbchk(root, parent, paths):
def main(cmd, args):
parent_branch = None
+ checkname = None
try:
- opts, args = getopt.getopt(args, 'b:')
+ opts, args = getopt.getopt(args, 'c:p:')
except getopt.GetoptError, e:
sys.stderr.write(str(e) + '\n')
- sys.stderr.write("Usage: %s [-b branch] [path...]\n" % cmd)
+ sys.stderr.write("Usage: %s [-c check] [-p branch] [path...]\n" % cmd)
sys.exit(1)
for opt, arg in opts:
+ # backwards compatibility
if opt == '-b':
parent_branch = arg
+ elif opt == '-c':
+ checkname = arg
+ elif opt == '-p':
+ parent_branch = arg
if not parent_branch:
parent_branch = git_parent_branch(git_branch())
- func = nits
- if cmd == 'git-pbchk':
- func = pbchk
+ if checkname is None:
+ if cmd == 'git-pbchk':
+ checkname= 'pbchk'
+ else:
+ checkname = 'nits'
+
+ if checkname == 'pbchk':
if args:
sys.stderr.write("only complete workspaces may be pbchk'd\n");
sys.exit(1)
-
- func(git_root(), parent_branch, args)
+ pbchk(git_root(), parent_branch, None)
+ elif checkname == 'nits':
+ nits(git_root(), parent_branch, args)
+ else:
+ run_checks(git_root(), parent_branch, [eval(checkname)], args)
if __name__ == '__main__':
try: