Blob Blame History Raw
# The check need root privilege hence disabled by default
%bcond_with check

Name:           nispor
Version:        1.2.12
Release:        %autorelease
Summary:        Unified interface for Linux network state querying
License:        Apache-2.0
Patch1:         0001-Makefile-Fix-version-1.2.12.patch
BuildRequires:  make
BuildRequires:  pkg-config
BuildRequires:  python3-devel
BuildRequires:  python-setuptools
BuildRequires:  systemd-devel
BuildRequires:  systemd-rpm-macros
BuildRequires:  patchelf
%if 0%{?rhel}
BuildRequires:  rust-toolset
BuildRequires:  rust-packaging
BuildRequires:  (crate(clap/cargo) >= 4.2.0 with crate(clap/cargo) < 5.0)
BuildRequires:  (crate(clap/default) >= 4.2.0 with crate(clap/default) < 5.0)
BuildRequires:  (crate(env_logger/default) >= 0.10 with crate(env_logger/default) < 0.11)
BuildRequires:  (crate(ethtool/default) >= 0.2.5 with crate(ethtool/default) < 0.3)
BuildRequires:  (crate(futures/default) >= 0.3 with crate(futures/default) < 0.4)
BuildRequires:  (crate(libc/default) >= 0.2.126 with crate(libc/default) < 0.3)
BuildRequires:  (crate(log/default) >= 0.4 with crate(log/default) < 0.5)
BuildRequires:  (crate(mptcp-pm/default) >= 0.1.3 with crate(mptcp-pm/default) < 0.2)
BuildRequires:  (crate(netlink-packet-route/default) >= 0.17.0 with crate(netlink-packet-route/default) < 0.18)
BuildRequires:  (crate(netlink-packet-utils/default) >= 0.5.2 with crate(netlink-packet-utils/default) < 0.6)
BuildRequires:  (crate(netlink-sys/default) >= 0.8.4 with crate(netlink-sys/default) < 0.9)
BuildRequires:  (crate(rtnetlink/default) >= 0.13.1 with crate(rtnetlink/default) < 0.14)
BuildRequires:  (crate(serde/default) >= 1.0 with crate(serde/default) < 2.0)
BuildRequires:  (crate(serde/derive) >= 1.0 with crate(serde/derive) < 2.0)
BuildRequires:  (crate(serde_json/default) >= 1.0 with crate(serde_json/default) < 2.0)
BuildRequires:  (crate(serde_yaml/default) >= 0.9 with crate(serde_yaml/default) < 0.10)
BuildRequires:  (crate(tokio/macros) >= 1.18 with crate(tokio/macros) < 2.0)
BuildRequires:  (crate(tokio/rt) >= 1.18 with crate(tokio/rt) < 2.0)

Unified interface for Linux network state querying.

%if ! 0%{?rhel}
%package -n     rust-%{name}-devel
Summary:        %{summary}
BuildArch:      noarch

%description -n rust-%{name}-devel

This package contains library source intended for building other packages
which use "%{name}" crate.

%package -n     rust-%{name}+default-devel
Summary:        %{summary}
BuildArch:      noarch

%description -n rust-%{name}+default-devel

This package contains library source intended for building other packages
which use "%{name}" crate with default feature.

%package -n     python3-%{name}
Summary:        %{summary}
Requires:       nispor = %{?epoch:%{epoch}:}%{version}-%{release}
BuildArch:      noarch

%description -n python3-%{name}

This package contains python3 binding of %{name}.

%package        devel
Summary:        %{summary}
Requires:       nispor%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}

%description devel

This package contains C binding of %{name}.

%autosetup -n %{name}-%{version_no_tilde} -p1
# Drop the upstream fix on SONAME as fedora %cargo_xxx marcos override it,
# we use patchelf to set the SONAME.
rm .cargo/config.toml

%if 0%{?rhel}
%cargo_prep -V 1


pushd src/python

%if ! 0%{?rhel}
# cargo_install has problem on detecting library when running in workspace
# due to bug
# Removing the workspace Cargo.toml will workaround this problem.
rm Cargo.toml
pushd src/lib

env SKIP_PYTHON_INSTALL=1 PREFIX=%{_prefix} LIBDIR=%{_libdir} %make_install

pushd src/python

patchelf --set-soname \

%if %{with check}

%license LICENSE

%files -n       python3-%{name}
%license LICENSE

%files devel
%license LICENSE

%if ! 0%{?rhel}
%files -n       rust-%{name}-devel
%license LICENSE

%files -n       rust-%{name}+default-devel
%ghost %{cargo_registry}/%{name}-%{version_no_tilde}/Cargo.toml