From b0a637f2875c8f8378ddf654cac50a59f0c3946e Mon Sep 17 00:00:00 2001 From: Toshaan Bharvani Date: Wed, 7 Jun 2023 18:04:15 +0200 Subject: [PATCH] initial package creation Signed-off-by: Toshaan Bharvani --- SOURCES/.gitkeeper | 0 SOURCES/3df6ad1.patch | 33 ++++ SOURCES/8690145.patch | 34 ++++ SOURCES/b9d6410.patch | 26 +++ SPECS/rust-packaging.spec | 331 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 424 insertions(+) create mode 100644 SOURCES/.gitkeeper create mode 100644 SOURCES/3df6ad1.patch create mode 100644 SOURCES/8690145.patch create mode 100644 SOURCES/b9d6410.patch create mode 100644 SPECS/rust-packaging.spec diff --git a/SOURCES/.gitkeeper b/SOURCES/.gitkeeper new file mode 100644 index 0000000..e69de29 diff --git a/SOURCES/3df6ad1.patch b/SOURCES/3df6ad1.patch new file mode 100644 index 0000000..20bdca8 --- /dev/null +++ b/SOURCES/3df6ad1.patch @@ -0,0 +1,33 @@ +From 3df6ad1259c1741656affc26512f81631e9148f5 Mon Sep 17 00:00:00 2001 +From: Maxwell G +Date: Mar 09 2023 20:44:10 +0000 +Subject: Correct %__rustc and %__rustdoc paths and docs + + +%{_bindir} should not be used like this in specfiles or macros. It +breaks flatpak builds. + +Also, correct docstring copy-paste errors. + +Relates: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_file_and_directory_dependencies + +--- + +diff --git a/macros.d/macros.rust b/macros.d/macros.rust +index 1978f85..095cebc 100644 +--- a/macros.d/macros.rust ++++ b/macros.d/macros.rust +@@ -1,8 +1,8 @@ +-# __cargo_to_rpm: path to the default rustc executable +-%__rustc %{_bindir}/rustc ++# __rustc: path to the default rustc executable ++%__rustc /usr/bin/rustc + +-# __cargo_to_rpm: path to the default rustdoc executable +-%__rustdoc %{_bindir}/rustdoc ++# __rustdoc: path to the default rustdoc executable ++%__rustdoc /usr/bin/rustdoc + + # rustflags_opt_level: default optimization level + # + diff --git a/SOURCES/8690145.patch b/SOURCES/8690145.patch new file mode 100644 index 0000000..debcf7f --- /dev/null +++ b/SOURCES/8690145.patch @@ -0,0 +1,34 @@ +From 8690145a30cb049b0d2bcc9288b388cb9f8bbda7 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: May 19 2023 17:33:11 +0000 +Subject: cargo_license / cargo_license_summary: add "-Z avoid-dev-deps" arg + + +Without this flag, the "cargo tree" command attempts to resolve +dev-dependencies, even though the "no-dev" edge type is specified, +but dev-dependencies might not be present in the environment if the +package is being built with the check %bcond disabled. + +--- + +diff --git a/macros.d/macros.cargo b/macros.d/macros.cargo +index 3785ea0..672ae06 100644 +--- a/macros.d/macros.cargo ++++ b/macros.d/macros.cargo +@@ -183,6 +183,7 @@ fi \ + %cargo_license(naf:)\ + %{shrink:\ + %{__cargo} tree \ ++ -Z avoid-dev-deps \ + --workspace \ + --offline \ + --edges no-build,no-dev,no-proc-macro \ +@@ -204,6 +205,7 @@ fi \ + %cargo_license_summary(naf:)\ + %{shrink:\ + %{__cargo} tree \ ++ -Z avoid-dev-deps \ + --workspace \ + --offline \ + --edges no-build,no-dev,no-proc-macro \ + diff --git a/SOURCES/b9d6410.patch b/SOURCES/b9d6410.patch new file mode 100644 index 0000000..fe591f4 --- /dev/null +++ b/SOURCES/b9d6410.patch @@ -0,0 +1,26 @@ +From b9d6410bec50c3dfb9433fa5dc51efda1652299b Mon Sep 17 00:00:00 2001 +From: Maxwell G +Date: Mar 09 2023 21:02:01 +0000 +Subject: Correct macro docstring typos + + +--- + +diff --git a/macros.d/macros.rust b/macros.d/macros.rust +index 095cebc..9967804 100644 +--- a/macros.d/macros.rust ++++ b/macros.d/macros.rust +@@ -29,10 +29,10 @@ + # -Copt-level: set optimization level (default: highest optimization level) + # -Cdebuginfo: set debuginfo verbosity (default: full debug information) + # -Ccodegen-units: set number of parallel code generation units (default: 1) +-# Cforce-frame-pointers: force inclusion of frame pointers (default: enabled ++# -Cforce-frame-pointers: force inclusion of frame pointers (default: enabled + # on x86_64 and aarch64 on Fedora 37+) + # +-# Additionally, sime linker flags are set which correspond to the default ++# Additionally, some linker flags are set which correspond to the default + # Fedora compiler flags for hardening and for embedding package versions into + # compiled binaries. + # + diff --git a/SPECS/rust-packaging.spec b/SPECS/rust-packaging.spec new file mode 100644 index 0000000..6cde111 --- /dev/null +++ b/SPECS/rust-packaging.spec @@ -0,0 +1,331 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.3.5) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 4; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +Name: rust-packaging +Version: 24 +Release: %autorelease +Summary: RPM macros and generators for building Rust packages +License: MIT + +URL: https://pagure.io/fedora-rust/rust-packaging +Source: %{url}/archive/%{version}/rust-packaging-%{version}.tar.gz + +# backported upstream patches for minor fixes +Patch: https://pagure.io/fedora-rust/rust-packaging/c/3df6ad1.patch +Patch: https://pagure.io/fedora-rust/rust-packaging/c/b9d6410.patch +Patch: https://pagure.io/fedora-rust/rust-packaging/c/8690145.patch + +BuildArch: noarch + +%description +%{summary}. + +%package -n rust-srpm-macros-epel +Summary: RPM macros for building Rust projects +# Require rust-srpm-macros from RHEL +Requires: rust-srpm-macros + +%description -n rust-srpm-macros-epel +RPM macros for building source packages for Rust projects. + +%package -n cargo-rpm-macros +Summary: RPM macros for building projects with cargo + +# obsolete + provide rust-packaging (removed in Fedora 38) +Obsoletes: rust-packaging < 24 +Provides: rust-packaging = %{version}-%{release} + +Requires: cargo +Requires: cargo2rpm >= 0.1.0 +Requires: gawk + +Requires: rust-srpm-macros-epel = %{version}-%{release} + +%description -n cargo-rpm-macros +RPM macros for building projects with cargo. + +%prep +%autosetup -p1 + +%build +# nothing to do + +%install +install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.cargo +install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.rust + +# We don't install these on RHEL 9, as they conflict with the regular +# rust-srpm-macros. +# If we need to override these, they can be installed as +# macros.zzz-rust-srpm-epel. +%dnl install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.rust-srpm + +install -D -p -m 0644 -t %{buildroot}/%{_fileattrsdir} fileattrs/cargo.attr + +%files -n rust-srpm-macros-epel +%license LICENSE +%{_rpmmacrodir}/macros.rust +%dnl %{_rpmmacrodir}/macros.rust-srpm + +%files -n cargo-rpm-macros +%license LICENSE +%{_rpmmacrodir}/macros.cargo +%{_fileattrsdir}/cargo.attr + +%changelog +* Sun May 21 2023 Fabio Valentini - 24-4 +- Include upstream patches with minor bug fixes and improvements + +* Sun Feb 26 2023 Maxwell G - 24-3 +- Fix rust-srpm-macros-epel's Requires + +* Thu Feb 23 2023 Maxwell G - 24-2 +- rust-srpm-macros -> rust-srpm-macros-epel on epel9 + +* Wed Feb 22 2023 Fabio Valentini - 24-1 +- Update to version 24 + +* Sat Sep 10 2022 Fabio Valentini - 21-4 +- Adapt %%cargo_prep macro to fix builds with Rust 1.62+ + +* Sat Sep 10 2022 Zbigniew Jędrzejewski-Szmek - 21-3 +- Backport patch to fix rpmautospec detection + +* Sat Sep 10 2022 Zbigniew Jędrzejewski-Szmek - 21-2 +- Add patches to allow debuginfo level to be set easily again + +* Sat Sep 10 2022 Zbigniew Jędrzejewski-Szmek - 21-1 +- Version 21 + +* Sat Sep 10 2022 Zbigniew Jędrzejewski-Szmek - 20-2 +- Include linker flags for package note in %%build_rustflags + +* Sat Sep 10 2022 Zbigniew Jędrzejewski-Szmek - 20-1 +- Version 20 + +* Tue Dec 28 2021 Igor Raits - 19-4 +- Rebuild + +* Sat Nov 27 2021 Igor Raits - 19-3 +- EPEL9 hack: Allow older rust-srpm-macros + +* Mon Nov 22 2021 Zbigniew Jędrzejewski-Szmek - 19-2 +- Rebuild in a side tag + +* Mon Nov 22 2021 Zbigniew Jędrzejewski-Szmek - 19-1 +- Version 19 + +* Fri Jul 23 2021 Fedora Release Engineering - 18-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon Jul 12 2021 Fabio Valentini - 18-1 +- Update to version 18. + +* Wed Jun 02 2021 Python Maint - 17-4 +- Rebuilt for Python 3.10 + +* Wed Jan 27 2021 Fedora Release Engineering - 17-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Dec 28 2020 Igor Raits - 17-2 +- Band-aid clap pre-release version + +* Sat Dec 26 2020 Igor Raits - 17-1 +- Update to 17 + +* Wed Jul 29 2020 Fedora Release Engineering - 15-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 15-2 +- Rebuilt for Python 3.9 + +* Fri May 22 2020 Igor Raits - 15-1 +- Update to 15 + +* Sat May 02 2020 Igor Raits - 14-1 +- Update to 14 + +* Mon Feb 03 2020 Josh Stone - 13-3 +- Use 'cargo install --no-track' with cargo 1.41 + +* Thu Jan 30 2020 Fedora Release Engineering - 13-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Dec 20 2019 Igor Gnatenko - 13-1 +- Update to 13 + +* Fri Dec 13 2019 Igor Gnatenko - 12-2 +- Fixup generation of files with no-tilde + +* Fri Dec 13 2019 Igor Gnatenko - 12-1 +- Update to 12 + +* Wed Dec 04 2019 Igor Gnatenko - 11-1 +- Update to 11 + +* Sat Sep 07 2019 Igor Gnatenko - 10-6 +- Depend on setuptools in runtime + +* Mon Aug 19 2019 Miro Hrončok - 10-5 +- Rebuilt for Python 3.8 + +* Sun Aug 18 2019 Igor Gnatenko - 10-4 +- Ignore Cargo.lock + +* Fri Jul 26 2019 Fedora Release Engineering - 10-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Jun 24 2019 Igor Gnatenko - 10-2 +- Do not use awk's inplace feature + +* Sun Jun 16 2019 Igor Gnatenko - 10-1 +- Update to 10 + +* Sat Jun 08 2019 Igor Gnatenko - 9-3 +- Update patches + +* Sat Jun 08 2019 Igor Gnatenko - 9-2 +- Backport patches from upstream + +* Sun May 05 09:18:19 CEST 2019 Igor Gnatenko - 9-1 +- Update to 9 + +* Tue Apr 23 21:18:12 CEST 2019 Igor Gnatenko - 8-1 +- Update to 8 + +* Tue Apr 23 16:17:30 CEST 2019 Igor Gnatenko - 7-1 +- Update to 7 + +* Sun Mar 10 2019 Igor Gnatenko - 6-28 +- Install $PWD/Cargo.toml into $REG_DIR/Cargo.toml + +* Sun Mar 10 2019 Igor Gnatenko - 6-27 +- Restore Cargo.toml.deps into $PWD/Cargo.toml + +* Sun Mar 10 2019 Igor Gnatenko - 6-26 +- Strip out target dependencies too + +* Sun Mar 10 2019 Igor Gnatenko - 6-25 +- Do not error on removing files which do not exist + +* Sun Mar 10 2019 Igor Gnatenko - 6-24 +- Escape `\n` properly in macro file + +* Sun Mar 10 2019 Igor Gnatenko - 6-23 +- Do not pull optional deps into BRs and trivial fixes + +* Sat Feb 02 2019 Fedora Release Engineering - 6-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jan 26 2019 Igor Gnatenko - 6-21 +- Use %%version_no_tilde + +* Sat Jan 26 2019 Igor Gnatenko - 6-20 +- Trivial fixes for pre-release versions + +* Sat Jan 26 2019 Igor Gnatenko - 6-19 +- Add support for pre-release versions + +* Fri Dec 07 2018 Igor Gnatenko - 6-18 +- Set CARGO_HOME + +* Sat Nov 03 2018 Igor Gnatenko - 6-17 +- Update patchset + +* Sat Nov 03 2018 Igor Gnatenko - 6-16 +- Make package archful + +* Fri Nov 02 2018 Igor Gnatenko - 6-15 +- Support .rust2rpm.conf + +* Wed Oct 31 2018 Igor Gnatenko - 6-14 +- Fix syntax error + +* Tue Oct 30 2018 Igor Gnatenko - 6-13 +- Support multiple dependencies with same name + +* Sat Oct 27 2018 Igor Gnatenko - 6-12 +- Fix requirements with space + +* Fri Oct 26 2018 Igor Gnatenko - 6-11 +- Trivial fixes to last patchset + +* Fri Oct 26 2018 Igor Gnatenko - 6-10 +- Split features into subpackages + +* Sun Sep 02 2018 Igor Gnatenko - 6-1 +- Update to 6 + +* Sat Jul 14 2018 Fedora Release Engineering - 5-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jul 02 2018 Miro Hrončok - 5-10 +- Rebuilt for Python 3.7 + +* Mon Jul 02 2018 Igor Gnatenko - 5-9 +- Rebuilt for Python 3.7 + +* Fri Jun 22 2018 Igor Gnatenko - 5-8 +- Various improvements for %%cargo_* macros + +* Tue Jun 19 2018 Miro Hrončok - 5-7 +- Rebuilt for Python 3.7 + +* Wed Feb 21 2018 Igor Gnatenko - 5-6 +- Pass %%__cargo_common_opts to %%cargo_install + +* Tue Feb 20 2018 Igor Gnatenko - 5-5 +- Explicitly require rust/cargo + +* Fri Feb 09 2018 Fedora Release Engineering - 5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Jan 09 2018 Igor Gnatenko - 5-3 +- Fix syntax error + +* Tue Jan 09 2018 Igor Gnatenko - 5-2 +- Remove Cargo.lock + +* Mon Jan 08 2018 Igor Gnatenko - 5-1 +- Update to 5 + +* Sat Nov 04 2017 Igor Gnatenko - 4-7 +- Add Obsoletes for rust-rpm-macros + +* Sat Nov 04 2017 Igor Gnatenko - 4-6 +- Use cp instead of install + +* Sat Oct 21 2017 Igor Gnatenko - 4-5 +- Generate runtime dependencyon cargo for devel subpackages + +* Thu Jul 27 2017 Fedora Release Engineering - 4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Jul 08 2017 Igor Gnatenko - 4-2 +- Include license + +* Sat Jul 08 2017 Igor Gnatenko - 4-1 +- Update to 4 + +* Fri Jun 23 2017 Igor Gnatenko - 3-5 +- Explicitly set rustdoc path + +* Wed Jun 21 2017 Igor Gnatenko - 3-4 +- Mageia doesn't have C.UTF-8 lang + +* Wed Jun 21 2017 Igor Gnatenko - 3-3 +- Switch cargo_registry to /usr/share/cargo/registry + +* Wed Jun 14 2017 Igor Gnatenko - 3-2 +- Set C.UTF-8 for cargo inspector where python doesn't do locale coercing + +* Tue Jun 13 2017 Igor Gnatenko - 3-1 +- Initial package +