# HG changeset patch # User Norm Jacobs # Date 1299183711 28800 # Node ID 8f634eb6f66bdf6051f1e5bcd87714825cd48d89 # Parent ae6a90899b4226e615912b37fe935ebc1d31eb32 7023683 userland pkglint checks should look in more places for content diff -r ae6a90899b42 -r 8f634eb6f66b make-rules/ips.mk --- 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) <$< >$@ diff -r ae6a90899b42 -r 8f634eb6f66b tools/python/pkglint/userland.py --- 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"):