1368395
# The check need root privilege hence disabled by default
Gris Ge 8bc856b
%bcond_with check
Gris Ge 8bc856b
Gris Ge 8bc856b
Name:           nispor
Packit 9bd900d
Version:        1.2.18
d5daa5a
Release:        %autorelease
Gris Ge 8bc856b
Summary:        Unified interface for Linux network state querying
ed45198
License:        Apache-2.0
Gris Ge 8bc856b
URL:            https://github.com/nispor/nispor
Gris Ge 8bc856b
Source:         https://github.com/nispor/nispor/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
1c9ef25
Source1:        https://github.com/nispor/nispor/releases/download/v%{version}/nispor-vendor-%{version}.tar.xz
Fernando Fernandez Mancera 29b9915
BuildRequires:  make
Gris Ge 8bc856b
BuildRequires:  pkg-config
Gris Ge 8bc856b
BuildRequires:  python3-devel
Fernando Fernandez Mancera 29b9915
BuildRequires:  python-setuptools
Gris Ge 8bc856b
BuildRequires:  systemd-devel
Gris Ge 8bc856b
BuildRequires:  systemd-rpm-macros
1c9ef25
%if 0%{?rhel}
1c9ef25
BuildRequires:  rust-toolset
1c9ef25
%else
1c9ef25
BuildRequires:  rust-packaging
33d745b
BuildRequires:  (crate(clap/cargo) >= 4.2.0 with crate(clap/cargo) < 5.0)
33d745b
BuildRequires:  (crate(clap/default) >= 4.2.0 with crate(clap/default) < 5.0)
33d745b
BuildRequires:  (crate(env_logger/default) >= 0.10 with crate(env_logger/default) < 0.11)
e150bb6
BuildRequires:  (crate(ethtool/default) >= 0.2.5 with crate(ethtool/default) < 0.3)
67eee78
BuildRequires:  (crate(futures/default) >= 0.3 with crate(futures/default) < 0.4)
67eee78
BuildRequires:  (crate(libc/default) >= 0.2.126 with crate(libc/default) < 0.3)
67eee78
BuildRequires:  (crate(log/default) >= 0.4 with crate(log/default) < 0.5)
e150bb6
BuildRequires:  (crate(mptcp-pm/default) >= 0.1.3 with crate(mptcp-pm/default) < 0.2)
feae98c
BuildRequires:  (crate(netlink-packet-route/default) >= 0.19.0 with crate(netlink-packet-route/default) < 0.20)
1368395
BuildRequires:  (crate(netlink-packet-utils/default) >= 0.5.2 with crate(netlink-packet-utils/default) < 0.6)
1368395
BuildRequires:  (crate(netlink-sys/default) >= 0.8.4 with crate(netlink-sys/default) < 0.9)
feae98c
BuildRequires:  (crate(rtnetlink/default) >= 0.14.1 with crate(rtnetlink/default) < 0.15)
Gris Ge 8bc856b
BuildRequires:  (crate(serde/default) >= 1.0 with crate(serde/default) < 2.0)
03ac155
BuildRequires:  (crate(serde/derive) >= 1.0 with crate(serde/derive) < 2.0)
Gris Ge 8bc856b
BuildRequires:  (crate(serde_json/default) >= 1.0 with crate(serde_json/default) < 2.0)
67eee78
BuildRequires:  (crate(serde_yaml/default) >= 0.9 with crate(serde_yaml/default) < 0.10)
c5379f9
BuildRequires:  (crate(tokio/macros) >= 1.18 with crate(tokio/macros) < 2.0)
c5379f9
BuildRequires:  (crate(tokio/rt) >= 1.18 with crate(tokio/rt) < 2.0)
1c9ef25
%endif
Gris Ge 8bc856b
Gris Ge 8bc856b
%description
Gris Ge 8bc856b
Unified interface for Linux network state querying.
Gris Ge 8bc856b
1c9ef25
%if ! 0%{?rhel}
Gris Ge 8bc856b
%package -n     rust-%{name}-devel
Gris Ge 8bc856b
Summary:        %{summary}
Gris Ge 8bc856b
BuildArch:      noarch
Gris Ge 8bc856b
Gris Ge 8bc856b
%description -n rust-%{name}-devel
Gris Ge 8bc856b
Gris Ge 8bc856b
This package contains library source intended for building other packages
Gris Ge 8bc856b
which use "%{name}" crate.
Gris Ge 8bc856b
Gris Ge 8bc856b
%package -n     rust-%{name}+default-devel
Gris Ge 8bc856b
Summary:        %{summary}
Gris Ge 8bc856b
BuildArch:      noarch
Gris Ge 8bc856b
Gris Ge 8bc856b
%description -n rust-%{name}+default-devel
Gris Ge 8bc856b
Gris Ge 8bc856b
This package contains library source intended for building other packages
Gris Ge 8bc856b
which use "%{name}" crate with default feature.
1c9ef25
%endif
Gris Ge 8bc856b
Gris Ge 8bc856b
%package -n     python3-%{name}
Gris Ge 8bc856b
Summary:        %{summary}
Gris Ge 381ad62
Requires:       nispor = %{?epoch:%{epoch}:}%{version}-%{release}
Gris Ge 8bc856b
BuildArch:      noarch
Gris Ge 8bc856b
Gris Ge 8bc856b
%description -n python3-%{name}
Gris Ge 8bc856b
Gris Ge 8bc856b
This package contains python3 binding of %{name}.
Gris Ge 8bc856b
Gris Ge 8bc856b
%package        devel
Gris Ge 8bc856b
Summary:        %{summary}
Gris Ge 8bc856b
Requires:       nispor%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Gris Ge 8bc856b
Gris Ge 8bc856b
%description devel
Gris Ge 8bc856b
Gris Ge 8bc856b
This package contains C binding of %{name}.
Gris Ge 8bc856b
Gris Ge 8bc856b
%prep
a80772d
%autosetup -n %{name}-%{version_no_tilde} -p1 %{?rhel:-a1}
Gris Ge 8bc856b
1c9ef25
%if 0%{?rhel}
a80772d
%cargo_prep -v vendor
1c9ef25
%else
Gris Ge 8bc856b
%cargo_prep
1c9ef25
%endif
Gris Ge 8bc856b
Gris Ge 8bc856b
%build
03ac155
%cargo_build
a80772d
%cargo_license_summary
a80772d
%{cargo_license} > LICENSE.dependencies
a80772d
%if 0%{?rhel}
a80772d
%cargo_vendor_manifest
a80772d
%endif
Gris Ge 8bc856b
Gris Ge 8bc856b
pushd src/python
Gris Ge 8bc856b
%py3_build
Gris Ge 8bc856b
popd
Gris Ge 8bc856b
Gris Ge 8bc856b
%install
1c9ef25
%if ! 0%{?rhel}
8def2e1
# cargo_install has problem on detecting library when running in workspace
8def2e1
# due to bug https://pagure.io/fedora-rust/cargo2rpm/issue/5
8def2e1
# Removing the workspace Cargo.toml will workaround this problem.
8def2e1
rm Cargo.toml
Gris Ge 8bc856b
pushd src/lib
Gris Ge 8bc856b
%cargo_install
Gris Ge 8bc856b
popd
1c9ef25
%endif
Gris Ge 8bc856b
Gris Ge 8bc856b
env SKIP_PYTHON_INSTALL=1 PREFIX=%{_prefix} LIBDIR=%{_libdir} %make_install
Gris Ge 8bc856b
Gris Ge 8bc856b
pushd src/python
Gris Ge 8bc856b
%py3_install
Gris Ge 8bc856b
popd
Gris Ge 8bc856b
Gris Ge 8bc856b
%if %{with check}
Gris Ge 8bc856b
%check
Gris Ge 8bc856b
%cargo_test
Gris Ge 8bc856b
%endif
Gris Ge 8bc856b
Gris Ge 8bc856b
%files
Gris Ge 8bc856b
%doc AUTHORS CHANGELOG DEVEL.md README.md
Gris Ge 8bc856b
%license LICENSE
a80772d
%license LICENSE.dependencies
a80772d
%if 0%{?rhel}
a80772d
%license cargo-vendor.txt
a80772d
%endif
Gris Ge 8bc856b
%{_bindir}/npc
Gris Ge 8bc856b
%{_libdir}/libnispor.so.*
Gris Ge 8bc856b
Gris Ge 8bc856b
%files -n       python3-%{name}
Gris Ge 8bc856b
%license LICENSE
Gris Ge 8bc856b
%{python3_sitelib}/nispor*
Gris Ge 8bc856b
Gris Ge 8bc856b
%files devel
Gris Ge 8bc856b
%license LICENSE
Gris Ge 8bc856b
%{_libdir}/libnispor.so
Gris Ge 8bc856b
%{_includedir}/nispor.h
Gris Ge b0e7bf2
%{_libdir}/pkgconfig/nispor.pc
Gris Ge 8bc856b
1c9ef25
%if ! 0%{?rhel}
Gris Ge 8bc856b
%files -n       rust-%{name}-devel
Gris Ge 8bc856b
%license LICENSE
Gris Ge 8bc856b
%{cargo_registry}/%{name}-%{version_no_tilde}/
Gris Ge 8bc856b
Gris Ge 8bc856b
%files -n       rust-%{name}+default-devel
Gris Ge 8bc856b
%ghost %{cargo_registry}/%{name}-%{version_no_tilde}/Cargo.toml
1c9ef25
%endif
Gris Ge 8bc856b
Gris Ge 8bc856b
%changelog
03ac155
%autochangelog