src/modules/lint/opensolaris.py
changeset 2090 d84a7b3cafa3
parent 2085 10a27146ebc2
child 2184 48031491a616
child 2572 20cf41d565de
equal deleted inserted replaced
2089:c8b9d6341530 2090:d84a7b3cafa3
    68                             _("Username %(name)s in %(pkg)s is invalid - see "
    68                             _("Username %(name)s in %(pkg)s is invalid - see "
    69                             "passwd(4)") %
    69                             "passwd(4)") %
    70                             {"name": username,
    70                             {"name": username,
    71                             "pkg": manifest.fmri},
    71                             "pkg": manifest.fmri},
    72                             msgid="%s%s.3" % (self.name, pkglint_id))
    72                             msgid="%s%s.3" % (self.name, pkglint_id))
       
    73 
       
    74         username_format.pkglint_desc = _("User names should be valid.")
    73 
    75 
    74 
    76 
    75 class OpenSolarisManifestChecker(base.ManifestChecker):
    77 class OpenSolarisManifestChecker(base.ManifestChecker):
    76         """An opensolaris.org-specific class to check manifests."""
    78         """An opensolaris.org-specific class to check manifests."""
    77 
    79 
   138                 if "pkg.summary" not in manifest:
   140                 if "pkg.summary" not in manifest:
   139                         engine.error(_("Missing key pkg.summary from %s") %
   141                         engine.error(_("Missing key pkg.summary from %s") %
   140                             manifest.fmri,
   142                             manifest.fmri,
   141                             msgid="%s%s.2" % (self.name, pkglint_id))
   143                             msgid="%s%s.2" % (self.name, pkglint_id))
   142 
   144 
   143         def print_fmri(self, manifest, engine, pkglint_id="002"):
   145         missing_attrs.pkglint_desc = _(
   144                 """For now, this is simply a convenient way to output
   146             "Standard package attributes should be present.")
   145                 the FMRI being checked.  We pkglint.exclude this check
       
   146                 by default."""
       
   147                 # Using the python logger attached to the engine rather than
       
   148                 # emitting a lint message - this message is purely informational
       
   149                 # and isn't a source of lint messages (which would otherwise
       
   150                 # cause a non-zero exit from pkglint)
       
   151                 engine.logger.info(" %s" % manifest.fmri)
       
   152 
   147 
   153         def info_classification(self, manifest, engine, pkglint_id="003"):
   148         def info_classification(self, manifest, engine, pkglint_id="003"):
   154                 """Checks that the info.classification attribute is valid."""
   149                 """Checks that the info.classification attribute is valid."""
   155 
   150 
   156                 if (not "info.classification" in manifest) or \
   151                 if (not "info.classification" in manifest) or \
   175                                     engine, item, manifest.fmri,
   170                                     engine, item, manifest.fmri,
   176                                     "%s%s" % (self.name, pkglint_id))
   171                                     "%s%s" % (self.name, pkglint_id))
   177                 else:
   172                 else:
   178                         self._check_info_classification_value(engine, value,
   173                         self._check_info_classification_value(engine, value,
   179                             manifest.fmri, "%s%s" % (self.name, pkglint_id))
   174                             manifest.fmri, "%s%s" % (self.name, pkglint_id))
       
   175 
       
   176         info_classification.pkglint_desc = _(
       
   177             "info.classification attribute should be valid.")
   180 
   178 
   181         def _check_info_classification_value(self, engine, value, fmri, msgid):
   179         def _check_info_classification_value(self, engine, value, fmri, msgid):
   182 
   180 
   183                 prefix = "org.opensolaris.category.2008:"
   181                 prefix = "org.opensolaris.category.2008:"
   184 
   182