Author: ngie
Date: Tue Jan 17 03:38:49 2017
New Revision: 312328
URL: https://svnweb.freebsd.org/changeset/base/312328

Log:
  Add a make target (smilint) for running smilint tool against BMIBS
  
  Running smilint against MIB definitions is useful in finding
  functional problems with MIB definitions/descriptions.
  
  This is inspired by the smilint targets defined in
  usr.sbin/bsnmpd/modules/{snmp_hostres,snmp_mibII}/Makefile
  
  Document all of the variables that are involved in running the
  smilint target, as well as all of the prerequisites to running
  it.
  
  MFC after:    1 week
  Differential Revision:        https://reviews.freebsd.org/D9099

Modified:
  head/share/mk/bsd.README
  head/share/mk/bsd.snmpmod.mk

Modified: head/share/mk/bsd.README
==============================================================================
--- head/share/mk/bsd.README    Tue Jan 17 01:59:42 2017        (r312327)
+++ head/share/mk/bsd.README    Tue Jan 17 03:38:49 2017        (r312328)
@@ -418,7 +418,15 @@ tree.
 bsd.snmpmod.mk leverages bsd.lib.mk for building MIB modules and
 bsd.files.mk for installing MIB description and definition files.
 
-It has no additional targets.
+It implements the following additional targets:
+
+       smilint:
+               execute smilint on the MIBs defined by BMIBS.
+
+               The net-mgmt/libsmi package must be installed before
+               executing this target. The net-mgmt/net-snmp package
+               should be installed as well to reduce false positives
+               from smilint.
 
 It sets/uses the following variables:
 
@@ -444,8 +452,19 @@ EXTRAMIBSYMS       Extra MIB definition files 
 
                See ${MOD}_oid.h for more details.
 
+LOCALBASE      The package root where smilint and the net-snmp
+               definitions can be found
+
 MOD            The bsnmpd module name.
 
+SMILINT                smilint binary to use with the smilint make target.
+
+SMILINT_FLAGS  flags to pass to smilint.
+
+SMIPATH                A colon-separated directory path where MIBs definitions
+               can be found. See "SMIPATH" in smi_config for more
+               details.
+
 XSYM           MIB names to extract symbols for. See ${MOD}_oid.h for
                more details.
 

Modified: head/share/mk/bsd.snmpmod.mk
==============================================================================
--- head/share/mk/bsd.snmpmod.mk        Tue Jan 17 01:59:42 2017        
(r312327)
+++ head/share/mk/bsd.snmpmod.mk        Tue Jan 17 03:38:49 2017        
(r312328)
@@ -25,4 +25,18 @@ FILESGROUPS+=        BMIBS
 BMIBSDIR?=     ${SHAREDIR}/snmp/mibs
 .endif
 
+.if !target(smilint) && !empty(BMIBS)
+LOCALBASE?=    /usr/local
+
+SMILINT?=      ${LOCALBASE}/bin/smilint
+
+SMIPATH?=      ${BMIBSDIR}:${LOCALBASE}/share/snmp/mibs
+
+SMILINT_FLAGS?=        -c /dev/null -l6 -i group-membership
+
+smilint: ${BMIBS}
+       SMIPATH=${SMIPATH} ${SMILINT} ${SMILINT_FLAGS} ${.ALLSRC}
+.endif
+smilint: .PHONY
+
 .include <bsd.lib.mk>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to