diff options
Diffstat (limited to 'usr/src/tools/onbld/Checks')
-rw-r--r-- | usr/src/tools/onbld/Checks/Cddl.py | 2 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/CmtBlk.py | 2 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/Comments.py | 4 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/Copyright.py | 10 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/DbLookups.py | 35 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/HdrChk.py | 2 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/Keywords.py | 2 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/Mapfile.py | 2 | ||||
-rw-r--r-- | usr/src/tools/onbld/Checks/__init__.py | 2 |
9 files changed, 44 insertions, 17 deletions
diff --git a/usr/src/tools/onbld/Checks/Cddl.py b/usr/src/tools/onbld/Checks/Cddl.py index e2bbf09c02..42cbca2f5a 100644 --- a/usr/src/tools/onbld/Checks/Cddl.py +++ b/usr/src/tools/onbld/Checks/Cddl.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON CDDL = ''' CDDL HEADER START diff --git a/usr/src/tools/onbld/Checks/CmtBlk.py b/usr/src/tools/onbld/Checks/CmtBlk.py index 57eb5704c1..9400fd7c80 100644 --- a/usr/src/tools/onbld/Checks/CmtBlk.py +++ b/usr/src/tools/onbld/Checks/CmtBlk.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START diff --git a/usr/src/tools/onbld/Checks/Comments.py b/usr/src/tools/onbld/Checks/Comments.py index 8285be2daa..0715bb1b40 100644 --- a/usr/src/tools/onbld/Checks/Comments.py +++ b/usr/src/tools/onbld/Checks/Comments.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START # @@ -41,7 +41,7 @@ from onbld.Checks.DbLookups import BugDB from onbld.Checks.SpellCheck import spellcheck_line -bugre = re.compile(r'^(\d{2,7}) (.*)$') +bugre = re.compile(r'^(\d{2,7}|[A-Z]{1,7}-\d{1,7}) (.*)$') def isBug(comment): diff --git a/usr/src/tools/onbld/Checks/Copyright.py b/usr/src/tools/onbld/Checks/Copyright.py index 81a80058aa..48b44e59ae 100644 --- a/usr/src/tools/onbld/Checks/Copyright.py +++ b/usr/src/tools/onbld/Checks/Copyright.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START # @@ -25,6 +25,8 @@ # # Copyright 2008, 2010, Richard Lowe +# Copyright 2019 Joyent, Inc. +# Copyright 2022 MNX Cloud, Inc. # Make sure there is a copyright claim for the current year. @@ -37,7 +39,7 @@ def is_copyright(line): return re.search(r'Copyright (?!\[yyyy\])', line) def is_current_copyright(line): - return re.search(r'Copyright.*\b%s\b' % time.strftime('%Y'), line) + return re.search(r'Copyright %s MNX Cloud, Inc.$' % time.strftime('%Y'), line) def copyright(fh, filename=None, output=sys.stderr): ret = rights = goodrights = 0 @@ -56,8 +58,8 @@ def copyright(fh, filename=None, output=sys.stderr): err(output, "no copyright message found", filename) ret = 1 elif goodrights == 0: - err(output, "no copyright claim for current year found", - filename) + err(output, "'Copyright %s MNX Cloud, Inc.' not found" % + time.strftime('%Y'), filename) ret = 1 return ret diff --git a/usr/src/tools/onbld/Checks/DbLookups.py b/usr/src/tools/onbld/Checks/DbLookups.py index 84cbbe96bc..d396a68cbc 100644 --- a/usr/src/tools/onbld/Checks/DbLookups.py +++ b/usr/src/tools/onbld/Checks/DbLookups.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START # @@ -26,15 +26,16 @@ # Copyright 2010, Richard Lowe # Copyright 2018 OmniOS Community Edition (OmniOSce) Association. +# Copyright (c) 2019, Joyent, Inc. # # Various database lookup classes/methods, i.e.: -# * monaco -# * bugs.opensolaris.org (b.o.o.) # * redmine (illumos.org) +# * smartos # import re +import json try: from urllib.request import urlopen, Request from urllib.error import HTTPError @@ -66,9 +67,9 @@ class BugDB(object): print r["6505625"]["synopsis"] """ - VALID_DBS = ["illumos"] + VALID_DBS = ["illumos", "smartos"] - def __init__(self, priority = ["illumos"]): + def __init__(self, priority = VALID_DBS): """Create a BugDB object. Keyword argument: @@ -79,6 +80,24 @@ class BugDB(object): raise BugDBException(database) self.__priority = priority + def __smartosbug(self, cr): + url = "http://smartos.org/bugview/json/%s" % cr + req = Request(url) + + try: + data = urlopen(req) + except HTTPError as e: + if e.code == 404 or e.code == 403 or e.code == 400: + raise NonExistentBug(cr) + else: + raise + + bug = json.load(data) + + return {'cr_number': bug['id'], + 'synopsis': bug['summary'] + } + def __illbug(self, cr): url = "http://illumos.org/issues/%s.xml" % cr @@ -121,6 +140,12 @@ class BugDB(object): results[str(cr)] = self.__illbug(cr) except NonExistentBug: continue + elif database == "smartos": + for cr in crs: + try: + results[str(cr)] = self.__smartosbug(cr) + except NonExistentBug: + continue # the CR has already been found by one bug database # so don't bother looking it up in the others diff --git a/usr/src/tools/onbld/Checks/HdrChk.py b/usr/src/tools/onbld/Checks/HdrChk.py index c2697dcaf2..8f7b946d12 100644 --- a/usr/src/tools/onbld/Checks/HdrChk.py +++ b/usr/src/tools/onbld/Checks/HdrChk.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START # diff --git a/usr/src/tools/onbld/Checks/Keywords.py b/usr/src/tools/onbld/Checks/Keywords.py index cd4dda0b69..0866178756 100644 --- a/usr/src/tools/onbld/Checks/Keywords.py +++ b/usr/src/tools/onbld/Checks/Keywords.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START # diff --git a/usr/src/tools/onbld/Checks/Mapfile.py b/usr/src/tools/onbld/Checks/Mapfile.py index 5b40d26005..e4166c5792 100644 --- a/usr/src/tools/onbld/Checks/Mapfile.py +++ b/usr/src/tools/onbld/Checks/Mapfile.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START # diff --git a/usr/src/tools/onbld/Checks/__init__.py b/usr/src/tools/onbld/Checks/__init__.py index 775c5a6e66..afde98c7da 100644 --- a/usr/src/tools/onbld/Checks/__init__.py +++ b/usr/src/tools/onbld/Checks/__init__.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON # # CDDL HEADER START # |