7023683 userland pkglint checks should look in more places for content
authorNorm Jacobs <Norm.Jacobs@Oracle.COM>
Thu, 03 Mar 2011 12:21:51 -0800
changeset 117 8f634eb6f66b
parent 116 ae6a90899b42
child 118 049f3b3d6903
7023683 userland pkglint checks should look in more places for content
make-rules/ips.mk
tools/python/pkglint/userland.py
--- a/make-rules/ips.mk	Wed Mar 02 02:39:37 2011 -0800
+++ b/make-rules/ips.mk	Thu Mar 03 12:21:51 2011 -0800
@@ -134,7 +134,7 @@
 # lint the manifest before we publish with it.
 $(MANIFEST_BASE)-%.linted:	$(MANIFEST_BASE)-%.resolved
 	@echo "VALIDATING MANIFEST CONTENT: $<"
-	$(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_DIR=$(PROTO_DIR) \
+	$(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)"\
 		$(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
 			-f $(WS_TOOLS)/pkglintrc $<
 	$(PKGFMT) <$< >[email protected]
--- a/tools/python/pkglint/userland.py	Wed Mar 02 02:39:37 2011 -0800
+++ b/tools/python/pkglint/userland.py	Thu Mar 03 12:21:51 2011 -0800
@@ -40,7 +40,11 @@
         def __init__(self, config):
                 self.description = _(
                     "checks Userland packages for common content errors")
-		self.prototype = os.getenv('PROTO_DIR')
+		path = os.getenv('PROTO_PATH')
+		if path != None:
+			self.proto_path = path.split()
+		else:
+			self.proto_path = None
 		self.runpath_re = [
 			re.compile('^/lib(/.*)?$'),
 			re.compile('^/usr/'),
@@ -50,9 +54,7 @@
                 super(UserlandActionChecker, self).__init__(config)
 
 	def startup(self, engine):
-		if self.prototype != None:
-			engine.info(_("including prototype checks: %s") %
-					self.prototype, msgid=self.name)
+		pass
 
         def __realpath(self, path, target):
 		"""Combine path and target to get the real path."""
@@ -113,7 +115,9 @@
 		if action.name not in ["file"]:
 			return
 
-		path = action.attrs["path"]
+		path = action.hash
+		if path == None or path == 'NOHASH':
+			path = action.attrs["path"]
 
 		# check for writable files without a preserve attribute
 		if 'mode' in action.attrs:
@@ -126,8 +130,12 @@
 				msgid="%s%s.0" % (self.name, pkglint_id))
 
 		# checks that require a physical file to look at
-		if self.prototype is not None:
-			fullpath = self.prototype + "/" + path
+		if self.proto_path is not None:
+			for directory in self.proto_path:
+				fullpath = directory + "/" + path
+
+				if os.path.exists(fullpath):
+					break
 
 			if not os.path.exists(fullpath):
 				engine.info(
@@ -198,7 +206,6 @@
         name = "userland.manifest"
 
 	def __init__(self, config):
-		self.prototype = os.getenv('PROTO_DIR')
 		super(UserlandManifestChecker, self).__init__(config)
 
 	def license_check(self, manifest, engine, pkglint_id="001"):