lldpd/lldpd.spec

147 lines
3.7 KiB
RPMSpec
Raw Normal View History

2017-04-05 15:42:11 +00:00
# there are tests but they don't run in mock
# as they require the ability to create and act
# inside a network namespace
%bcond_with tests
%global gh_owner vincentbernat
Name: lldpd
Version: 0.9.7
Release: 2%{?dist}
Summary: ISC-licensed implementation of LLDP
License: ISC
URL: https://%{gh_owner}.github.io/%{name}/
Source0: https://github.com/%{gh_owner}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}-fedora.service
Source2: %{name}-tmpfiles
%if 0%{?with_tests}
#For tests
BuildRequires: python3-apipkg
BuildRequires: python3-execnet
BuildRequires: python3-py
BuildRequires: python3-pyroute2
BuildRequires: python3-pytest
BuildRequires: python3-pytest-xdist
BuildRequires: python3-wheel
BuildRequires: python3-devel
%endif
BuildRequires: libtool
BuildRequires: libevent-devel
BuildRequires: readline-devel
BuildRequires: check-devel
BuildRequires: net-snmp-devel
BuildRequires: libxml2-devel
# For systemd stuff
BuildRequires: systemd
%{?systemd_requires}
Requires(pre): shadow-utils
%description
LLDP is an industry standard protocol designed to supplant proprietary
Link-Layer protocols such as EDP or CDP. The goal of LLDP is to provide
an inter-vendor compatible mechanism to deliver Link-Layer notifications
to adjacent network devices.
%package devel
Requires: %{name}%{?_isa} = %{version}-%{release}
Summary: %{summary}
%description devel
%{name} development libraries and headers
%prep
%autosetup
%build
./autogen.sh
%configure --disable-static --with-snmp --disable-silent-rules \
--with-systemdsystemunitdir=%{_unitdir} --with-sysusersdir=no \
--with-privsep-user=%{name} --with-privsep-group=%{name} \
--with-privsep-chroot=/run/%{name}/chroot \
--with-lldpd-ctl-socket=/run/%{name}/%{name}.socket
make %{?_smp_mflags}
%install
%make_install
install -p -D -m644 redhat/%{name}.sysconfig %{buildroot}/etc/sysconfig/%{name}
install -p -D -m644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
install -p -D -m644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -d -D -m 0755 %{buildroot}/run/%{name}/chroot
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}
# remove the docs from buildroot
rm -rf %{buildroot}/usr/share/doc/%{name}
# don't include completion conf yet
rm -f %{buildroot}/usr/share/bash-completion/completions/lldpcli
rm -f %{buildroot}/usr/share/zsh/vendor-completions/_lldpcli
# remove static libtool archive
rm -f %{buildroot}%{_libdir}/liblldpctl.la
%check
%if 0%{?with_tests}
cd tests/integration
%{__python3} -m pytest -n 5 -vv --boxed
%endif
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
-c "Used by the %{name} daemon" %{name}
exit 0
%post
/sbin/ldconfig
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
/sbin/ldconfig
%systemd_postun_with_restart %{name}.service
%files
%doc NEWS README.md
%license LICENSE
%{_sbindir}/lldpcli
%{_sbindir}/lldpctl
%{_sbindir}/%{name}
%config %{_sysconfdir}/%{name}.d
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_mandir}/man8/lldpcli.8*
%{_mandir}/man8/lldpctl.8*
%{_mandir}/man8/%{name}.8*
%{_libdir}/liblldpctl.so.4
%{_libdir}/liblldpctl.so.4.8.0
%dir /run/%{name}
%dir /run/%{name}/chroot
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%dir %attr(-,lldpd,lldpd) %{_sharedstatedir}/%{name}
%files devel
%{_includedir}/lldp-const.h
%{_includedir}/lldpctl.h
%{_libdir}/liblldpctl.so
%{_libdir}/pkgconfig/lldpctl.pc
%changelog
* Wed Apr 05 2017 James Hogarth <james.hogarth@gmail.com> - 0.9.7-2
- Tweaks to spec requested in review
* Tue Apr 04 2017 James Hogarth <james.hogarth@gmail.com> - 0.9.7-1
- Initial package