From ac4684bb69b0e14abef4b81006115a4077ca6d94 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 29 Jan 2018 17:06:24 +0100 Subject: [PATCH] gnu: Add net-snmp. * gnu/packages/snmp.scm, gnu/packages/patches/net-snmp-disable-network-tests.patch: New files. * gnu/local.mk (GNU_SYSTEM_MODULES, dist_patch_DATA): Register it. --- gnu/local.mk | 2 + .../net-snmp-disable-network-tests.patch | 84 +++++++++++++++ gnu/packages/snmp.scm | 101 ++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 gnu/packages/patches/net-snmp-disable-network-tests.patch create mode 100644 gnu/packages/snmp.scm diff --git a/gnu/local.mk b/gnu/local.mk index 80d6a8d4c..0a468578b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -385,6 +385,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/slang.scm \ %D%/packages/smalltalk.scm \ %D%/packages/sml.scm \ + %D%/packages/snmp.scm \ %D%/packages/speech.scm \ %D%/packages/spice.scm \ %D%/packages/ssh.scm \ @@ -920,6 +921,7 @@ dist_patch_DATA = \ %D%/packages/patches/mupen64plus-ui-console-notice.patch \ %D%/packages/patches/mutt-store-references.patch \ %D%/packages/patches/ncurses-CVE-2017-10684-10685.patch \ + %D%/packages/patches/net-snmp-disable-network-tests.patch \ %D%/packages/patches/net-tools-bitrot.patch \ %D%/packages/patches/netcdf-date-time.patch \ %D%/packages/patches/netcdf-tst_h_par.patch \ diff --git a/gnu/packages/patches/net-snmp-disable-network-tests.patch b/gnu/packages/patches/net-snmp-disable-network-tests.patch new file mode 100644 index 000000000..c1869a9b1 --- /dev/null +++ b/gnu/packages/patches/net-snmp-disable-network-tests.patch @@ -0,0 +1,84 @@ +Drop tests that require network access. + +--- a/testing/fulltests/default/T070com2sec_simple ++++ b/testing/fulltests/default/T070com2sec_simple +@@ -80,12 +80,6 @@ + # 407b Test maximally long host name/mask + CONFIGAGENT 'com2sec t407b a23456789012345678901234567890123456789012345678901234567890123.a23456789012345678901234567890123456789012345678901234567890123.a23456789012345678901234567890123456789012345678901234567890123.a234567890123456789012345678901234567890123456789012345678901./255.255.255.255 c407b' + +-# 408 Lookup tests, require network access +-# 408a Test lookup returning a single host +-CONFIGAGENT 'com2sec t408a onea.net-snmp.org c408a' +-# 408a Test lookup returning multiple hosts +-CONFIGAGENT 'com2sec t408b twoa.net-snmp.org c408b' +- + # Default agent setup + CONFIGAGENT "[snmp] persistentdir $SNMP_TMP_PERSISTENTDIR" + # Dummy config to prevent the basic_setup warning +@@ -134,26 +128,4 @@ + SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies + SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies + +-CHECKAGENT '<"c408a"' +-if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 32: Error:' +- if [ "$snmp_last_test_result" -ne 1 ] ; then +- return_value=1 +- FINISHED +- fi +-elif [ "$snmp_last_test_result" -ne 1 ] ; then +- return_value=1 +- FINISHED +-fi +- +-CHECKAGENT '<"c408b"' +-if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 33: Error:' +- if [ "$snmp_last_test_result" -ne 1 ] ; then +- return_value=1 +- fi +-elif [ "$snmp_last_test_result" -ne 1 ] ; then +- return_value=1 +-fi +- + FINISHED +--- a/testing/fulltests/default/T071com2sec6_simple ++++ b/testing/fulltests/default/T071com2sec6_simple +@@ -74,12 +74,6 @@ + # 607b Test maximally long host name/mask + CONFIGAGENT 'com2sec6 t607b a23456789012345678901234567890123456789012345678901234567890123.a23456789012345678901234567890123456789012345678901234567890123.a23456789012345678901234567890123456789012345678901234567890123.a234567890123456789012345678901234567890123456789012345678901./ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff c607b' + +-# 608 Lookup tests, require network access +-# 608a Test lookup returning a single host +-CONFIGAGENT 'com2sec6 t608a oneAAAA.net-snmp.org c608a' +-# 608b Test lookup returning multiple hosts +-CONFIGAGENT 'com2sec6 t608b twoAAAA.net-snmp.org c608b' +- + # Default agent setup + CONFIGAGENT "[snmp] persistentdir $SNMP_TMP_PERSISTENTDIR" + # Dummy config to prevent the basic_setup warning +@@ -132,24 +126,4 @@ + SAVECHECKAGENT 'line 27: Error:' + SAVECHECKAGENT 'line 28: Error:' + +-# 608 +-CHECKAGENT '<"c608a"' +-if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 29: Error:' +- errnum=`expr $errnum - 1` +- if [ "$snmp_last_test_result" -ne 1 ] ; then +- FINISHED +- fi +-elif [ "$snmp_last_test_result" -ne 1 ] ; then +- FINISHED +-fi +- +-CHECKAGENTCOUNT atleastone '<"c608b"' +-if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 30: Error:' +- if [ "$snmp_last_test_result" -eq 1 ] ; then +- errnum=`expr $errnum - 1` +- fi +-fi +- + FINISHED diff --git a/gnu/packages/snmp.scm b/gnu/packages/snmp.scm new file mode 100644 index 000000000..be79f5458 --- /dev/null +++ b/gnu/packages/snmp.scm @@ -0,0 +1,101 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2018 Marius Bakke +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages snmp) + #:use-module (gnu packages) + #:use-module (gnu packages compression) + #:use-module (gnu packages linux) + #:use-module (gnu packages perl) + #:use-module (gnu packages tls) + #:use-module (guix build-system gnu) + #:use-module (guix download) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils)) + +(define-public net-snmp + (package + (name "net-snmp") + (version "5.8.pre1") + (source (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/net-snmp/" + "5.8-pre-releases/net-snmp-" version + ".tar.gz")) + (sha256 + (base32 + "1f1rwq2cqz9ysapl96rsay240dbz8s6wsprms7skl2vacq94s2bd")) + (patches (search-patches "net-snmp-disable-network-tests.patch")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Drop bundled libraries. + (delete-file-recursively "snmplib/openssl") + #t)))) + (build-system gnu-build-system) + (arguments + `(#:test-target "test" + ;; XXX: With parallel build enabled, Perl modules may not get linked with + ;; libnetsnmp. See e.g. . + #:parallel-build? #f + #:make-flags (let ((out (assoc-ref %outputs "out"))) + (list (string-append "INSTALLSITEARCH=" out + "/lib/perl5/site_perl/" + ,(package-version perl)) + (string-append "INSTALLSITEMAN3DIR=" out + "/share/man/man3") + ;; Make sure the Perl modules get a proper RUNPATH. + ;(string-append "LDFLAGS=-Wl,-rpath=" out "/lib") + )) + #:phases (modify-phases %standard-phases + (add-before 'check 'patch-tests + (lambda _ + (substitute* "testing/fulltests/support/simple_TESTCONF.sh" + (("NETSTAT=\"\"") (string-append "NETSTAT=" + (which "netstat")))) + (substitute* "testing/fulltests/default/T065agentextend_sh_simple" + (("/bin/sh") (which "sh"))) + (substitute* '("testing/fulltests/default/T061agentperl_simple" + "testing/fulltests/default/T065agentextend_simple" + "testing/fulltests/default/T115agentxperl_simple") + (("/usr/bin/env") (which "env"))) + + ;; Note: to debug test failures, step into the failed build + ;; directory, export OK_TO_SAVE_RESULT and run "make testfailed". + #t))))) + (native-inputs + `(("net-tools" ,net-tools-for-tests))) + (inputs + `(("bzip2" ,bzip2) + ("libnl" ,libnl) + ("linux-libre-headers" ,linux-libre-headers) + ("openssl" ,openssl) + ("perl" ,perl) + ("zlib" ,zlib))) + (home-page "http://net-snmp.sourceforge.net/") + (synopsis "SNMP tools and libraries") + (description + "@dfn{SNMP} (Simple Network Management Protocol) is a widely used protocol +for monitoring and managing servers and network devices. This package includes +command-line utilities for retrieving information and sending commands, a +graphical @dfn{MIB} (Management Information Base) browser, a daemon for responding +to SNMP commands (@command{snmptrapd}), an extensible SNMP server (@command{snmpd}), +and libraries for writing other SNMP applications.") + ;; Distributed under HPND and multiple variants of the 3-clause BSD license. + ;; See COPYING for full information. + (license (list license:hpnd license:bsd-3)))) -- 2.18.0