#1 "Fold" rust-srpm-macros into rust-packaging
Closed 8 months ago by zbyszek. Opened 2 years ago by zbyszek.
rpms/ zbyszek/rust-packaging build-srpm-macros-too  into  rawhide

file modified
+24 -2
@@ -11,8 +11,6 @@ 

  URL:            https://pagure.io/fedora-rust/rust2rpm

  Source:         https://pagure.io/fedora-rust/rust2rpm/archive/v16/rust2rpm-v%{version}.tar.gz

                  

- ExclusiveArch:  %{rust_arches}

- 

  # gawk is needed for stripping dev-deps in macro

  Requires:       gawk

  Requires:       python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release}
@@ -20,10 +18,13 @@ 

  Requires:       rust

  Requires:       cargo >= 1.41

  

+ # Package is "archful" because it is only available on some architectures

+ 

  %description

  The package provides macros for building projects in Rust

  on various architectures.

  

+ %ifarch %{rust_arches}

  %package     -n python3-rust2rpm

  Summary:        Convert Rust packages to RPM

  BuildRequires:  python3-devel
@@ -38,14 +39,30 @@ 

  

  %description -n python3-rust2rpm

  %{summary}.

+ %endif

+ 

+ %package     -n rust-srpm-macros

+ Summary:        RPM macros for building Rust source packages

+ BuildArch:      noarch

+ 

+ %description -n rust-srpm-macros

+ %{summary}.

  

  %prep

  %autosetup -n rust2rpm-v%{version} -p1

  

+ # https://pagure.io/koji/issue/659

+ sed -i -e 's/i686/%%{ix86}/' data/macros.rust-srpm

+ 

  %build

+ %ifarch %{rust_arches}

  %py3_build

+ %endif

  

  %install

+ install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} data/macros.rust-srpm

+ 

+ %ifarch %{rust_arches}

  %py3_install

  install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} data/macros.rust data/macros.cargo

  install -D -p -m 0644 -t %{buildroot}%{_fileattrsdir} data/cargo.attr
@@ -67,6 +84,11 @@ 

  %{_bindir}/cargo-inspector

  %{python3_sitelib}/rust2rpm-*.egg-info/

  %{python3_sitelib}/rust2rpm/

+ %endif

+ 

+ %files -n rust-srpm-macros

+ %license LICENSE

+ %{_rpmmacrodir}/macros.rust-srpm

  

  %changelog

  * Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 15-3

It's quite annoying (and against the guidelines) to have to packages
built from the same source tarball. Let's simplify our life by
building rust-srpm-macros here too.

Currently %{rust_arches} includes all architectures supported in main
koji, so '%ifarch %{rust_arches}' is effectively a noop. But rust.spec
is conditionalized with ExclusiveArch:%{rust_arches}, so I kept this
conditionalization here too, and the python packages are still "archful".

For testing, I replaced '%ifarch %{rust_arches}' with '%ifarch x86_64
ppc64l' and did a scratch build in koji. As expected, rust-srpm-macros
is available everywhere, and the other packages only on the specified
architectures.

If this is merged, the separate rust-srpm-macros package should be
retired. Since an identically named rpm is provided, no action apart
from a rebuild is necessary.

This was done on purpose to deal with bootstrap problems. We originally did have it in one source package and split it out.

Pull-Request has been closed by zbyszek

8 months ago