File rust-packaging.spec of Package rust-packaging
#
# spec file for package rust-packaging
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2017 Red Hat, Inc., Raleigh, North Carolina, United States of America.
# Copyright (c) 2017, 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org>.
# Copyright (c) 2020 Neal Gompa <ngompa13@gmail.com>.
#
# 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 https://bugs.opensuse.org/
#
%bcond_without check
Name: rust-packaging
Version: 15
Release: 0
Summary: RPM macros for building Rust packages on various architectures
License: MIT
Group: Development/Languages/Rust
URL: https://pagure.io/fedora-rust/rust2rpm
Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz
BuildArch: noarch
ExclusiveArch: %{rust_arches} noarch
# gawk is needed for stripping dev-deps in macro, 4.1.0 is needed for inplace feature
Requires: cargo >= 1.41
Requires: gawk >= 4.1.0
Requires: python3-rust2rpm = %{version}-%{release}
Requires: rust
Requires: rust-srpm-macros = %{version}
%description
The package provides macros for building projects in Rust
on various architectures.
%package -n python3-rust2rpm
Summary: Convert Rust packages to RPM
Group: Development/Languages/Rust
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if %{with check}
BuildRequires: cargo
BuildRequires: python3-pytest
%endif
Requires: cargo
Requires: python3-Jinja2
Requires: python3-requests
Requires: python3-setuptools
Requires: python3-tqdm
Provides: rust2rpm = %{version}-%{release}
%{?python_provide:%python_provide python3-rust2rpm}
%description -n python3-rust2rpm
This tool creates RPM spec files for Rust packages.
The packages can be downloaded from crates.io and this tool
creates packages that comply with the Fedora Packaging Guidelines,
Mageia packaging policy, and the openSUSE Packaging Guidelines.
%prep
%autosetup -n rust2rpm-%{version} -p1
sed -r -i -e "s|(%\{_bindir\}/cargo-inspector)|env LANG=C.UTF-8 \1|" data/cargo.attr data/macros.cargo
sed -i -e '/# Generated by/s/$/-%{version}-%{release}/' rust2rpm/templates/main.spec
%build
%py3_build
%install
%py3_install
install -D -p -m 0644 -t %{buildroot}%{_rpmconfigdir}/macros.d data/macros.rust data/macros.cargo
install -D -p -m 0644 -t %{buildroot}%{_rpmconfigdir}/fileattrs data/cargo.attr
%if %{with check}
%check
py.test-%{python3_version} -vv test.py
%endif
%files
%license LICENSE
%{_rpmconfigdir}/macros.d/macros.rust
%{_rpmconfigdir}/macros.d/macros.cargo
%{_rpmconfigdir}/fileattrs/cargo.attr
%files -n python3-rust2rpm
%license LICENSE
%{_bindir}/rust2rpm
%{_bindir}/cargo-inspector
%{python3_sitelib}/rust2rpm-*.egg-info/
%{python3_sitelib}/rust2rpm/
%changelog