net-snmp: add ptest and several fixes
cover net-snmp: add ptest and several fixes
From: Jackie Huang <[email protected]>
Tested on qemux86-64 with both systemd and sysvinit, and ptest run pass.
---
The following changes since commit 2fbc57e10562a809e20a7be93c76d9f08a88ea5f:
adduser: add new recipe (2015-01-15 16:37:56 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib jhuang0/r_net-snmp_150115_0
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/r_net-snmp_150115_0
Jackie Huang (7):
net-snmp: have mib-modules=smux enabled
net-snmp: move persistent dir to /var/lib/net-snmp
net-snmp: fix "libtool --finish"
net-snmp: add knob whether nlist.h are checked
net-snmp: init script fixes
net-snmp: move net-snmp-config to client package
net-snmp: add ptest package
.../recipes-protocols/net-snmp/files/init | 53 ++++++++++---------- .../net-snmp/net-snmp/fix-libtool-finish.patch | 25 ++++++++++ ...snmp-add-knob-whether-nlist.h-are-checked.patch | 35 +++++++++++++ ...p-testing-add-the-output-format-for-ptest.patch | 37 ++++++++++++++ .../recipes-protocols/net-snmp/net-snmp/run-ptest | 4 ++ .../recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 57 ++++++++++++++++------ 6 files changed, 172 insertions(+), 39 deletions(-) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/fix-libtool-finish.patch create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-add-knob-whether-nlist.h-are-checked.patch create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-testing-add-the-output-format-for-ptest.patch create mode 100755 meta-networking/recipes-protocols/net-snmp/net-snmp/run-ptest
Signature · 1 line
1.9.1
PATCH 1/7 net-snmp: have mib-modules=smux enabled
From: Jackie Huang <[email protected]>
According to the following commit, net-snmp needs to have mib-modules=smux enabled:
commit f64db3011c04ada0a8ac04b9eddde05b67d21eec
Author: Aws Ismail <[email protected]> Date: Mon Mar 25 11:30:06 2013 -0400
Quagga has no snmp support, unrecognized options --enable-tcp-md5
1. Quagga's tcp-md5 has been renamed to linux24-tcp-md5
2. net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp. Make the net-snmp option dependent on the DISTRO_FEATURE snmp.
3. Misc: install the sample conf files for quagga. Also, Make sure that the post install script is being run on the target rather than during the rootfs creation stage.
--- meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 3 +++ 1 file changed, 3 insertions(+)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +3 -0
@@ -36,6 +36,9 @@ EXTRA_OECONF = "--disable-embedded-perl \ --with-defaults \ ${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)}" +# net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp +EXTRA_OECONF += "--with-mib-modules=smux" + CACHED_CONFIGUREVARS = " \ ac_cv_header_valgrind_valgrind_h=no \ ac_cv_header_valgrind_memcheck_h=no \
Signature · 1 line
1.9.1
PATCH 2/7 net-snmp: move persistent dir to /var/lib/net-snmp
In reply to [email protected]From: Jackie Huang <[email protected]>
Move persistent dir to /var/lib/net-snmp and fix security contexts for them.
--- meta-networking/recipes-protocols/net-snmp/files/init | 2 ++ meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 1 + 2 files changed, 3 insertions(+)
meta-networking/recipes-protocols/net-snmp/files/init +2 -0
@@ -28,6 +28,8 @@ case "$1" in echo -n " snmptrapd" fi echo "." + + test ! -x /sbin/restorecon || /sbin/restorecon -FR /var/lib/net-snmp ;; stop) echo -n "Stopping network management services:"
meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +1 -0
@@ -34,6 +34,7 @@ EXTRA_OECONF = "--disable-embedded-perl \ --enable-shared \ --disable-manuals \ --with-defaults \ + --with-persistent-directory=${localstatedir}/lib/net-snmp \ ${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)}" # net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp
Signature · 1 line
1.9.1
PATCH 3/7 net-snmp: fix "libtool --finish"
In reply to [email protected]From: Jackie Huang <[email protected]>
LIB_LDCONFIG_CMD failed since it is using a host dir $(libdir) which is /usr/lib64 does not exist on host when compile 64bit image.
In fact, configuring dynamic linker run-time bindings is meaningless at this step, If it is needed, Poky would write ldconfig scripts to rpm-postinst for each recipe while do_package, in package.bbclass.
--- .../net-snmp/net-snmp/fix-libtool-finish.patch | 25 ++++++++++++++++++++++ .../recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 1 + 2 files changed, 26 insertions(+) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/fix-libtool-finish.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/fix-libtool-finish.patch new file +25 -0
@@ -0,0 +1,25 @@ +LIB_LDCONFIG_CMD failed since it is using a host dir $(libdir) +which is /usr/lib64 does not exist on host when compile 64bit +image. + +In fact, configuring dynamic linker run-time bindings is meaningless +at this step, If it is needed, Poky would write ldconfig scripts to +rpm-postinst for each recipe while do_package, in package.bbclass. + +Upstream-Status: Inappropriate [cross compile specific] + +Signed-off-by: Roy.Li <[email protected]> +--- +diff --git a/Makefile.top b/Makefile.top +index 862fb94..ed7dcfc 100644 +--- a/Makefile.top ++++ b/Makefile.top +@@ -86,7 +86,7 @@ LIBREVISION = 2 + LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o + LIB_EXTENSION = la + LIB_VERSION = +-LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(INSTALL_PREFIX)$(libdir) ++LIB_LDCONFIG_CMD = echo "do not ldconfig\n" + LINK = $(LIBTOOL) --mode=link $(LINKCC) + # RANLIB = @RANLIB@ + RANLIB = :
meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +1 -0
@@ -15,6 +15,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ file://snmpd.service \ file://snmptrapd.service \ file://ifmib.patch \ + file://fix-libtool-finish.patch \ " SRC_URI[md5sum] = "a2c83518648b0f2a5d378625e45c0e18"
Signature · 1 line
1.9.1
PATCH 4/7 net-snmp: add knob whether nlist.h are checked
In reply to [email protected]From: Jackie Huang <[email protected]>
Previously, it still was checked when there was no nlish.h in sysroots directory. Add knob to decide whether nlist.h are checked or not.
Fixed by using PACKAGECONFIG to check elf, with default disabled set.
--- ...snmp-add-knob-whether-nlist.h-are-checked.patch | 35 ++++++++++++++++++++++ .../recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 4 +++ 2 files changed, 39 insertions(+) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-add-knob-whether-nlist.h-are-checked.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-add-knob-whether-nlist.h-are-checked.patch new file +35 -0
@@ -0,0 +1,35 @@ +net-snmp: add knob whether nlist.h are checked + +Previously, it still was checked when there was no nlish.h in sysroots directory. +Add knob to decide whether nlist.h are checked or not. + +Upstream-status: Pending + +Signed-off-by: Chong Lu <[email protected]> +--- + configure.d/config_os_headers | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.d/config_os_headers b/configure.d/config_os_headers +index d903f58..a05d30e 100644 +--- a/configure.d/config_os_headers ++++ b/configure.d/config_os_headers +@@ -31,6 +31,7 @@ AC_CHECK_HEADERS([getopt.h pthread.h regex.h ] dnl + [sys/un.h ]) + + # Library and Agent: ++if test "x$with_elf" != "xno"; then + AC_CHECK_HEADERS([nlist.h],,,[ + AC_INCLUDES_DEFAULT + [ +@@ -38,6 +39,7 @@ AC_INCLUDES_DEFAULT + #define LIBBSD_DISABLE_DEPRECATED 1 + #endif + ]]) ++fi + + # Library: + AC_CHECK_HEADERS([fcntl.h io.h kstat.h ] dnl +-- +1.7.9.5 +
meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +4 -0
@@ -16,6 +16,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ file://snmptrapd.service \ file://ifmib.patch \ file://fix-libtool-finish.patch \ + file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \ " SRC_URI[md5sum] = "a2c83518648b0f2a5d378625e45c0e18"
@@ -41,6 +42,9 @@ EXTRA_OECONF = "--disable-embedded-perl \ # net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp EXTRA_OECONF += "--with-mib-modules=smux" +PACKAGECONFIG ??= "" +PACKAGECONFIG[elfutils] = "--with-elf, --without-elf, elfutils" + CACHED_CONFIGUREVARS = " \ ac_cv_header_valgrind_valgrind_h=no \ ac_cv_header_valgrind_memcheck_h=no \
Signature · 1 line
1.9.1
PATCH 5/7 net-snmp: init script fixes
In reply to [email protected]From: Jackie Huang <[email protected]>
Changes:
1. Add source function and status command.
2. make it possible to change the start arguments with a default file in the same way as debian.
3. change the default INITSCRIPT_PARAMS
4. Add PIDFILE and fix restart
5. remove the postrm sicne we use the one from update-rc.d
--- .../recipes-protocols/net-snmp/files/init | 51 +++++++++++----------- .../recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 11 +---- 2 files changed, 27 insertions(+), 35 deletions(-)
meta-networking/recipes-protocols/net-snmp/files/init +26 -25
@@ -1,6 +1,8 @@ #! /bin/sh # /etc/init.d/snmpd: start snmp daemon. +. /etc/init.d/functions + test -x /usr/sbin/snmpd || exit 0 test -x /usr/sbin/snmptrapd || exit 0
@@ -10,21 +12,23 @@ SNMPDRUN=yes SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid' TRAPDRUN=no TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid' +PIDFILE=/var/run/snmpd.pid +SPIDFILE=/var/run/snmptrapd.pid -# Cd to / before starting any daemons. -cd / +# Reads config file if exists (will override defaults above) +[ -r /etc/default/snmpd ] && . /etc/default/snmpd case "$1" in start) echo -n "Starting network management services:" - if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then - start-stop-daemon -S -x /usr/sbin/snmpd \ - -- $SNMPDOPTS + if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf -a ! -f "$PIDFILE" ]; then + start-stop-daemon -o --start --quiet --name snmpd --pidfile "$PIDFILE" \ + --exec /usr/sbin/snmpd -- $SNMPDOPTS echo -n " snmpd" fi - if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then - start-stop-daemon -S -x /usr/sbin/snmptrapd \ - -- $TRAPDOPTS + if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf -a ! -f "$SPIDFILE" ]; then + start-stop-daemon -o --start --quiet --name snmptrapd --pidfile "$SPIDFILE" \ + --exec /usr/sbin/snmptrapd -- $TRAPDOPTS echo -n " snmptrapd" fi echo "."
@@ -33,32 +37,29 @@ case "$1" in ;; stop) echo -n "Stopping network management services:" - start-stop-daemon -K -x /usr/sbin/snmpd + if [ -f "$PIDFILE" ] ; then + start-stop-daemon -o --stop --quiet --pidfile $PIDFILE --name snmpd + fi echo -n " snmpd" - start-stop-daemon -K -x /usr/sbin/snmptrapd + if [ -f "$SPIDFILE" ] ; then + start-stop-daemon -o --stop --quiet --pidfile $SPIDFILE --name snmptrapd + rm -rf $SPIDFILE + fi echo -n " snmptrapd" echo "." ;; + status) + status /usr/sbin/snmpd; + exit $? + ;; restart|reload|force-reload) - echo -n "Restarting network management services:" - start-stop-daemon -K -x /usr/sbin/snmpd - start-stop-daemon -K -x /usr/sbin/snmptrapd + $0 stop # Allow the daemons time to exit completely. sleep 2 - if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then - start-stop-daemon -S -x /usr/sbin/snmpd -- $SNMPDOPTS - echo -n " snmpd" - fi - if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then - # Allow snmpd time to start up. - sleep 1 - start-stop-daemon -S -x /usr/sbin/snmptrapd -- $TRAPDOPTS - echo -n " snmptrapd" - fi - echo "." + $0 start ;; *) - echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload}" + echo "Usage: /etc/init.d/snmpd {start|stop|status|restart|reload|force-reload}" exit 1 esac
meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +1 -10
@@ -107,7 +107,7 @@ CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf" INITSCRIPT_PACKAGES = "${PN}-server" INITSCRIPT_NAME_${PN}-server = "snmpd" -INITSCRIPT_PARAMS_${PN}-server = "defaults" +INITSCRIPT_PARAMS_${PN}-server = "start 90 2 3 4 5 . stop 60 0 1 6 ." EXTRA_OECONF += "${@base_contains('DISTRO_FEATURES', 'systemd', '--with-systemd', '--without-systemd', d)}"
@@ -133,12 +133,3 @@ RREPLACES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd" RCONFLICTS_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd" LEAD_SONAME = "libnetsnmp.so" - -pkg_postrm_${PN}-server() { - if test "x$D" != "x"; then - OPT="-r $D " - else - OPT="" - /etc/init.d/snmpd stop - fi -}
Signature · 1 line
1.9.1
PATCH 6/7 net-snmp: move net-snmp-config to client package
In reply to [email protected]From: Jackie Huang <[email protected]>
Since net-snmp-config is a common tool, move it from dev package to client package.
--- meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +1 -1
@@ -100,7 +100,7 @@ FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \ FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/" FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/" -FILES_${PN}-dev += "${bindir}/net-snmp-config ${bindir}/mib2c ${bindir}/mib2c-update" +FILES_${PN}-dev += "${bindir}/mib2c ${bindir}/mib2c-update" CONFFILES_${PN}-server-snmpd = "${sysconfdir}/snmp/snmpd.conf" CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf"
Signature · 1 line
1.9.1
PATCH 7/7 net-snmp: add ptest package
In reply to [email protected]From: Jackie Huang <[email protected]>
Issue: TA79430
- Change to use append for PACKAGES so that:
* ptest package is added from ptest bbcalss
* the PN is back, allow empty and add rdepends on net-snmp-client in case the user try to add net-snmp to the image
- Add a patch to fix the output format for ptest
- Add run-ptest
- Add rdepends on perl for ptest
(LOCAL REV: NOT UPSTREAM) -- Sent to meta-networking on 20150114
--- ...p-testing-add-the-output-format-for-ptest.patch | 37 ++++++++++++++++++++++ .../recipes-protocols/net-snmp/net-snmp/run-ptest | 4 +++ .../recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | 35 ++++++++++++++++++-- 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-testing-add-the-output-format-for-ptest.patch create mode 100755 meta-networking/recipes-protocols/net-snmp/net-snmp/run-ptest
meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-testing-add-the-output-format-for-ptest.patch new file +37 -0
@@ -0,0 +1,37 @@ +From 4bb4024b395f19d36ab3569e2773ea80d8cc5261 Mon Sep 17 00:00:00 2001 +From: Jackie Huang <[email protected]> +Date: Wed, 14 Jan 2015 15:10:06 +0800 +Subject: [PATCH] testing: add the output format for ptest + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Jackie Huang <[email protected]> +--- + testing/RUNTESTS | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/testing/RUNTESTS b/testing/RUNTESTS +index e11c969..fb90f76 100755 +--- a/testing/RUNTESTS ++++ b/testing/RUNTESTS +@@ -25,13 +25,17 @@ failed_count=0 + rm -f failed_tests + for i in "${srcdir}"/testing/fulltests/default/T*$1*; do + echo "RUNNING $i" ++ test_name=`basename $i` + ${srcdir}/testing/fulltests/support/simple_run $i + if [ $? = 0 ]; then ++ echo "PASS: $test_name" + success_count=`expr $success_count + 1` + else ++ echo "FAIL: $test_name" + failed_count=`expr $failed_count + 1` + echo "$i" >> failed_tests + fi ++ echo + done + + if [ -f failed_tests ]; then +-- +1.7.1 +
meta-networking/recipes-protocols/net-snmp/net-snmp/run-ptest new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh + +cd testing +./RUNTESTS
meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +32 -3
@@ -17,12 +17,14 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ file://ifmib.patch \ file://fix-libtool-finish.patch \ file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \ + file://net-snmp-testing-add-the-output-format-for-ptest.patch \ + file://run-ptest \ " SRC_URI[md5sum] = "a2c83518648b0f2a5d378625e45c0e18" SRC_URI[sha256sum] = "ac9105539971f7cfb1456a86d479e18e8a8b3712212595ad40504347ba5843da" -inherit autotools update-rc.d siteinfo systemd +inherit autotools update-rc.d siteinfo systemd ptest EXTRA_OEMAKE = "INSTALL_PREFIX=${D}"
@@ -71,6 +73,24 @@ do_install_append() { install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system } +do_install_ptest() { + install -d ${D}${PTEST_PATH} + for i in ${S}/dist ${S}/include ${B}/include ${S}/mibs ${S}/configure \ + ${B}/net-snmp-config ${S}/testing; do + if [ -e "$i" ]; then + cp -a "$i" ${D}${PTEST_PATH} + fi + done + echo `autoconf -V|awk '/autoconf/{print $NF}'` > ${D}${PTEST_PATH}/dist/autoconf-version + + rmdlist="${D}${PTEST_PATH}/dist/net-snmp-solaris-build" + for i in $rmdlist; do + if [ -d "$i" ]; then + rm -rf "$i" + fi + done +} + SYSROOT_PREPROCESS_FUNCS += "net_snmp_sysroot_preprocess" net_snmp_sysroot_preprocess () {
@@ -80,9 +100,9 @@ net_snmp_sysroot_preprocess () { fi } -PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-dev ${PN}-staticdev ${PN}-static ${PN}-libs \ - ${PN}-mibs ${PN}-server ${PN}-client ${PN}-server-snmpd ${PN}-server-snmptrapd" +PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client ${PN}-server-snmpd ${PN}-server-snmptrapd" +ALLOW_EMPTY_${PN} = "1" ALLOW_EMPTY_${PN}-server = "1" FILES_${PN}-libs = "${libdir}/lib*${SOLIBS}"
@@ -98,6 +118,7 @@ FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \ ${systemd_unitdir}/system/snmptrapd.service \ " +FILES_${PN} = "" FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/" FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/" FILES_${PN}-dev += "${bindir}/mib2c ${bindir}/mib2c-update"
@@ -117,10 +138,18 @@ SYSTEMD_PACKAGES = "${PN}-server-snmpd \ SYSTEMD_SERVICE_${PN}-server-snmpd = "snmpd.service" SYSTEMD_SERVICE_${PN}-server-snmptrapd = "snmptrapd.service" +RDEPENDS_${PN} += "net-snmp-client" RDEPENDS_${PN}-server-snmpd += "net-snmp-mibs" RDEPENDS_${PN}-server-snmptrapd += "net-snmp-server-snmpd" RDEPENDS_${PN}-server += "net-snmp-server-snmpd net-snmp-server-snmptrapd" RDEPENDS_${PN}-client += "net-snmp-mibs" +RDEPENDS_${PN}-ptest += "perl \ + perl-module-test \ + perl-module-file-basename \ + perl-module-getopt-long \ + perl-module-file-temp \ + perl-module-data-dumper \ +" RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})" RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
Signature · 1 line
1.9.1