Package init
This commit is contained in:
parent
914c1299a0
commit
6a35ebdbf8
BIN
nispor-1.0.1.tar.gz
Normal file
BIN
nispor-1.0.1.tar.gz
Normal file
Binary file not shown.
103
nispor.spec
Normal file
103
nispor.spec
Normal file
@ -0,0 +1,103 @@
|
||||
%bcond_with check
|
||||
%global __cargo_skip_build 0
|
||||
Name: nispor
|
||||
Version: 1.0.1
|
||||
Release: 1
|
||||
Summary: Unified interface for Linux network state querying
|
||||
License: ASL 2.0
|
||||
URL: https://github.com/nispor/nispor
|
||||
Source: https://github.com/nispor/nispor/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
ExclusiveArch: aarch64 x86_64
|
||||
BuildRequires: make pkg-config python3-devel rust-packaging systemd-devel openEuler-rpm-config
|
||||
|
||||
%description
|
||||
Unified interface for Linux network state querying.
|
||||
|
||||
%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}.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
|
||||
%cargo_prep
|
||||
_FLAGS=`sed -ne 's/rustflags = "\(.\+\)"/\1/p' .cargo/config.toml`
|
||||
sed -i -e "s/rustflags = \[\(.\+\), \]$/rustflags = [\1, \"$_FLAGS\"]/" \
|
||||
.cargo/config
|
||||
|
||||
%build
|
||||
sed -i '/\[source.crates-io\]/{n;d}' ./.cargo/config
|
||||
sed -i '/\[source.local-registry\]/{n;d}' ./.cargo/config
|
||||
sed -i '/\[source.local-registry\]/a directory = "vendor"' ./.cargo/config
|
||||
%cargo_build
|
||||
pushd src/python
|
||||
%py3_build
|
||||
popd
|
||||
|
||||
%install
|
||||
pushd src/lib
|
||||
%__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x "$(printf 'lib\nrlib\nproc-macro')"
|
||||
CRATE_NAME=$(%__cargo_inspector --name Cargo.toml)
|
||||
CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml)
|
||||
REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION
|
||||
%{__mkdir} -p $REG_DIR
|
||||
mv Cargo.toml{,.deps}
|
||||
awk '/^\[((.+\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\[/{f=0}; !f' Cargo.toml.deps > Cargo.toml
|
||||
/usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 /usr/bin/cargo package -l | grep -w -E -v 'Cargo.(lock|toml.orig)'| xargs -d '\n' /usr/bin/cp --parents -a -t $REG_DIR
|
||||
/usr/bin/mv Cargo.toml{.deps,}
|
||||
/usr/bin/cp -a Cargo.toml $REG_DIR/Cargo.toml
|
||||
/usr/bin/rm -f $REG_DIR/Cargo.toml.deps
|
||||
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json
|
||||
popd
|
||||
env SKIP_PYTHON_INSTALL=1 PREFIX=%{_prefix} LIBDIR=%{_libdir} %make_install
|
||||
pushd src/python
|
||||
%py3_install
|
||||
popd
|
||||
rm -rf %{buildroot}%{cargo_registry}/%{name}-%{version}/
|
||||
|
||||
%post
|
||||
%systemd_post nispor.service
|
||||
|
||||
%preun
|
||||
%systemd_preun nispor.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart nispor.service
|
||||
|
||||
%if %{with check}
|
||||
|
||||
%check
|
||||
%cargo_test
|
||||
%endif
|
||||
|
||||
%files
|
||||
%doc AUTHORS CHANGELOG DEVEL.md README.md
|
||||
%license LICENSE
|
||||
%{_bindir}/npc
|
||||
%{_bindir}/npd
|
||||
%{_libdir}/libnispor.so.*
|
||||
%{_unitdir}/nispor.socket
|
||||
%{_unitdir}/nispor.service
|
||||
|
||||
%files -n python3-%{name}
|
||||
%license LICENSE
|
||||
%{python3_sitelib}/nispor*
|
||||
|
||||
%files devel
|
||||
%license LICENSE
|
||||
%{_libdir}/libnispor.so
|
||||
%{_includedir}/nispor.h
|
||||
%{_libdir}/pkgconfig/nispor.pc
|
||||
|
||||
%changelog
|
||||
* Mon Sep 13 2021 huanghaitao <huanghaitao8@huawei.com> - 1.0.1-1
|
||||
- package init
|
||||
4
nispor.yaml
Normal file
4
nispor.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
version_control: github
|
||||
src_repo: nispor/nispor
|
||||
tag_prefix: "v"
|
||||
separator: .
|
||||
Loading…
x
Reference in New Issue
Block a user