summaryrefslogtreecommitdiff
path: root/usr/src/tools
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2021-11-05 22:51:46 +0000
committerAndy Fiddaman <omnios@citrus-it.co.uk>2021-11-15 21:42:02 +0000
commit86d4171132ce4f4c1345b7ce0d5048577e1f3976 (patch)
treee4f668e6580226de0c3ea156d690b1448857e37c /usr/src/tools
parent8e458de0baeb1fee50643403223bc7e909a48464 (diff)
downloadillumos-gate-86d4171132ce4f4c1345b7ce0d5048577e1f3976.tar.gz
14218 Package manifests could be maintained in v2 format
Reviewed by: Yuri Pankov <ypankov@tintri.com> Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> Approved by: Rich Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/tools')
-rw-r--r--usr/src/tools/env/illumos.sh4
-rw-r--r--usr/src/tools/onbld/Checks/Makefile.com1
-rw-r--r--usr/src/tools/onbld/Checks/PkgFmt.py39
-rw-r--r--usr/src/tools/scripts/git-pbchk.py14
4 files changed, 55 insertions, 3 deletions
diff --git a/usr/src/tools/env/illumos.sh b/usr/src/tools/env/illumos.sh
index a1f7d356ab..a33472de8f 100644
--- a/usr/src/tools/env/illumos.sh
+++ b/usr/src/tools/env/illumos.sh
@@ -274,7 +274,7 @@ export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"
# export PKGPUBLISHER_REDIST='on-redist'
# Package manifest format version.
-export PKGFMT_OUTPUT='v1'
+export PKGFMT_OUTPUT='v2'
# we want make to do as much as it can, just in case there's more than
# one problem.
@@ -300,7 +300,7 @@ export SPRO_VROOT="$SPRO_ROOT"
# if the 'N' option is not specified, is to run this test.
#CHECK_PATHS='y'
-if [[ "$ENABLE_SMATCH" = "1" ]]; then
+if [[ "$ENABLE_SMATCH" == "1" ]]; then
SMATCHBIN=$CODEMGR_WS/usr/src/tools/proto/root_$MACH-nd/opt/onbld/bin/$MACH/smatch
export SHADOW_CCS="$SHADOW_CCS smatch,$SMATCHBIN,smatch"
fi
diff --git a/usr/src/tools/onbld/Checks/Makefile.com b/usr/src/tools/onbld/Checks/Makefile.com
index 74f5e2dbfe..e8e6b88a64 100644
--- a/usr/src/tools/onbld/Checks/Makefile.com
+++ b/usr/src/tools/onbld/Checks/Makefile.com
@@ -47,6 +47,7 @@ PYSRCS = \
ManLint.py \
Mapfile.py \
ProcessCheck.py \
+ PkgFmt.py \
ShellLint.py \
SpellCheck.py \
WsCheck.py \
diff --git a/usr/src/tools/onbld/Checks/PkgFmt.py b/usr/src/tools/onbld/Checks/PkgFmt.py
new file mode 100644
index 0000000000..94c48fe99e
--- /dev/null
+++ b/usr/src/tools/onbld/Checks/PkgFmt.py
@@ -0,0 +1,39 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+#
+
+#
+# Package manifest check
+#
+
+import sys
+from onbld.Checks.ProcessCheck import processcheck
+
+def check(fh, filename=None, output=sys.stderr, **opts):
+ if not filename:
+ filename = fh.name
+
+ options = ['-c', '-f', 'v2']
+ ret, tmpfile = processcheck('pkgfmt', options, fh, output)
+ tmpfile.close()
+ if ret == 0:
+ # Manifest passes validation
+ return 0
+
+ output.write('{} is not in pkgfmt v2 form;\n'.format(filename))
+ output.write('run `pkgfmt -f v2` on the file to re-format ' +
+ 'the manifest in-place\n')
+
+ return 1
+
diff --git a/usr/src/tools/scripts/git-pbchk.py b/usr/src/tools/scripts/git-pbchk.py
index 26c73ca590..141a0c3c68 100644
--- a/usr/src/tools/scripts/git-pbchk.py
+++ b/usr/src/tools/scripts/git-pbchk.py
@@ -57,7 +57,7 @@ sys.path.insert(2, os.path.join(os.path.dirname(__file__), ".."))
from onbld.Scm import Ignore
from onbld.Checks import Comments, Copyright, CStyle, HdrChk, WsCheck
from onbld.Checks import JStyle, Keywords, ManLint, Mapfile, SpellCheck
-from onbld.Checks import ShellLint
+from onbld.Checks import ShellLint, PkgFmt
class GitError(Exception):
pass
@@ -315,6 +315,16 @@ def shelllint(root, parent, flist, output):
return ret
+def pkgfmt(root, parent, flist, output):
+ ret = 0
+ output.write("Package manifests:\n")
+
+ for f in flist(lambda x: x.endswith('.mf')):
+ with io.open(f, mode='rb') as fh:
+ ret |= PkgFmt.check(fh, output=output)
+
+ return ret
+
def keywords(root, parent, flist, output):
ret = 0
output.write("SCCS Keywords:\n")
@@ -421,6 +431,7 @@ def nits(root, parent, paths):
manlint,
mapfilechk,
shelllint,
+ pkgfmt,
winnames,
wscheck]
scmds = [symlinks]
@@ -436,6 +447,7 @@ def pbchk(root, parent, paths):
manlint,
mapfilechk,
shelllint,
+ pkgfmt,
winnames,
wscheck]
scmds = [symlinks]