Carsten Grzemba
2016-02-29 392ed58e84c015f70f1b8d2e0c3a64c86f319eb2
Make allowed publishers list customizable
2 files modified
10 ■■■■ changed files
tools/pkglintrc 2 ●●● patch | view | raw | blame | history
tools/python/pkglint/userland.py 8 ●●●● patch | view | raw | blame | history
tools/pkglintrc
@@ -25,7 +25,7 @@
pkglint.ext.content = pkglint.userland
# Used by the publisher_in_fmri method in .../tools/python/pkglint/userland.py
userland.manifest002.allowed_pubs = userland userland-localizable
userland.manifest.allowed_pubs = userland userland-localizable
# turn off reporting of 'pkg.linted*' attributes in manifests.  We already
# get a pkglint001.5 INFO message with the WARNING or ERROR that we have
tools/python/pkglint/userland.py
@@ -459,8 +459,9 @@
                    interface=pkg.client.api.ImageInterface("/", pkg.client.api.CURRENT_API_VERSION, progtracker, lambda x: False, None,None)
                    ret = interface.info([pkg_name],True,info_needed)
                    if ret[pkg.client.api.ImageInterface.INFO_FOUND]:
                            for i in ret[pkg.client.api.ImageInterface.INFO_FOUND]:
                            if i.publisher not in ("openindiana.org","userland","on-nightly"):
                        allowed_pubs = engine.get_param("%s.allowed_pubs" % self.name).split(" ") + ["openindiana.org","on-nightly"]
                        for i in ret[pkg.client.api.ImageInterface.INFO_FOUND]:
                            if i.publisher not in allowed_pubs:
                                engine.error(_("package %(pkg)s depends on %(name)s, which comes from forbidden publisher %(publisher)s") %
                                    {"pkg":manifest.fmri,"name":pkg_name,"publisher":i.publisher}, msgid="%s%s.1" % (self.name, pkglint_id))
@@ -495,9 +496,8 @@
        "license actions and ARC information are required if you deliver files.")
        def publisher_in_fmri(self, manifest, engine, pkglint_id="002"):
                lint_id = "%s%s" % (self.name, pkglint_id)
                allowed_pubs = engine.get_param(
                    "%s.allowed_pubs" % lint_id).split(" ")
                    "%s.allowed_pubs" % self.name).split(" ")
                fmri = manifest.fmri
                if fmri.publisher and fmri.publisher not in allowed_pubs: