7030489 userland pkglint should check for publisher information in pkg.fmris
authorRich Burridge <rich.burridge@oracle.com>
Thu, 18 Oct 2012 12:22:14 -0700
changeset 1020 4740049105f5
parent 1019 9d261d526266
child 1021 93e0813581a0
7030489 userland pkglint should check for publisher information in pkg.fmris
tools/pkglintrc
tools/python/pkglint/userland.py
--- a/tools/pkglintrc	Wed Oct 17 17:17:49 2012 -0700
+++ b/tools/pkglintrc	Thu Oct 18 12:22:14 2012 -0700
@@ -18,11 +18,14 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 [pkglint]
 
 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
+
 # temporarily work around defect 18884
 pkglint.exclude = pkg.lint.pkglint_manifest.PkgManifestChecker.variants
--- a/tools/python/pkglint/userland.py	Wed Oct 17 17:17:49 2012 -0700
+++ b/tools/python/pkglint/userland.py	Thu Oct 18 12:22:14 2012 -0700
@@ -21,7 +21,7 @@
 #
 
 #
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 
 # Some userland consolidation specific lint checks
@@ -399,3 +399,14 @@
 
 	component_check.pkglint_dest = _(
 		"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(" ") 
+
+                fmri = manifest.fmri
+                if fmri.publisher and fmri.publisher not in allowed_pubs:
+                        engine.error(_("package %s has a publisher set!") %
+                            manifest.fmri,
+                            msgid="%s%s.2" % (self.name, pkglint_id))