File infiniband-diags.spec of Package infiniband-diags.5570

#
# spec file for package infiniband-diags
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define git_ver -gitb2cfed8

Name:           infiniband-diags
Summary:        OpenFabrics Alliance InfiniBand Diagnostic Tools
License:        GPL-2.0 or BSD-2-Clause
Group:          Productivity/Networking/Diagnostic
Version:        1.6.6
Release:        0
Source0:        %{name}-%{version}%{git_ver}.tar.xz
Source1:        rdma-ndd.service
Patch2:         infiniband-diags-help_for_ibnodes.patch
Url:            http://www.openfabrics.org
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  glib2-devel
BuildRequires:  libibmad-devel
BuildRequires:  libibumad-devel
BuildRequires:  libibverbs-devel
BuildRequires:  libtool
BuildRequires:  libudev-devel
BuildRequires:  opensm-devel
BuildRequires:  pkg-config
BuildRequires:  python3-docutils
Requires:       perl = %{perl_version}

%define so_major 5

%description
diags provides IB diagnostic programs and scripts needed to diagnose an
IB subnet.

%package    -n libibnetdisc%{so_major}
Summary:        Infiniband Net Discovery runtime library
Group:          System/Libraries

%description -n libibnetdisc%{so_major}
This package contains the Infiniband Net Discovery runtime library needed
mainly by infiniband-diags.


%package devel
BuildRequires:  libibmad-devel
BuildRequires:  libibumad-devel
BuildRequires:  libibverbs-devel
BuildRequires:  opensm-devel
Requires:       %name = %version
Summary:        OpenIB InfiniBand Diagnostic Tools SDK
Group:          Development/Libraries/C and C++
Provides:       infiniband-diags:%{_libdir}/libibnetdisc.so

%description devel
diags provides IB diagnostic programs and scripts needed to diagnose an
IB subnet. This package contains all files needed for development.

%package       devel-static
Requires:       %name = %version
Summary:        Development package OpenIB InfiniBand Diagnostic Tools
Group:          Development/Libraries/C and C++

%description devel-static
diags provides IB diagnostic programs and scripts needed to diagnose an
IB subnet. This package contains the static library.

%package     -n rdma-ndd
Summary:        Daemon to manage RDMA Node Description
Group:          System Environment/Daemons
Requires:       %{name} = %{version}
# The udev rules in rdma need to be aware of rdma-ndd:
Conflicts:      rdma < 2.1
BuildRequires:  systemd
Requires(post):   systemd
Requires(preun):  systemd
Requires(postun): systemd

%description -n rdma-ndd
rdma-ndd is a system daemon which watches for rdma device changes and/or
hostname changes and updates the Node Description of the rdma devices based
on those changes.


%prep
%setup -q -n %{name}-%{version}
%patch2
# Avoid unnecessary rebuilds of the package
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M:%%S')
sed -i -e "s/__DATE__/\"$FAKE_BUILDDATE\"/" -e "s/__TIME__/\"$FAKE_BUILDTIME\"/" src/ibdiag_common.c

%build
autoreconf -fi
export CFLAGS="%{optflags}"
%configure --with-perl-installdir=%{perl_vendorarch} --enable-static
make %{?_smp_mflags} V=1

%install
make DESTDIR=%buildroot install
# systemd unit file
mkdir -p %{buildroot}%{_unitdir}
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
rm -f %{buildroot}%{_sysconfdir}/init.d/rdma-ndd
ln -sfn /usr/sbin/service %{buildroot}/usr/sbin/rcrdma-ndd

%post -n libibnetdisc%{so_major} -p /sbin/ldconfig
%postun -n libibnetdisc%{so_major} -p /sbin/ldconfig

%pre -n rdma-ndd
%service_add_pre rdma-ndd.service

%preun -n rdma-ndd
%service_del_preun rdma-ndd.service

%post -n rdma-ndd
%service_add_post rdma-ndd.service

%postun -n rdma-ndd
%service_del_postun rdma-ndd.service

%files
%defattr(-, root, root)
%doc COPYING README ChangeLog
%config %{_sysconfdir}/infiniband-diags/error_thresholds
%dir %{_sysconfdir}/infiniband-diags
%config(noreplace) %{_sysconfdir}/infiniband-diags/*
%_sbindir/*
%exclude %{_sbindir}/rdma-ndd
%_mandir/man8/*
%exclude %{_mandir}/man8/rdma-ndd.8*
%_mandir/man3/*
%{perl_vendorarch}/IBswcountlimits.pm

%files -n libibnetdisc%{so_major}
%defattr(-, root, root)
%{_libdir}/*.so.*

%files devel
%defattr(-, root, root)
%{_includedir}/infiniband/*.h
%{_libdir}/*.so

%files devel-static
%defattr(-, root, root)
%{_libdir}/*.a
%{_libdir}/*.la

%files -n rdma-ndd
%defattr(-, root, root)
%{_sbindir}/rdma-ndd
%{_unitdir}/rdma-ndd.service
%{_mandir}/man8/rdma-ndd.8*

%changelog
openSUSE Build Service is sponsored by