1 Star 0 Fork 15

yixiangzhike/net-snmp

forked from src-openEuler/net-snmp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
net-snmp.spec 11.95 KB
一键复制 编辑 原始数据 按行查看 历史
eaglegai 提交于 2020-06-19 11:00 . adapt to python new verion
%{!?netsnmp_check: %global netsnmp_check 1}
%global multilib_arches x86_64 aarch64
Name: net-snmp
Version: 5.8
Release: 9
Epoch: 1
Summary: SNMP Daemon
License: BSD
URL: http://net-snmp.sourceforge.net/
Source0: https://sourceforge.net/projects/net-snmp/files/net-snmp/%{version}/net-snmp-%{version}.tar.gz
Source1: net-snmp.conf
Source2: net-snmp-config.h
Source3: net-snmp-config
Source4: net-snmp-trapd.conf
Source5: net-snmpd.sysconfig
Source6: net-snmptrapd.sysconfig
Source7: net-snmp-tmpfs.conf
Source8: snmpd.service
Source9: snmptrapd.service
Source10: IETF-MIB-LICENSE.txt
# These patches are from fedora29
Patch1: net-snmp-5.7.2-pie.patch
Patch2: net-snmp-5.8-dir-fix.patch
Patch3: net-snmp-5.8-multilib.patch
Patch4: net-snmp-5.8-test-debug.patch
Patch5: net-snmp-5.7.2-autoreconf.patch
Patch6: net-snmp-5.8-agentx-disconnect-crash.patch
Patch7: net-snmp-5.7.2-cert-path.patch
Patch8: net-snmp-5.8-cflags.patch
Patch9: net-snmp-5.8-Remove-U64-typedef.patch
Patch10: net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
Patch11: net-snmp-5.7.3-iterator-fix.patch
Patch12: net-snmp-5.8-autofs-skip.patch
Patch101: net-snmp-5.8-modern-rpm-api.patch
Patch102: net-snmp-5.8-python3.patch
Patch6000: avoid-triggering-undefined-shift-left.patch
%{?systemd_requires}
BuildRequires: systemd gcc openssl-devel bzip2-devel elfutils-devel libselinux-devel
BuildRequires: elfutils-libelf-devel rpm-devel perl-devel perl(ExtUtils::Embed) procps
BuildRequires: python3-devel python3-setuptools chrpath mariadb-connector-c-devel net-tools
BuildRequires: perl(TAP::Harness) lm_sensors-devel autoconf automake
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: %{name}-libs = %{epoch}:%{version}-%{release}
Provides: %{name}-utils
Obsoletes: %{name}-utils
Provides: %{name}-agent-libs
Obsoletes: %{name}-agent-libs
%description
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
- An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.
%package libs
Summary: Libraries for %{name}
%description libs
Libraries for %{name}.
%package devel
Summary: Development files and Header files for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: %{name}-libs = %{epoch}:%{version}-%{release}
Requires: elfutils-devel rpm-devel elfutils-libelf-devel openssl-devel
Requires: lm_sensors-devel perl-devel
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package perl
Summary: Perl5 SNMP Extension Module
Requires: %{name} = %{epoch}:%{version}-%{release} perl-interpreter
Requires: %{name}-libs = %{epoch}:%{version}-%{release}
BuildRequires: perl-interpreter perl-generators
%description perl
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
%package gui
Summary: An interactive graphical MIB browser for SNMP
Requires: perl-Tk net-snmp-perl = %{epoch}:%{version}-%{release}
%description gui
The %{name}-gui package contains tkmib utility. It is also
capable of sending or retrieving the SNMP management information
to/from the remote agents interactively.
%package -n python3-net-snmp
%{?python_provide:%python_provide python3-net-snmp}
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Summary: The Python 'netsnmp' module for the Net-SNMP
Requires: %{name}-libs = %{epoch}:%{version}-%{release}
%description -n python3-net-snmp
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
Net-SNMP toolkit library.
%package_help
%prep
%autosetup -p1
cp %{SOURCE10} .
%build
autoreconf
MIBS="host agentx smux \
ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
ip-mib/ipAddressPrefixTable/ipAddressPrefixTable \
ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
sctp-mib rmon-mib etherlike-mib"
MIBS="$MIBS ucd-snmp/lmsensorsMib"
%configure --enable-shared --enable-as-needed --enable-embedded-perl \
--enable-ipv6 --enable-local-smux --enable-mfd-rewrites \
--enable-ucd-snmp-compatibility --sysconfdir=%{_sysconfdir} \
--with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT" \
--with-ldflags="-Wl,-z,relro -Wl,-z,now" \
--with-logfile="/var/log/snmpd.log" \
--with-mib-modules="$MIBS" --with-mysql \
--with-openssl --with-persistent-directory="/var/lib/net-snmp" \
--with-perl-modules="INSTALLDIRS=vendor" --with-pic \
--with-security-modules=tsm --with-sys-location="Unknown" \
--with-systemd --with-temp-file-pattern=/var/run/net-snmp/snmp-tmp-XXXXXX \
--with-transports="DTLSUDP TLSTCP" --with-sys-contact="root@localhost" <<EOF
EOF
cp libtool libtool.orig
%disable_rpath
make
find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
pushd python
%{__python3} setup.py --basedir="../" build
popd
%install
make install DESTDIR=%{buildroot}
basearch=%{_arch}
%ifarch %{multilib_arches}
mv %{buildroot}/%{_bindir}/net-snmp-config %{buildroot}/%{_bindir}/net-snmp-config-${basearch}
install -m 755 %SOURCE3 %{buildroot}/%{_bindir}/net-snmp-config
mv %{buildroot}/%{_includedir}/net-snmp/net-snmp-config.h %{buildroot}/%{_includedir}/net-snmp/net-snmp-config-${basearch}.h
install -m644 %SOURCE2 %{buildroot}/%{_includedir}/net-snmp/net-snmp-config.h
%endif
mkdir -p %{buildroot}%{_sysconfdir}/snmp
install -m 644 %SOURCE1 %{buildroot}%{_sysconfdir}/snmp/snmpd.conf
install -m 644 %SOURCE4 %{buildroot}%{_sysconfdir}/snmp/snmptrapd.conf
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
install -m 644 %SOURCE5 %{buildroot}%{_sysconfdir}/sysconfig/snmpd
install -m 644 %SOURCE6 %{buildroot}%{_sysconfdir}/sysconfig/snmptrapd
mkdir -p %{buildroot}%{_localstatedir}/lib/net-snmp/mib_indexes
mkdir -p %{buildroot}%{_localstatedir}/lib/net-snmp/cert_indexes
mkdir -p %{buildroot}%{_localstatedir}/run/net-snmp
rm -f %{buildroot}%{_bindir}/snmpinform
ln -s snmptrap %{buildroot}%{_bindir}/snmpinform
%delete_la_and_a
find %{buildroot} -name perllocal.pod -o -name .packlist -o -name "*.bs" \
-o -name Makefile.subs.pl | xargs -ri rm -f {}
install -m 644 local/mib2c.*.conf %{buildroot}%{_datadir}/snmp
pushd python
%{__python3} setup.py --basedir=.. install -O1 --skip-build --root %{buildroot}
popd
find %{buildroot} -name '*.so' | xargs chmod 0755
dd bs=1024 count=250 if=ChangeLog of=ChangeLog.trimmed
for file in README COPYING; do
iconv -f 8859_1 -t UTF-8 <$file >$file.utf8
mv $file.utf8 $file
done
chmod 644 local/passtest local/ipf-mod.pl
mkdir -p %{buildroot}/usr/include/net-snmp/agent/util_funcs
install -m 644 agent/mibgroup/util_funcs/*.h %{buildroot}/usr/include/net-snmp/agent/util_funcs
mkdir -p %{buildroot}/%{_tmpfilesdir}
install -m 644 %SOURCE7 %{buildroot}/%{_tmpfilesdir}/net-snmp.conf
mkdir -p %{buildroot}/%{_unitdir}
install -m 644 %SOURCE8 %SOURCE9 %{buildroot}/%{_unitdir}/
%check
%if %{netsnmp_check}
cp -f libtool.orig libtool
chmod 755 local/passtest
LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
%endif
%post
%systemd_post snmpd.service snmptrapd.service
%preun
%systemd_preun snmpd.service snmptrapd.service
%postun
%systemd_postun_with_restart snmpd.service snmptrapd.service
%ldconfig_scriptlets
%ldconfig_scriptlets libs
%files
%license COPYING
%config(noreplace) %{_sysconfdir}/sysconfig/snmpd
%config(noreplace) %{_sysconfdir}/sysconfig/snmptrapd
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/snmp/snmpd.conf
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/snmp/snmptrapd.conf
%{_bindir}/agentxtrap
%{_prefix}/lib/systemd/system/*.service
%{_prefix}/lib/tmpfiles.d/net-snmp.conf
%{_sbindir}/snmp*
%dir %{_datadir}/snmp
%{_datadir}/snmp/snmpconf-data/*
%{_bindir}/net-snmp-create-v3-user
%{_bindir}/snmpconf
%{_bindir}/snmp[^c-]*
%{_bindir}/encode_keychange
%dir /var/run/net-snmp
%{_libdir}/libnetsnmpagent.so.*
%{_libdir}/libnetsnmphelpers.so.*
%{_libdir}/libnetsnmpmibs.so.*
%{_libdir}/libnetsnmptrapd.so.*
%exclude %{_prefix}/lib/debug/usr/sbin/snmptrapd-5.8-1.oe1.aarch64.debug
%exclude %{_bindir}/ipf-mod.pl
%exclude %{_bindir}/fixproc
%exclude %{_bindir}/snmpcheck
%exclude %{_libdir}/libsnmp*
%files libs
%{_libdir}/libnetsnmp.so.*
%dir %{_datadir}/snmp
%{_datadir}/snmp/mibs/*
%dir %{_localstatedir}/lib/net-snmp
%dir %{_localstatedir}/lib/net-snmp/mib_indexes
%dir %{_localstatedir}/lib/net-snmp/cert_indexes
%files devel
%attr(0644,root,root)
%attr(0755,root,root) %{_bindir}/net-snmp-config*
%{_includedir}/net-snmp/*
%{_includedir}/ucd-snmp/*.h
%{_libdir}/libnet*.so
%files perl
%{_bindir}/mib2c*
%{_bindir}/net-snmp-cert
%{_bindir}/checkbandwidth
%{_bindir}/snmp-bridge-mib
%{_bindir}/traptoemail
%{_libdir}/perl5/vendor_perl/auto/*SNMP/*
%dir %{_libdir}/perl5/vendor_perl/auto/Bundle/NetSNMP
%{_libdir}/perl5/vendor_perl/Bundle/MakefileSubs.pm
%{_libdir}/perl5/vendor_perl/NetSNMP/*.pm
%{_libdir}/perl5/vendor_perl/NetSNMP/agent/*.pm
%{_libdir}/perl5/vendor_perl/SNMP.pm
%{_datadir}/snmp/mib2c-data/*
%{_datadir}/snmp/mib2c*.conf
%{_datadir}/snmp/snmp_perl*
%files gui
%{_bindir}/tkmib
%attr(0644,root,root) %{_mandir}/man1/tkmib.1.gz
%files -n python3-net-snmp
%doc README
%{_libdir}/python%{python3_version}/site-packages/*
%files help
%doc ChangeLog.trimmed EXAMPLE.conf FAQ NEWS TODO README.snmpv3
%doc README README.agent-mibs README.agentx README.krb5
%doc local/passtest local/ipf-mod.pl IETF-MIB-LICENSE.txt
%doc README.thread AGENT.txt PORTING local/README.mib2c
%doc README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solaris README.win32
%attr(0644,root,root)
%{_mandir}/man1/agentxtrap.1.gz
%{_mandir}/man1/net-snmp-create-v3-user.1.gz
%{_mandir}/man1/snmpconf.1.gz
%{_mandir}/man5/snmp*.5.gz
%{_mandir}/man5/variables.5.gz
%{_mandir}/man8/snmp*.8.gz
%{_mandir}/man1/snmp*.1.gz
%{_mandir}/man1/encode_keychange.1.gz
%{_mandir}/man5/variables.5.gz
%{_mandir}/man5/snmp.conf.5.gz
%{_mandir}/man1/net-snmp-config.1.gz
%{_mandir}/man3/*.3.gz
%{_mandir}/man1/mib2c*.1.gz
%{_mandir}/man1/snmp-bridge-mib.1.gz
%{_mandir}/man1/traptoemail.1.gz
%{_mandir}/man3/NetSNMP*.3pm.gz
%{_mandir}/man5/mib2c.conf.5.gz
%{_mandir}/man1/fixproc*
%changelog
* Fri Jun 19 2020 gaihuiying <gaihuiying1@huawei.com> - 5.8-9
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: adapt to python new verion
* Thu Mar 12 2020 Buildteam <buildteam@openeuler.org> - 5.8-8
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:avoid triggering undefined shift left
* Tue Feb 18 2020 hexiujun <hexiujun1@huawei.com> - 5.8-7
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:unpack libs subpackage
* Fri Dec 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-6
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:rename some conf files
* Sat Oct 19 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-5
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:change the directory of the license files
* Wed Sep 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-4
- Type:bugfix
- ID:NA
- SUG:NA
* Tue Sep 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-3
- Type:version fallback
- ID:NA
- SUG:NA
* Mon Sep 23 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-2
- Package init
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yixiangzhike/net-snmp.git
git@gitee.com:yixiangzhike/net-snmp.git
yixiangzhike
net-snmp
net-snmp
master

搜索帮助