Norm Jacobs
2011-03-03 8a6659e67f2129e12bc4887995e0eab035e29980
7023683 userland pkglint checks should look in more places for content
2 files modified
25 ■■■■■ changed files
make-rules/ips.mk 2 ●●● patch | view | raw | blame | history
tools/python/pkglint/userland.py 23 ●●●●● patch | view | raw | blame | history
make-rules/ips.mk
@@ -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) <$< >$@
tools/python/pkglint/userland.py
@@ -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"):