From 1ed9028f9e505980b77b1c748ea11a910a09790d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 9 Jul 2017 01:04:35 +0000 Subject: [PATCH 01/96] Initial setup of the repo --- .gitignore | 0 sources | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 .gitignore create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/sources b/sources new file mode 100644 index 0000000..e69de29 From 4e5904b9ac6f208d08f51fd46059878856a03db4 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 9 Jul 2017 09:22:14 +0200 Subject: [PATCH 02/96] initial import Signed-off-by: Igor Gnatenko --- .gitignore | 1 + rust-packaging.spec | 105 ++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 107 insertions(+) create mode 100644 rust-packaging.spec diff --git a/.gitignore b/.gitignore index e69de29..aaa8cf4 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/rust2rpm-4.tar.xz diff --git a/rust-packaging.spec b/rust-packaging.spec new file mode 100644 index 0000000..91e4eb9 --- /dev/null +++ b/rust-packaging.spec @@ -0,0 +1,105 @@ +%bcond_without check + +Name: rust-packaging +Version: 4 +Release: 2%{?dist} +Summary: RPM macros for building Rust packages on various architectures + +License: MIT +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: gawk >= 4.1.0 +Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} +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 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%if %{with check} +BuildRequires: python3-pytest +BuildRequires: cargo +BuildRequires: python3-semantic_version +%endif +Requires: cargo +Requires: python3-semantic_version +Requires: python3-jinja2 +Requires: python3-requests +Requires: python3-tqdm +%if 0%{?mageia} +Requires: locales-en +%endif +Obsoletes: rust2rpm < 1-8 +Provides: rust2rpm = %{version}-%{release} +%{?python_provide:%python_provide python3-rust2rpm} + +%description -n python3-rust2rpm +%{summary}. + +%prep +%autosetup -n rust2rpm-%{version} -p1 +lang= +%if (0%{?fedora} && 0%{?fedora} <= 25) || (0%{?rhel} && 0%{?rhel} <= 7) +lang=C.UTF-8 +%else +%if 0%{?mageia} +lang=en_US.UTF-8 +%endif +%endif +[ -n "$lang" ] && sed -r -i -e "s|(%\{_bindir\}/cargo-inspector)|env LANG=$lang \1|" data/cargo.attr data/macros.cargo + +%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} -v test.py +%endif + +%files +%{_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 +* 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 diff --git a/sources b/sources index e69de29..a81110b 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (rust2rpm-4.tar.xz) = d8527c72f34b31086d3c6dbfae7fd25709525e5aa941d9de47efaefb07a04782d8f7c561b258145df1413fbfee5cd76e24d7d3787107aa36e2d9d1a1e6577637 From 85772b9e87a16911d2365af1dd20ce50100e2587 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 27 Jul 2017 18:01:59 +0000 Subject: [PATCH 03/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 91e4eb9..fe71057 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -83,6 +83,9 @@ py.test-%{python3_version} -v test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 46f705671d983393718d94f489070362fe07317a Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 21 Oct 2017 09:57:46 +0200 Subject: [PATCH 04/96] adopt to new RPM 4.14 behavior for returning proper exit status Since RPM 4.14, it started to return exit status of last executed statement which on rawhide returns false so right condition doesn't run. Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index fe71057..5de07c4 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -55,7 +55,7 @@ lang=C.UTF-8 lang=en_US.UTF-8 %endif %endif -[ -n "$lang" ] && sed -r -i -e "s|(%\{_bindir\}/cargo-inspector)|env LANG=$lang \1|" data/cargo.attr data/macros.cargo +[ -z "$lang" ] || sed -r -i -e "s|(%\{_bindir\}/cargo-inspector)|env LANG=$lang \1|" data/cargo.attr data/macros.cargo %build %py3_build From 6b81b17f09c4168a13a81f0c305ddd13117ef61d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 21 Oct 2017 09:58:43 +0200 Subject: [PATCH 05/96] Generate runtime dependencyon cargo for devel subpackages Signed-off-by: Igor Gnatenko --- ...r-inject-cargo-dependency-in-runtime.patch | 41 +++++++++++++++++++ ...-rust-packaging-dependency-in-buildt.patch | 28 +++++++++++++ rust-packaging.spec | 8 +++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 0001-inspector-inject-cargo-dependency-in-runtime.patch create mode 100644 0002-inspector-inject-rust-packaging-dependency-in-buildt.patch diff --git a/0001-inspector-inject-cargo-dependency-in-runtime.patch b/0001-inspector-inject-cargo-dependency-in-runtime.patch new file mode 100644 index 0000000..35e2831 --- /dev/null +++ b/0001-inspector-inject-cargo-dependency-in-runtime.patch @@ -0,0 +1,41 @@ +From 9e0a872ece6f5aedf76ffd67044f22c7d0cba8aa Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 20 Oct 2017 18:04:31 +0200 +Subject: [PATCH 1/2] inspector: inject cargo dependency in runtime + +Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/42 +Signed-off-by: Igor Gnatenko +--- + rust2rpm/__main__.py | 1 + + rust2rpm/inspector.py | 3 +++ + 2 files changed, 4 insertions(+) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index 0121a33..bb92fa3 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -91,6 +91,7 @@ Provides: {{ prv }} + {% endfor %} + {% endif %} + {% if include_requires %} ++Requires: cargo + {% if md.requires|length > 0 %} + # [dependencies] + {% for req in md.requires|sort(attribute="name") %} +diff --git a/rust2rpm/inspector.py b/rust2rpm/inspector.py +index d08f1aa..6ccdbc2 100644 +--- a/rust2rpm/inspector.py ++++ b/rust2rpm/inspector.py +@@ -38,6 +38,9 @@ def main(): + print_deps(list(itertools.chain(md.requires, md.build_requires))) + if args.test_requires: + print_deps(md.test_requires) ++ if args.requires: ++ # Someone should own /usr/share/cargo/registry ++ print("cargo") + + if __name__ == "__main__": + main() +-- +2.14.2 + diff --git a/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch b/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch new file mode 100644 index 0000000..44777cf --- /dev/null +++ b/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch @@ -0,0 +1,28 @@ +From 45a5caf30060c182fb0ae03a1a7e4e707599aaa3 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 21 Oct 2017 09:45:30 +0200 +Subject: [PATCH 2/2] inspector: inject rust-packaging dependency in buildtime + +For consistency with previous commit. + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/inspector.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/rust2rpm/inspector.py b/rust2rpm/inspector.py +index 6ccdbc2..2d488b2 100644 +--- a/rust2rpm/inspector.py ++++ b/rust2rpm/inspector.py +@@ -41,6 +41,8 @@ def main(): + if args.requires: + # Someone should own /usr/share/cargo/registry + print("cargo") ++ if args.build_requires: ++ print("rust-packaging") + + if __name__ == "__main__": + main() +-- +2.14.2 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 5de07c4..edae99b 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,12 +2,15 @@ Name: rust-packaging Version: 4 -Release: 3%{?dist} +Release: 5%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz +# https://pagure.io/fedora-rust/rust2rpm/pull-request/43 +Patch0001: 0001-inspector-inject-cargo-dependency-in-runtime.patch +Patch0002: 0002-inspector-inject-rust-packaging-dependency-in-buildt.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -83,6 +86,9 @@ py.test-%{python3_version} -v test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From d98b1ace2dd0352476b0409f833b6a1d5073c00f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 4 Nov 2017 15:35:35 +0100 Subject: [PATCH 06/96] Use cp instead of install Signed-off-by: Igor Gnatenko --- ...r-inject-cargo-dependency-in-runtime.patch | 4 +-- ...-rust-packaging-dependency-in-buildt.patch | 4 +-- 0003-use-cp-instead-of-install.patch | 31 +++++++++++++++++++ rust-packaging.spec | 8 +++-- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 0003-use-cp-instead-of-install.patch diff --git a/0001-inspector-inject-cargo-dependency-in-runtime.patch b/0001-inspector-inject-cargo-dependency-in-runtime.patch index 35e2831..675f2ca 100644 --- a/0001-inspector-inject-cargo-dependency-in-runtime.patch +++ b/0001-inspector-inject-cargo-dependency-in-runtime.patch @@ -1,7 +1,7 @@ From 9e0a872ece6f5aedf76ffd67044f22c7d0cba8aa Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 20 Oct 2017 18:04:31 +0200 -Subject: [PATCH 1/2] inspector: inject cargo dependency in runtime +Subject: [PATCH 1/3] inspector: inject cargo dependency in runtime Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/42 Signed-off-by: Igor Gnatenko @@ -37,5 +37,5 @@ index d08f1aa..6ccdbc2 100644 if __name__ == "__main__": main() -- -2.14.2 +2.15.0 diff --git a/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch b/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch index 44777cf..bfa9764 100644 --- a/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch +++ b/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch @@ -1,7 +1,7 @@ From 45a5caf30060c182fb0ae03a1a7e4e707599aaa3 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 21 Oct 2017 09:45:30 +0200 -Subject: [PATCH 2/2] inspector: inject rust-packaging dependency in buildtime +Subject: [PATCH 2/3] inspector: inject rust-packaging dependency in buildtime For consistency with previous commit. @@ -24,5 +24,5 @@ index 6ccdbc2..2d488b2 100644 if __name__ == "__main__": main() -- -2.14.2 +2.15.0 diff --git a/0003-use-cp-instead-of-install.patch b/0003-use-cp-instead-of-install.patch new file mode 100644 index 0000000..7c7b726 --- /dev/null +++ b/0003-use-cp-instead-of-install.patch @@ -0,0 +1,31 @@ +From 59809d4940822edaa361507ecea93b84e3c43ec0 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 4 Nov 2017 15:32:39 +0100 +Subject: [PATCH 3/3] use cp instead of install + +We want to preserve original modes and so on. + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 09bbcea..e52f87c 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -45,9 +45,9 @@ if %__cargo_is_lib; then \ + CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ + REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ + %{__mkdir} -p $REG_DIR \ +- %__cargo package -l | xargs cp --parents -p -t $REG_DIR \ ++ %__cargo package -l | xargs %{__cp} --parents -a -t $REG_DIR \ + %if ! %{with check} \ +- %{__install} -p Cargo.toml.orig $REG_DIR/Cargo.toml \ ++ %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ + %endif \ + echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ + fi \ +-- +2.15.0 + diff --git a/rust-packaging.spec b/rust-packaging.spec index edae99b..4ee9c1f 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,15 +2,16 @@ Name: rust-packaging Version: 4 -Release: 5%{?dist} +Release: 6%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -# https://pagure.io/fedora-rust/rust2rpm/pull-request/43 +# Commits since last release Patch0001: 0001-inspector-inject-cargo-dependency-in-runtime.patch Patch0002: 0002-inspector-inject-rust-packaging-dependency-in-buildt.patch +Patch0003: 0003-use-cp-instead-of-install.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -86,6 +87,9 @@ py.test-%{python3_version} -v test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 1b0abb676f4af171ba164700431e8362f45e5c69 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 4 Nov 2017 15:48:01 +0100 Subject: [PATCH 07/96] Add Obsoletes for rust-rpm-macros Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 4ee9c1f..bbc94f3 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 4 -Release: 6%{?dist} +Release: 7%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -20,6 +20,8 @@ ExclusiveArch: %{rust_arches} noarch Requires: gawk >= 4.1.0 Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} Requires: rust-srpm-macros = %{version} +# Remove in F29 +Obsoletes: rust-rpm-macros < 2-2 %description The package provides macros for building projects in Rust @@ -87,6 +89,9 @@ py.test-%{python3_version} -v test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From f0f5561dea6f3667228f30880e0622f418f2618b Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 8 Jan 2018 20:32:16 +0100 Subject: [PATCH 08/96] Update to 5 Signed-off-by: Igor Gnatenko --- ...r-inject-cargo-dependency-in-runtime.patch | 41 ------------------- ...-rust-packaging-dependency-in-buildt.patch | 28 ------------- 0003-use-cp-instead-of-install.patch | 31 -------------- rust-packaging.spec | 11 +++-- 4 files changed, 5 insertions(+), 106 deletions(-) delete mode 100644 0001-inspector-inject-cargo-dependency-in-runtime.patch delete mode 100644 0002-inspector-inject-rust-packaging-dependency-in-buildt.patch delete mode 100644 0003-use-cp-instead-of-install.patch diff --git a/0001-inspector-inject-cargo-dependency-in-runtime.patch b/0001-inspector-inject-cargo-dependency-in-runtime.patch deleted file mode 100644 index 675f2ca..0000000 --- a/0001-inspector-inject-cargo-dependency-in-runtime.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 9e0a872ece6f5aedf76ffd67044f22c7d0cba8aa Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Fri, 20 Oct 2017 18:04:31 +0200 -Subject: [PATCH 1/3] inspector: inject cargo dependency in runtime - -Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/42 -Signed-off-by: Igor Gnatenko ---- - rust2rpm/__main__.py | 1 + - rust2rpm/inspector.py | 3 +++ - 2 files changed, 4 insertions(+) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index 0121a33..bb92fa3 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -91,6 +91,7 @@ Provides: {{ prv }} - {% endfor %} - {% endif %} - {% if include_requires %} -+Requires: cargo - {% if md.requires|length > 0 %} - # [dependencies] - {% for req in md.requires|sort(attribute="name") %} -diff --git a/rust2rpm/inspector.py b/rust2rpm/inspector.py -index d08f1aa..6ccdbc2 100644 ---- a/rust2rpm/inspector.py -+++ b/rust2rpm/inspector.py -@@ -38,6 +38,9 @@ def main(): - print_deps(list(itertools.chain(md.requires, md.build_requires))) - if args.test_requires: - print_deps(md.test_requires) -+ if args.requires: -+ # Someone should own /usr/share/cargo/registry -+ print("cargo") - - if __name__ == "__main__": - main() --- -2.15.0 - diff --git a/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch b/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch deleted file mode 100644 index bfa9764..0000000 --- a/0002-inspector-inject-rust-packaging-dependency-in-buildt.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 45a5caf30060c182fb0ae03a1a7e4e707599aaa3 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sat, 21 Oct 2017 09:45:30 +0200 -Subject: [PATCH 2/3] inspector: inject rust-packaging dependency in buildtime - -For consistency with previous commit. - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/inspector.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/rust2rpm/inspector.py b/rust2rpm/inspector.py -index 6ccdbc2..2d488b2 100644 ---- a/rust2rpm/inspector.py -+++ b/rust2rpm/inspector.py -@@ -41,6 +41,8 @@ def main(): - if args.requires: - # Someone should own /usr/share/cargo/registry - print("cargo") -+ if args.build_requires: -+ print("rust-packaging") - - if __name__ == "__main__": - main() --- -2.15.0 - diff --git a/0003-use-cp-instead-of-install.patch b/0003-use-cp-instead-of-install.patch deleted file mode 100644 index 7c7b726..0000000 --- a/0003-use-cp-instead-of-install.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 59809d4940822edaa361507ecea93b84e3c43ec0 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sat, 4 Nov 2017 15:32:39 +0100 -Subject: [PATCH 3/3] use cp instead of install - -We want to preserve original modes and so on. - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 09bbcea..e52f87c 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -45,9 +45,9 @@ if %__cargo_is_lib; then \ - CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ - REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ - %{__mkdir} -p $REG_DIR \ -- %__cargo package -l | xargs cp --parents -p -t $REG_DIR \ -+ %__cargo package -l | xargs %{__cp} --parents -a -t $REG_DIR \ - %if ! %{with check} \ -- %{__install} -p Cargo.toml.orig $REG_DIR/Cargo.toml \ -+ %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ - %endif \ - echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ - fi \ --- -2.15.0 - diff --git a/rust-packaging.spec b/rust-packaging.spec index bbc94f3..651c352 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,17 +1,13 @@ %bcond_without check Name: rust-packaging -Version: 4 -Release: 7%{?dist} +Version: 5 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -# Commits since last release -Patch0001: 0001-inspector-inject-cargo-dependency-in-runtime.patch -Patch0002: 0002-inspector-inject-rust-packaging-dependency-in-buildt.patch -Patch0003: 0003-use-cp-instead-of-install.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -89,6 +85,9 @@ py.test-%{python3_version} -v test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 2ce47297c5751f725f2fc720355ef8025225d44b Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 8 Jan 2018 20:52:27 +0100 Subject: [PATCH 09/96] commit sources Signed-off-by: Igor Gnatenko --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index aaa8cf4..d47206f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /rust2rpm-4.tar.xz +/rust2rpm-5.tar.xz diff --git a/sources b/sources index a81110b..0745d57 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-4.tar.xz) = d8527c72f34b31086d3c6dbfae7fd25709525e5aa941d9de47efaefb07a04782d8f7c561b258145df1413fbfee5cd76e24d7d3787107aa36e2d9d1a1e6577637 +SHA512 (rust2rpm-5.tar.xz) = e61c0c9351b3bc76b576fc57950b96793f805109e56d1021da94e5dfceb9d299c868f980de298d6a7f85e1b3477f785df7b5615c702e6a0ac25070fbffc013f3 From b22849eefe9f75d9e5e5e364ab740c768324002e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 9 Jan 2018 00:02:01 +0100 Subject: [PATCH 10/96] Remove Cargo.lock Signed-off-by: Igor Gnatenko --- 0001-macros-remove-Cargo.lock.patch | 31 +++++++++++++++++++++++++++++ rust-packaging.spec | 6 +++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 0001-macros-remove-Cargo.lock.patch diff --git a/0001-macros-remove-Cargo.lock.patch b/0001-macros-remove-Cargo.lock.patch new file mode 100644 index 0000000..c86f872 --- /dev/null +++ b/0001-macros-remove-Cargo.lock.patch @@ -0,0 +1,31 @@ +From 5313b352712486b4001827b04d906bdb91be2314 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 8 Jan 2018 23:57:03 +0100 +Subject: [PATCH] macros: remove Cargo.lock + +cargo-package automatically strips it out, but we package also some +things directly from git. + +Acked-by: Josh Stone +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index ebf3edb..288554c 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -27,7 +27,8 @@ directory = "%{cargo_registry}"\ + [source.crates-io]\ + registry = "https://crates.io"\ + replace-with = "local-registry"\ +-EOF\ ++EOF \ ++%{__rm} -f Cargo.lock \ + %if ! %{with check} \ + # https://github.com/rust-lang/cargo/issues/3732 \ + %{__awk} -i inplace -v INPLACE_SUFFIX=.orig '/^\\\[dev-dependencies/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ +-- +2.15.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 651c352..af03432 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,12 +2,13 @@ Name: rust-packaging Version: 5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz +Patch0001: 0001-macros-remove-Cargo.lock.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -85,6 +86,9 @@ py.test-%{python3_version} -v test.py %{python3_sitelib}/rust2rpm/ %changelog +* Tue Jan 09 2018 Igor Gnatenko - 5-2 +- Remove Cargo.lock + * Mon Jan 08 2018 Igor Gnatenko - 5-1 - Update to 5 From f45176f7dee892d1048a4f71c762ec74900da55b Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 9 Jan 2018 06:54:39 +0100 Subject: [PATCH 11/96] Fix syntax error Signed-off-by: Igor Gnatenko --- 0001-macros-remove-Cargo.lock.patch | 2 +- 0002-macros-remove-spurious-whitespace.patch | 28 ++++++++++++++++++++ rust-packaging.spec | 6 ++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 0002-macros-remove-spurious-whitespace.patch diff --git a/0001-macros-remove-Cargo.lock.patch b/0001-macros-remove-Cargo.lock.patch index c86f872..435710c 100644 --- a/0001-macros-remove-Cargo.lock.patch +++ b/0001-macros-remove-Cargo.lock.patch @@ -1,7 +1,7 @@ From 5313b352712486b4001827b04d906bdb91be2314 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 8 Jan 2018 23:57:03 +0100 -Subject: [PATCH] macros: remove Cargo.lock +Subject: [PATCH 1/2] macros: remove Cargo.lock cargo-package automatically strips it out, but we package also some things directly from git. diff --git a/0002-macros-remove-spurious-whitespace.patch b/0002-macros-remove-spurious-whitespace.patch new file mode 100644 index 0000000..522e2b0 --- /dev/null +++ b/0002-macros-remove-spurious-whitespace.patch @@ -0,0 +1,28 @@ +From cd6329635329fc7742a18f7ed0933298a0c56cf7 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 9 Jan 2018 06:52:36 +0100 +Subject: [PATCH 2/2] macros: remove spurious whitespace + +Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/48 +Reported-by: Josh Stone +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 288554c..67b1950 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -27,7 +27,7 @@ directory = "%{cargo_registry}"\ + [source.crates-io]\ + registry = "https://crates.io"\ + replace-with = "local-registry"\ +-EOF \ ++EOF\ + %{__rm} -f Cargo.lock \ + %if ! %{with check} \ + # https://github.com/rust-lang/cargo/issues/3732 \ +-- +2.15.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index af03432..20d6cc3 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,13 +2,14 @@ Name: rust-packaging Version: 5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz Patch0001: 0001-macros-remove-Cargo.lock.patch +Patch0002: 0002-macros-remove-spurious-whitespace.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -86,6 +87,9 @@ py.test-%{python3_version} -v test.py %{python3_sitelib}/rust2rpm/ %changelog +* Tue Jan 09 2018 Igor Gnatenko - 5-3 +- Fix syntax error + * Tue Jan 09 2018 Igor Gnatenko - 5-2 - Remove Cargo.lock From 0e91fb3355fe994f41b16165a44b0e20ba16d8a3 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 14 Jan 2018 09:07:34 +0100 Subject: [PATCH 12/96] be super-verbose in tests Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 20d6cc3..a47ac1f 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -71,7 +71,7 @@ install -D -p -m 0644 -t %{buildroot}%{_rpmconfigdir}/fileattrs data/cargo.attr %if %{with check} %check -py.test-%{python3_version} -v test.py +py.test-%{python3_version} -vv test.py %endif %files From e99965a091ab45b9013cc9b8cfe68e1682d66682 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 14 Jan 2018 17:01:10 +0100 Subject: [PATCH 13/96] remove obsolete conditions Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index a47ac1f..9bef763 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -52,7 +52,7 @@ Provides: rust2rpm = %{version}-%{release} %prep %autosetup -n rust2rpm-%{version} -p1 lang= -%if (0%{?fedora} && 0%{?fedora} <= 25) || (0%{?rhel} && 0%{?rhel} <= 7) +%if 0%{?rhel} && 0%{?rhel} <= 7 lang=C.UTF-8 %else %if 0%{?mageia} From 1f1f7784f40645adf884f8c18f3c1f09920a5f9c Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 14 Jan 2018 17:01:28 +0100 Subject: [PATCH 14/96] use %_rpmmacrodir and %_fileattrsdir Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 9bef763..7b3ccea 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -66,8 +66,8 @@ lang=en_US.UTF-8 %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 +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 %if %{with check} %check @@ -75,9 +75,9 @@ py.test-%{python3_version} -vv test.py %endif %files -%{_rpmconfigdir}/macros.d/macros.rust -%{_rpmconfigdir}/macros.d/macros.cargo -%{_rpmconfigdir}/fileattrs/cargo.attr +%{_rpmmacrodir}/macros.rust +%{_rpmmacrodir}/macros.cargo +%{_fileattrsdir}/cargo.attr %files -n python3-rust2rpm %license LICENSE From 7edf0c5e79fa9747ef661cc8bd8f3b7ab6acbc81 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 9 Feb 2018 15:38:01 +0000 Subject: [PATCH 15/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 7b3ccea..eade1ea 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 3%{?dist} +Release: 4%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -87,6 +87,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 210d2aa95c2dbda70e4081d015e87a297a268ece Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 20 Feb 2018 14:21:10 +0100 Subject: [PATCH 16/96] Explicitly require rust/cargo Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index eade1ea..1d5bfbc 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 4%{?dist} +Release: 5%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -18,6 +18,8 @@ ExclusiveArch: %{rust_arches} noarch Requires: gawk >= 4.1.0 Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} Requires: rust-srpm-macros = %{version} +Requires: rust +Requires: cargo # Remove in F29 Obsoletes: rust-rpm-macros < 2-2 @@ -87,6 +89,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 6e2f4c83784eb959fcfafea022f6c78770dadf3d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 21 Feb 2018 08:15:29 +0100 Subject: [PATCH 17/96] Pass %__cargo_common_opts to %cargo_install Signed-off-by: Igor Gnatenko --- 0001-macros-remove-Cargo.lock.patch | 4 +- 0002-macros-remove-spurious-whitespace.patch | 4 +- ...__cargo_common_opts-to-cargo_install.patch | 50 +++++++++++++++++++ rust-packaging.spec | 18 ++----- 4 files changed, 59 insertions(+), 17 deletions(-) create mode 100644 0003-macros-pass-__cargo_common_opts-to-cargo_install.patch diff --git a/0001-macros-remove-Cargo.lock.patch b/0001-macros-remove-Cargo.lock.patch index 435710c..eac95b4 100644 --- a/0001-macros-remove-Cargo.lock.patch +++ b/0001-macros-remove-Cargo.lock.patch @@ -1,7 +1,7 @@ From 5313b352712486b4001827b04d906bdb91be2314 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 8 Jan 2018 23:57:03 +0100 -Subject: [PATCH 1/2] macros: remove Cargo.lock +Subject: [PATCH 1/3] macros: remove Cargo.lock cargo-package automatically strips it out, but we package also some things directly from git. @@ -27,5 +27,5 @@ index ebf3edb..288554c 100644 # https://github.com/rust-lang/cargo/issues/3732 \ %{__awk} -i inplace -v INPLACE_SUFFIX=.orig '/^\\\[dev-dependencies/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ -- -2.15.1 +2.16.2 diff --git a/0002-macros-remove-spurious-whitespace.patch b/0002-macros-remove-spurious-whitespace.patch index 522e2b0..2033124 100644 --- a/0002-macros-remove-spurious-whitespace.patch +++ b/0002-macros-remove-spurious-whitespace.patch @@ -1,7 +1,7 @@ From cd6329635329fc7742a18f7ed0933298a0c56cf7 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 9 Jan 2018 06:52:36 +0100 -Subject: [PATCH 2/2] macros: remove spurious whitespace +Subject: [PATCH 2/3] macros: remove spurious whitespace Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/48 Reported-by: Josh Stone @@ -24,5 +24,5 @@ index 288554c..67b1950 100644 %if ! %{with check} \ # https://github.com/rust-lang/cargo/issues/3732 \ -- -2.15.1 +2.16.2 diff --git a/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch b/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch new file mode 100644 index 0000000..f719a78 --- /dev/null +++ b/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch @@ -0,0 +1,50 @@ +From c5bab762f56bf07cd0f4a2e2d58b7c295cddedd8 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 20 Feb 2018 22:04:35 +0100 +Subject: [PATCH 3/3] macros: pass %__cargo_common_opts to %cargo_install + +Reason this has not been done before is that cargo-install doesn't +understand --release. Let's just add it to other commands and be done +with it. + +Reported-by: Josh Stone +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 67b1950..22721e9 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -1,5 +1,5 @@ + %__cargo %{_bindir}/cargo +-%__cargo_common_opts --release %{?_smp_mflags} ++%__cargo_common_opts %{?_smp_mflags} + %__cargo_inspector %{_bindir}/cargo-inspector + + %cargo_registry %{_datadir}/cargo/registry +@@ -35,9 +35,9 @@ EOF\ + %endif \ + ) + +-%cargo_build %__cargo build %{__cargo_common_opts} ++%cargo_build %__cargo build --release %{__cargo_common_opts} + +-%cargo_test %__cargo test %{__cargo_common_opts} --no-fail-fast ++%cargo_test %__cargo test --release %{__cargo_common_opts} --no-fail-fast + + %cargo_install (\ + set -eu \ +@@ -53,7 +53,7 @@ if %__cargo_is_lib; then \ + echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ + fi \ + if %__cargo_is_bin; then \ +- %__cargo install %{?_smp_mflags} --path . --root %{buildroot}%{_prefix} \ ++ %__cargo install %{__cargo_common_opts} --path . --root %{buildroot}%{_prefix} \ + %{__rm} %{buildroot}%{_prefix}/.crates.toml \ + fi \ + ) +-- +2.16.2 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 1d5bfbc..f6ce2e1 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 5%{?dist} +Release: 6%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -10,6 +10,7 @@ URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz Patch0001: 0001-macros-remove-Cargo.lock.patch Patch0002: 0002-macros-remove-spurious-whitespace.patch +Patch0003: 0003-macros-pass-__cargo_common_opts-to-cargo_install.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -41,9 +42,6 @@ Requires: python3-semantic_version Requires: python3-jinja2 Requires: python3-requests Requires: python3-tqdm -%if 0%{?mageia} -Requires: locales-en -%endif Obsoletes: rust2rpm < 1-8 Provides: rust2rpm = %{version}-%{release} %{?python_provide:%python_provide python3-rust2rpm} @@ -53,15 +51,6 @@ Provides: rust2rpm = %{version}-%{release} %prep %autosetup -n rust2rpm-%{version} -p1 -lang= -%if 0%{?rhel} && 0%{?rhel} <= 7 -lang=C.UTF-8 -%else -%if 0%{?mageia} -lang=en_US.UTF-8 -%endif -%endif -[ -z "$lang" ] || sed -r -i -e "s|(%\{_bindir\}/cargo-inspector)|env LANG=$lang \1|" data/cargo.attr data/macros.cargo %build %py3_build @@ -89,6 +78,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From fe7dc1b94a637386dbda072d8f7ceede532637c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 19 Jun 2018 11:27:00 +0200 Subject: [PATCH 18/96] Rebuilt for Python 3.7 --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index f6ce2e1..9f6162f 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 6%{?dist} +Release: 7%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -78,6 +78,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From fb6d2b02177659c987b42014f5d457cdc76221ed Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 22 Jun 2018 21:57:54 +0200 Subject: [PATCH 19/96] Various improvements for %%cargo_* macros Signed-off-by: Igor Gnatenko --- 0001-macros-remove-Cargo.lock.patch | 4 +- 0002-macros-remove-spurious-whitespace.patch | 4 +- ...__cargo_common_opts-to-cargo_install.patch | 4 +- ...macros-make-cargo_-macros-parametric.patch | 96 +++++++++++++++++++ ...macros-remove-support-for-target-dir.patch | 71 ++++++++++++++ rust-packaging.spec | 7 +- 6 files changed, 179 insertions(+), 7 deletions(-) create mode 100644 0004-macros-make-cargo_-macros-parametric.patch create mode 100644 0005-macros-remove-support-for-target-dir.patch diff --git a/0001-macros-remove-Cargo.lock.patch b/0001-macros-remove-Cargo.lock.patch index eac95b4..57069a3 100644 --- a/0001-macros-remove-Cargo.lock.patch +++ b/0001-macros-remove-Cargo.lock.patch @@ -1,7 +1,7 @@ From 5313b352712486b4001827b04d906bdb91be2314 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 8 Jan 2018 23:57:03 +0100 -Subject: [PATCH 1/3] macros: remove Cargo.lock +Subject: [PATCH 1/5] macros: remove Cargo.lock cargo-package automatically strips it out, but we package also some things directly from git. @@ -27,5 +27,5 @@ index ebf3edb..288554c 100644 # https://github.com/rust-lang/cargo/issues/3732 \ %{__awk} -i inplace -v INPLACE_SUFFIX=.orig '/^\\\[dev-dependencies/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ -- -2.16.2 +2.18.0.rc2 diff --git a/0002-macros-remove-spurious-whitespace.patch b/0002-macros-remove-spurious-whitespace.patch index 2033124..9e11804 100644 --- a/0002-macros-remove-spurious-whitespace.patch +++ b/0002-macros-remove-spurious-whitespace.patch @@ -1,7 +1,7 @@ From cd6329635329fc7742a18f7ed0933298a0c56cf7 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 9 Jan 2018 06:52:36 +0100 -Subject: [PATCH 2/3] macros: remove spurious whitespace +Subject: [PATCH 2/5] macros: remove spurious whitespace Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/48 Reported-by: Josh Stone @@ -24,5 +24,5 @@ index 288554c..67b1950 100644 %if ! %{with check} \ # https://github.com/rust-lang/cargo/issues/3732 \ -- -2.16.2 +2.18.0.rc2 diff --git a/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch b/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch index f719a78..c5ff4b6 100644 --- a/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch +++ b/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch @@ -1,7 +1,7 @@ From c5bab762f56bf07cd0f4a2e2d58b7c295cddedd8 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 20 Feb 2018 22:04:35 +0100 -Subject: [PATCH 3/3] macros: pass %__cargo_common_opts to %cargo_install +Subject: [PATCH 3/5] macros: pass %__cargo_common_opts to %cargo_install Reason this has not been done before is that cargo-install doesn't understand --release. Let's just add it to other commands and be done @@ -46,5 +46,5 @@ index 67b1950..22721e9 100644 fi \ ) -- -2.16.2 +2.18.0.rc2 diff --git a/0004-macros-make-cargo_-macros-parametric.patch b/0004-macros-make-cargo_-macros-parametric.patch new file mode 100644 index 0000000..8d8028a --- /dev/null +++ b/0004-macros-make-cargo_-macros-parametric.patch @@ -0,0 +1,96 @@ +From c9ce952e260ec0adb166bd6e1de652a0277d2437 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 22 Jun 2018 21:04:59 +0200 +Subject: [PATCH 4/5] macros: make %cargo_* macros parametric +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Unfortunately cargo-install doesn't accept --target-dir, so have to pass +setting through envvar. + +Also %{shrink:…} them so it looks nicer in build log. + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 62 ++++++++++++++++++++++++++++++++++------------- + 1 file changed, 45 insertions(+), 17 deletions(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 22721e9..96a2931 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -35,25 +35,53 @@ EOF\ + %endif \ + ) + +-%cargo_build %__cargo build --release %{__cargo_common_opts} ++%__cargo_parse_opts(t:naf:) %{shrink:\ ++%{-f:%{-a:%{error:Can't specify both -f(%{-f*}) and -a}}} \ ++ %{-t:--target-dir %{-t*}} \ ++ %{-n:--no-default-features} \ ++ %{-a:--all-features} \ ++ %{-f:--features %{-f*}} \ ++ %{nil} ++} + +-%cargo_test %__cargo test --release %{__cargo_common_opts} --no-fail-fast ++%cargo_build(t:naf:) %{shrink:\ ++%{__cargo} build \ ++ %{__cargo_common_opts} \ ++ --release \ ++ %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ ++} + +-%cargo_install (\ +-set -eu \ +-if %__cargo_is_lib; then \ +- 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 \ +- %__cargo package -l | xargs %{__cp} --parents -a -t $REG_DIR \ +-%if ! %{with check} \ +- %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ +-%endif \ +- echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ ++%cargo_test(t:naf:) %{shrink:\ ++%{__cargo} test \ ++ %{__cargo_common_opts} \ ++ --release \ ++ --no-fail-fast \ ++ %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ ++} ++ ++%cargo_install(t:naf:) (\ ++set -eu \ ++if %__cargo_is_lib; then \ ++ 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 \ ++ %{__cargo} package -l | xargs %{__cp} --parents -a -t $REG_DIR \ ++%if ! %{with check} \ ++ %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ ++%endif \ ++ echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ + fi \ +-if %__cargo_is_bin; then \ +- %__cargo install %{__cargo_common_opts} --path . --root %{buildroot}%{_prefix} \ +- %{__rm} %{buildroot}%{_prefix}/.crates.toml \ ++if %__cargo_is_bin; then \ ++ %{shrink:%{-t:CARGO_TARGET_DIR=%{-t*}} %{__cargo} install \ ++ %{__cargo_common_opts} \ ++ --path . \ ++ --root %{buildroot}%{_prefix} \ ++ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ ++ }\ ++ %{__rm} %{buildroot}%{_prefix}/.crates.toml \ + fi \ + ) +-- +2.18.0.rc2 + diff --git a/0005-macros-remove-support-for-target-dir.patch b/0005-macros-remove-support-for-target-dir.patch new file mode 100644 index 0000000..e8fbfcc --- /dev/null +++ b/0005-macros-remove-support-for-target-dir.patch @@ -0,0 +1,71 @@ +From 80237720ae3397fc66d8f06e13f868c4bd2723c1 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 22 Jun 2018 21:53:09 +0200 +Subject: [PATCH 5/5] macros: remove support for target-dir + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 31 +++++++++++++++---------------- + 1 file changed, 15 insertions(+), 16 deletions(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 96a2931..a0c456a 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -35,30 +35,29 @@ EOF\ + %endif \ + ) + +-%__cargo_parse_opts(t:naf:) %{shrink:\ ++%__cargo_parse_opts(naf:) %{shrink:\ + %{-f:%{-a:%{error:Can't specify both -f(%{-f*}) and -a}}} \ +- %{-t:--target-dir %{-t*}} \ + %{-n:--no-default-features} \ + %{-a:--all-features} \ + %{-f:--features %{-f*}} \ + %{nil} + } + +-%cargo_build(t:naf:) %{shrink:\ +-%{__cargo} build \ +- %{__cargo_common_opts} \ +- --release \ +- %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ +- %* \ ++%cargo_build(naf:) %{shrink:\ ++%{__cargo} build \ ++ %{__cargo_common_opts} \ ++ --release \ ++ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ + } + +-%cargo_test(t:naf:) %{shrink:\ +-%{__cargo} test \ +- %{__cargo_common_opts} \ +- --release \ +- --no-fail-fast \ +- %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ +- %* \ ++%cargo_test(naf:) %{shrink:\ ++%{__cargo} test \ ++ %{__cargo_common_opts} \ ++ --release \ ++ --no-fail-fast \ ++ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ + } + + %cargo_install(t:naf:) (\ +@@ -75,7 +74,7 @@ if %__cargo_is_lib; then \ + echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ + fi \ + if %__cargo_is_bin; then \ +- %{shrink:%{-t:CARGO_TARGET_DIR=%{-t*}} %{__cargo} install \ ++ %{shrink:%{__cargo} install \ + %{__cargo_common_opts} \ + --path . \ + --root %{buildroot}%{_prefix} \ +-- +2.18.0.rc2 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 9f6162f..dabffa1 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 7%{?dist} +Release: 8%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -11,6 +11,8 @@ Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{vers Patch0001: 0001-macros-remove-Cargo.lock.patch Patch0002: 0002-macros-remove-spurious-whitespace.patch Patch0003: 0003-macros-pass-__cargo_common_opts-to-cargo_install.patch +Patch0004: 0004-macros-make-cargo_-macros-parametric.patch +Patch0005: 0005-macros-remove-support-for-target-dir.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -78,6 +80,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 104d9fcc10c4002f0e0f3f39e93c8e9737f08487 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 2 Jul 2018 17:19:07 +0100 Subject: [PATCH 20/96] Rebuilt for Python 3.7 Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index dabffa1..1b4c7c2 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 8%{?dist} +Release: 9%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -80,6 +80,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From b5750174ce98b9754d480856c3662e6a910bef83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 2 Jul 2018 18:24:06 +0200 Subject: [PATCH 21/96] Rebuilt for Python 3.7 --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 1b4c7c2..73d8668 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 9%{?dist} +Release: 10%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -80,6 +80,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 84bf5595e3951aa209c83c79c4564d69cf8d32bd Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 14 Jul 2018 05:20:48 +0000 Subject: [PATCH 22/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 73d8668..016f782 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -2,7 +2,7 @@ Name: rust-packaging Version: 5 -Release: 10%{?dist} +Release: 11%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -80,6 +80,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From a85e0d862fa1796d526f242b974c9e5e67fe9567 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 2 Sep 2018 18:29:13 +0200 Subject: [PATCH 23/96] Update to 6 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + 0001-macros-remove-Cargo.lock.patch | 31 ------ 0002-macros-remove-spurious-whitespace.patch | 28 ------ ...__cargo_common_opts-to-cargo_install.patch | 50 ---------- ...macros-make-cargo_-macros-parametric.patch | 96 ------------------- ...macros-remove-support-for-target-dir.patch | 71 -------------- rust-packaging.spec | 22 ++--- sources | 2 +- 8 files changed, 9 insertions(+), 292 deletions(-) delete mode 100644 0001-macros-remove-Cargo.lock.patch delete mode 100644 0002-macros-remove-spurious-whitespace.patch delete mode 100644 0003-macros-pass-__cargo_common_opts-to-cargo_install.patch delete mode 100644 0004-macros-make-cargo_-macros-parametric.patch delete mode 100644 0005-macros-remove-support-for-target-dir.patch diff --git a/.gitignore b/.gitignore index d47206f..388ca95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /rust2rpm-4.tar.xz /rust2rpm-5.tar.xz +/rust2rpm-6.tar.xz diff --git a/0001-macros-remove-Cargo.lock.patch b/0001-macros-remove-Cargo.lock.patch deleted file mode 100644 index 57069a3..0000000 --- a/0001-macros-remove-Cargo.lock.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5313b352712486b4001827b04d906bdb91be2314 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Mon, 8 Jan 2018 23:57:03 +0100 -Subject: [PATCH 1/5] macros: remove Cargo.lock - -cargo-package automatically strips it out, but we package also some -things directly from git. - -Acked-by: Josh Stone -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index ebf3edb..288554c 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -27,7 +27,8 @@ directory = "%{cargo_registry}"\ - [source.crates-io]\ - registry = "https://crates.io"\ - replace-with = "local-registry"\ --EOF\ -+EOF \ -+%{__rm} -f Cargo.lock \ - %if ! %{with check} \ - # https://github.com/rust-lang/cargo/issues/3732 \ - %{__awk} -i inplace -v INPLACE_SUFFIX=.orig '/^\\\[dev-dependencies/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ --- -2.18.0.rc2 - diff --git a/0002-macros-remove-spurious-whitespace.patch b/0002-macros-remove-spurious-whitespace.patch deleted file mode 100644 index 9e11804..0000000 --- a/0002-macros-remove-spurious-whitespace.patch +++ /dev/null @@ -1,28 +0,0 @@ -From cd6329635329fc7742a18f7ed0933298a0c56cf7 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Tue, 9 Jan 2018 06:52:36 +0100 -Subject: [PATCH 2/5] macros: remove spurious whitespace - -Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/48 -Reported-by: Josh Stone -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 288554c..67b1950 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -27,7 +27,7 @@ directory = "%{cargo_registry}"\ - [source.crates-io]\ - registry = "https://crates.io"\ - replace-with = "local-registry"\ --EOF \ -+EOF\ - %{__rm} -f Cargo.lock \ - %if ! %{with check} \ - # https://github.com/rust-lang/cargo/issues/3732 \ --- -2.18.0.rc2 - diff --git a/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch b/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch deleted file mode 100644 index c5ff4b6..0000000 --- a/0003-macros-pass-__cargo_common_opts-to-cargo_install.patch +++ /dev/null @@ -1,50 +0,0 @@ -From c5bab762f56bf07cd0f4a2e2d58b7c295cddedd8 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Tue, 20 Feb 2018 22:04:35 +0100 -Subject: [PATCH 3/5] macros: pass %__cargo_common_opts to %cargo_install - -Reason this has not been done before is that cargo-install doesn't -understand --release. Let's just add it to other commands and be done -with it. - -Reported-by: Josh Stone -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 67b1950..22721e9 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -1,5 +1,5 @@ - %__cargo %{_bindir}/cargo --%__cargo_common_opts --release %{?_smp_mflags} -+%__cargo_common_opts %{?_smp_mflags} - %__cargo_inspector %{_bindir}/cargo-inspector - - %cargo_registry %{_datadir}/cargo/registry -@@ -35,9 +35,9 @@ EOF\ - %endif \ - ) - --%cargo_build %__cargo build %{__cargo_common_opts} -+%cargo_build %__cargo build --release %{__cargo_common_opts} - --%cargo_test %__cargo test %{__cargo_common_opts} --no-fail-fast -+%cargo_test %__cargo test --release %{__cargo_common_opts} --no-fail-fast - - %cargo_install (\ - set -eu \ -@@ -53,7 +53,7 @@ if %__cargo_is_lib; then \ - echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ - fi \ - if %__cargo_is_bin; then \ -- %__cargo install %{?_smp_mflags} --path . --root %{buildroot}%{_prefix} \ -+ %__cargo install %{__cargo_common_opts} --path . --root %{buildroot}%{_prefix} \ - %{__rm} %{buildroot}%{_prefix}/.crates.toml \ - fi \ - ) --- -2.18.0.rc2 - diff --git a/0004-macros-make-cargo_-macros-parametric.patch b/0004-macros-make-cargo_-macros-parametric.patch deleted file mode 100644 index 8d8028a..0000000 --- a/0004-macros-make-cargo_-macros-parametric.patch +++ /dev/null @@ -1,96 +0,0 @@ -From c9ce952e260ec0adb166bd6e1de652a0277d2437 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Fri, 22 Jun 2018 21:04:59 +0200 -Subject: [PATCH 4/5] macros: make %cargo_* macros parametric -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Unfortunately cargo-install doesn't accept --target-dir, so have to pass -setting through envvar. - -Also %{shrink:…} them so it looks nicer in build log. - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 62 ++++++++++++++++++++++++++++++++++------------- - 1 file changed, 45 insertions(+), 17 deletions(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 22721e9..96a2931 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -35,25 +35,53 @@ EOF\ - %endif \ - ) - --%cargo_build %__cargo build --release %{__cargo_common_opts} -+%__cargo_parse_opts(t:naf:) %{shrink:\ -+%{-f:%{-a:%{error:Can't specify both -f(%{-f*}) and -a}}} \ -+ %{-t:--target-dir %{-t*}} \ -+ %{-n:--no-default-features} \ -+ %{-a:--all-features} \ -+ %{-f:--features %{-f*}} \ -+ %{nil} -+} - --%cargo_test %__cargo test --release %{__cargo_common_opts} --no-fail-fast -+%cargo_build(t:naf:) %{shrink:\ -+%{__cargo} build \ -+ %{__cargo_common_opts} \ -+ --release \ -+ %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ -+} - --%cargo_install (\ --set -eu \ --if %__cargo_is_lib; then \ -- 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 \ -- %__cargo package -l | xargs %{__cp} --parents -a -t $REG_DIR \ --%if ! %{with check} \ -- %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ --%endif \ -- echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ -+%cargo_test(t:naf:) %{shrink:\ -+%{__cargo} test \ -+ %{__cargo_common_opts} \ -+ --release \ -+ --no-fail-fast \ -+ %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ -+} -+ -+%cargo_install(t:naf:) (\ -+set -eu \ -+if %__cargo_is_lib; then \ -+ 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 \ -+ %{__cargo} package -l | xargs %{__cp} --parents -a -t $REG_DIR \ -+%if ! %{with check} \ -+ %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ -+%endif \ -+ echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ - fi \ --if %__cargo_is_bin; then \ -- %__cargo install %{__cargo_common_opts} --path . --root %{buildroot}%{_prefix} \ -- %{__rm} %{buildroot}%{_prefix}/.crates.toml \ -+if %__cargo_is_bin; then \ -+ %{shrink:%{-t:CARGO_TARGET_DIR=%{-t*}} %{__cargo} install \ -+ %{__cargo_common_opts} \ -+ --path . \ -+ --root %{buildroot}%{_prefix} \ -+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ -+ }\ -+ %{__rm} %{buildroot}%{_prefix}/.crates.toml \ - fi \ - ) --- -2.18.0.rc2 - diff --git a/0005-macros-remove-support-for-target-dir.patch b/0005-macros-remove-support-for-target-dir.patch deleted file mode 100644 index e8fbfcc..0000000 --- a/0005-macros-remove-support-for-target-dir.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 80237720ae3397fc66d8f06e13f868c4bd2723c1 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Fri, 22 Jun 2018 21:53:09 +0200 -Subject: [PATCH 5/5] macros: remove support for target-dir - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 31 +++++++++++++++---------------- - 1 file changed, 15 insertions(+), 16 deletions(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 96a2931..a0c456a 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -35,30 +35,29 @@ EOF\ - %endif \ - ) - --%__cargo_parse_opts(t:naf:) %{shrink:\ -+%__cargo_parse_opts(naf:) %{shrink:\ - %{-f:%{-a:%{error:Can't specify both -f(%{-f*}) and -a}}} \ -- %{-t:--target-dir %{-t*}} \ - %{-n:--no-default-features} \ - %{-a:--all-features} \ - %{-f:--features %{-f*}} \ - %{nil} - } - --%cargo_build(t:naf:) %{shrink:\ --%{__cargo} build \ -- %{__cargo_common_opts} \ -- --release \ -- %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ -- %* \ -+%cargo_build(naf:) %{shrink:\ -+%{__cargo} build \ -+ %{__cargo_common_opts} \ -+ --release \ -+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ - } - --%cargo_test(t:naf:) %{shrink:\ --%{__cargo} test \ -- %{__cargo_common_opts} \ -- --release \ -- --no-fail-fast \ -- %{__cargo_parse_opts %{-t:-t%{-t*}} %{-n} %{-a} %{-f:-f%{-f*}}} \ -- %* \ -+%cargo_test(naf:) %{shrink:\ -+%{__cargo} test \ -+ %{__cargo_common_opts} \ -+ --release \ -+ --no-fail-fast \ -+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ - } - - %cargo_install(t:naf:) (\ -@@ -75,7 +74,7 @@ if %__cargo_is_lib; then \ - echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ - fi \ - if %__cargo_is_bin; then \ -- %{shrink:%{-t:CARGO_TARGET_DIR=%{-t*}} %{__cargo} install \ -+ %{shrink:%{__cargo} install \ - %{__cargo_common_opts} \ - --path . \ - --root %{buildroot}%{_prefix} \ --- -2.18.0.rc2 - diff --git a/rust-packaging.spec b/rust-packaging.spec index 016f782..495e71d 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,18 +1,14 @@ %bcond_without check +%{?python_enable_dependency_generator} Name: rust-packaging -Version: 5 -Release: 11%{?dist} +Version: 6 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -Patch0001: 0001-macros-remove-Cargo.lock.patch -Patch0002: 0002-macros-remove-spurious-whitespace.patch -Patch0003: 0003-macros-pass-__cargo_common_opts-to-cargo_install.patch -Patch0004: 0004-macros-make-cargo_-macros-parametric.patch -Patch0005: 0005-macros-remove-support-for-target-dir.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -23,8 +19,6 @@ Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} Requires: rust-srpm-macros = %{version} Requires: rust Requires: cargo -# Remove in F29 -Obsoletes: rust-rpm-macros < 2-2 %description The package provides macros for building projects in Rust @@ -37,14 +31,9 @@ BuildRequires: python3-setuptools %if %{with check} BuildRequires: python3-pytest BuildRequires: cargo -BuildRequires: python3-semantic_version +BuildRequires: python3dist(rustcfg) %endif Requires: cargo -Requires: python3-semantic_version -Requires: python3-jinja2 -Requires: python3-requests -Requires: python3-tqdm -Obsoletes: rust2rpm < 1-8 Provides: rust2rpm = %{version}-%{release} %{?python_provide:%python_provide python3-rust2rpm} @@ -80,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index 0745d57..9f6fa6f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-5.tar.xz) = e61c0c9351b3bc76b576fc57950b96793f805109e56d1021da94e5dfceb9d299c868f980de298d6a7f85e1b3477f785df7b5615c702e6a0ac25070fbffc013f3 +SHA512 (rust2rpm-6.tar.xz) = 408988351156d858f7429d990d7330f216b54add671c6e90e54917e717ad6f2b3b99e414289c252e6a2b5dfad73ce430ac73f03265f6e174ef53edcee34d0fe2 From faa0f2d171638d6bf82d36c487101cf54abd384c Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 2 Sep 2018 18:43:27 +0200 Subject: [PATCH 24/96] add missing BR back Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-packaging.spec b/rust-packaging.spec index 495e71d..98159e2 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -31,6 +31,7 @@ BuildRequires: python3-setuptools %if %{with check} BuildRequires: python3-pytest BuildRequires: cargo +BuildRequires: python3dist(semantic-version) BuildRequires: python3dist(rustcfg) %endif Requires: cargo From 0cf7c3e18ab067d1fc0a7d37e901914c64b48d1e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 15:59:03 +0200 Subject: [PATCH 25/96] split features into subpackages Signed-off-by: Igor Gnatenko --- ...e-spec-patch_file-by-real-crate-name.patch | 37 + 0002-generate-doc-statements.patch | 58 ++ 0003-do-better-for-renamed-crates.patch | 90 +++ 0004-remove-pre-3.6-leftovers.patch | 27 + 0005-Remove-half-downloaded-crate-on-C.patch | 44 ++ ...n-error-if-s-is-used-without-a-crate.patch | 28 + 0007-split-features-into-subpackages.patch | 701 ++++++++++++++++++ rust-packaging.spec | 16 +- 8 files changed, 999 insertions(+), 2 deletions(-) create mode 100644 0001-name-spec-patch_file-by-real-crate-name.patch create mode 100644 0002-generate-doc-statements.patch create mode 100644 0003-do-better-for-renamed-crates.patch create mode 100644 0004-remove-pre-3.6-leftovers.patch create mode 100644 0005-Remove-half-downloaded-crate-on-C.patch create mode 100644 0006-Throw-an-error-if-s-is-used-without-a-crate.patch create mode 100644 0007-split-features-into-subpackages.patch diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch new file mode 100644 index 0000000..7a14de3 --- /dev/null +++ b/0001-name-spec-patch_file-by-real-crate-name.patch @@ -0,0 +1,37 @@ +From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 10 Sep 2018 23:37:40 +0200 +Subject: [PATCH 1/7] name spec/patch_file by real crate name + +When renaming using patch file, we really want to change file names too. + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/__main__.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index dc78828..1575ce6 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -218,7 +218,7 @@ def main(): + template = JINJA_ENV.get_template("main.spec") + + if args.patch and len(diff) > 0: +- patch_file = "{}-fix-metadata.diff".format(crate) ++ patch_file = "{}-fix-metadata.diff".format(metadata.name) + else: + patch_file = None + +@@ -269,7 +269,7 @@ def main(): + kwargs["license"] = license + kwargs["license_comments"] = comments + +- spec_file = "rust-{}.spec".format(crate) ++ spec_file = "rust-{}.spec".format(metadata.name) + spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) + if args.stdout: + print("# {}".format(spec_file)) +-- +2.19.1 + diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch new file mode 100644 index 0000000..3bb4409 --- /dev/null +++ b/0002-generate-doc-statements.patch @@ -0,0 +1,58 @@ +From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 10 Sep 2018 23:40:18 +0200 +Subject: [PATCH 2/7] generate %doc statements + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/metadata.py | 2 ++ + rust2rpm/templates/main.spec | 6 ++++++ + 2 files changed, 8 insertions(+) + +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index 5dae1d3..f52d968 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -140,6 +140,7 @@ class Metadata(object): + self.name = None + self.license = None + self.license_file = None ++ self.readme = None + self.description = None + self.version = None + self._targets = [] +@@ -156,6 +157,7 @@ class Metadata(object): + self.name = md["name"] + self.license = md["license"] + self.license_file = md["license_file"] ++ self.readme = md["readme"] + self.description = md.get("description") + self.version = md["version"] + version = "={}".format(self.version) +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 1aeb969..2e9f841 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -137,6 +137,9 @@ which use %{crate} from crates.io. + {% if md.license_file is not none %} + %license {{ md.license_file }} + {% endif %} ++{% if md.readme is not none %} ++%doc {{ md.readme }} ++{% endif %} + {% for bin in bins %} + %{_bindir}/{{ bin.name }} + {% endfor %} +@@ -147,6 +150,9 @@ which use %{crate} from crates.io. + {% if md.license_file is not none %} + %license {{ md.license_file }} + {% endif %} ++{% if md.readme is not none %} ++%doc {{ md.readme }} ++{% endif %} + %{cargo_registry}/%{crate}-%{version}/ + + {% endif %} +-- +2.19.1 + diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch new file mode 100644 index 0000000..a501e87 --- /dev/null +++ b/0003-do-better-for-renamed-crates.patch @@ -0,0 +1,90 @@ +From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 11 Sep 2018 00:06:50 +0200 +Subject: [PATCH 3/7] do better for renamed crates + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/__main__.py | 7 ++++--- + rust2rpm/templates/main.spec | 13 ++++++++++++- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index 1575ce6..e993e7b 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -180,7 +180,7 @@ def make_diff_metadata(crate, version, patch=False, store=False): + diff = make_patch(toml, enabled=patch) + metadata = Metadata.from_file(toml) + if store: +- shutil.copy2(cratef, os.path.join(os.getcwd(), f"{crate}-{version}.crate")) ++ shutil.copy2(cratef, os.path.join(os.getcwd(), f"{metadata.name}-{version}.crate")) + return crate, diff, metadata + + def main(): +@@ -218,11 +218,12 @@ def main(): + template = JINJA_ENV.get_template("main.spec") + + if args.patch and len(diff) > 0: +- patch_file = "{}-fix-metadata.diff".format(metadata.name) ++ patch_file = f"{metadata.name}-fix-metadata.diff" + else: + patch_file = None + + kwargs = {} ++ kwargs["crate"] = crate + kwargs["target"] = args.target + bins = [tgt for tgt in metadata.targets if tgt.kind == "bin"] + libs = [tgt for tgt in metadata.targets if tgt.kind in ("lib", "rlib", "proc-macro")] +@@ -269,7 +270,7 @@ def main(): + kwargs["license"] = license + kwargs["license_comments"] = comments + +- spec_file = "rust-{}.spec".format(metadata.name) ++ spec_file = f"rust-{metadata.name}.spec" + spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) + if args.stdout: + print("# {}".format(spec_file)) +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 2e9f841..7dbcc3f 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -6,6 +6,9 @@ + {% endif %} + + %global crate {{ md.name }} ++{% if md.name != crate %} ++%global real_crate {{ crate }} ++{% endif %} + + Name: rust-%{crate} + Version: {{ md.version }} +@@ -27,8 +30,12 @@ License: {{ license|default("# FIXME") }} + {% if license_comments is not none %} + {{ license_comments }} + {% endif %} +-URL: https://crates.io/crates/{{ md.name }} ++URL: https://crates.io/crates/{{ crate }} ++{% if md.name != crate %} ++Source0: https://crates.io/api/v1/crates/%{real_crate}/%{version}/download#/%{crate}-%{version}.crate ++{% else %} + Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate ++{% endif %} + {% if patch_file is not none %} + {% if target == "opensuse" %} + # PATCH-FIX-OPENSUSE {{ patch_file }} -- Initial patched metadata +@@ -118,7 +125,11 @@ which use %{crate} from crates.io. + + {% endif %} + %prep ++{% if md.name != crate %} ++%autosetup -n %{real_crate}-%{version} -p1 ++{% else %} + %autosetup -n %{crate}-%{version} -p1 ++{% endif %} + %cargo_prep + + %build +-- +2.19.1 + diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch new file mode 100644 index 0000000..5e7848c --- /dev/null +++ b/0004-remove-pre-3.6-leftovers.patch @@ -0,0 +1,27 @@ +From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 11 Sep 2018 10:43:53 +0200 +Subject: [PATCH 4/7] remove pre-3.6 leftovers + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/metadata.py | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index f52d968..5adeb65 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -203,8 +203,6 @@ class Metadata(object): + + @classmethod + def from_file(cls, path): +- do_decode = sys.version_info < (3, 6) + metadata = subprocess.check_output(["cargo", "read-manifest", +- "--manifest-path={}".format(path)], +- universal_newlines=do_decode) ++ "--manifest-path={}".format(path)]) + return cls.from_json(json.loads(metadata)) +-- +2.19.1 + diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch new file mode 100644 index 0000000..d822219 --- /dev/null +++ b/0005-Remove-half-downloaded-crate-on-C.patch @@ -0,0 +1,44 @@ +From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 17 Aug 2018 10:03:48 +0200 +Subject: [PATCH 5/7] Remove half-downloaded crate on ^C + +Subsequent invocations would fail with an error about a corrupted file. +We don't have support for resuming a failed download, so let's remove the +partial download results. +--- + rust2rpm/__main__.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index e993e7b..8e6f6eb 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -83,6 +83,14 @@ def file_mtime(path): + t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) + return t.astimezone().isoformat() + ++@contextlib.contextmanager ++def remove_on_error(path): ++ try: ++ yield ++ except: # this is supposed to include ^C ++ os.unlink(path) ++ raise ++ + def local_toml(toml, version): + if os.path.isdir(toml): + toml = os.path.join(toml, "Cargo.toml") +@@ -110,7 +118,8 @@ def download(crate, version): + req = requests.get(url, stream=True) + req.raise_for_status() + total = int(req.headers["Content-Length"]) +- with open(cratef, "wb") as f: ++ with remove_on_error(cratef), \ ++ open(cratef, "wb") as f: + for chunk in tqdm.tqdm(req.iter_content(), "Downloading {}".format(cratef_base), + total=total, unit="B", unit_scale=True): + f.write(chunk) +-- +2.19.1 + diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch new file mode 100644 index 0000000..44219dd --- /dev/null +++ b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch @@ -0,0 +1,28 @@ +From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 17 Aug 2018 10:18:59 +0200 +Subject: [PATCH 6/7] Throw an error if -s is used without a crate + +In the future we might want to be smarter and find the crate, but let's at least +not ignore the option completely. +--- + rust2rpm/__main__.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index 8e6f6eb..f23ebbc 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -178,6 +178,9 @@ def make_diff_metadata(crate, version, patch=False, store=False): + if crate.endswith(".crate"): + cratef, crate, version = local_crate(crate, version) + else: ++ if store: ++ raise ValueError('--store-crate can only be used for a crate') ++ + toml, crate, version = local_toml(crate, version) + diff = make_patch(toml, enabled=patch, tmpfile=True) + metadata = Metadata.from_file(toml) +-- +2.19.1 + diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch new file mode 100644 index 0000000..58e5e8d --- /dev/null +++ b/0007-split-features-into-subpackages.patch @@ -0,0 +1,701 @@ +From 83a9b92d68e8c5d6f2ab75b287be7ea69275fb90 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 26 Oct 2018 11:20:13 +0200 +Subject: [PATCH 7/7] split features into subpackages + +References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain +Signed-off-by: Igor Gnatenko +--- + data/cargo.attr | 4 +- + data/macros.cargo | 10 ++ + rust2rpm/__main__.py | 11 +- + rust2rpm/inspector.py | 22 ++- + rust2rpm/metadata.py | 315 +++++++++++++++++------------------ + rust2rpm/templates/main.spec | 141 ++++++++-------- + 6 files changed, 259 insertions(+), 244 deletions(-) + +diff --git a/data/cargo.attr b/data/cargo.attr +index 392a72b..4910b5c 100644 +--- a/data/cargo.attr ++++ b/data/cargo.attr +@@ -1,3 +1,3 @@ +-%__cargo_provides %{_bindir}/cargo-inspector --provides +-%__cargo_requires %{_bindir}/cargo-inspector --requires ++%__cargo_provides %{_bindir}/cargo-inspector --provides --feature=%{__cargo_feature_from_name -n %{name}} ++%__cargo_requires %{_bindir}/cargo-inspector --requires --feature=%{__cargo_feature_from_name -n %{name}} + %__cargo_path ^%{cargo_registry}/[^/]+/Cargo\\.toml$ +diff --git a/data/macros.cargo b/data/macros.cargo +index a0c456a..7fb025b 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -84,3 +84,13 @@ if %__cargo_is_bin; then \ + %{__rm} %{buildroot}%{_prefix}/.crates.toml \ + fi \ + ) ++ ++%__cargo_feature_from_name(n:) %{lua: ++local name = rpm.expand("%{-n*}") ++local feature = string.match(name, "^.+%+(.+)-devel$") ++if feature == nil then ++ print() ++else ++ print(feature) ++end ++} +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index f23ebbc..d19cb47 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -18,15 +18,19 @@ import requests + import tqdm + + from . import Metadata, licensing ++from .metadata import normalize_deps + + DEFAULT_EDITOR = "vi" + XDG_CACHE_HOME = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache")) + CACHEDIR = os.path.join(XDG_CACHE_HOME, "rust2rpm") + API_URL = "https://crates.io/api/v1/" + JINJA_ENV = jinja2.Environment(loader=jinja2.ChoiceLoader([ +- jinja2.FileSystemLoader(["/"]), +- jinja2.PackageLoader("rust2rpm", "templates"), ]), +- trim_blocks=True, lstrip_blocks=True) ++ jinja2.FileSystemLoader(["/"]), ++ jinja2.PackageLoader("rust2rpm", "templates"), ++ ]), ++ extensions=["jinja2.ext.do"], ++ trim_blocks=True, ++ lstrip_blocks=True) + + def get_default_target(): + # TODO: add fallback for /usr/lib/os-release +@@ -227,6 +231,7 @@ def main(): + patch=args.patch, + store=args.store_crate) + ++ JINJA_ENV.globals["normalize_deps"] = normalize_deps + template = JINJA_ENV.get_template("main.spec") + + if args.patch and len(diff) > 0: +diff --git a/rust2rpm/inspector.py b/rust2rpm/inspector.py +index 2d488b2..9e79e88 100644 +--- a/rust2rpm/inspector.py ++++ b/rust2rpm/inspector.py +@@ -1,8 +1,8 @@ + import argparse +-import itertools + import sys + + from . import Metadata ++from .metadata import normalize_deps + + def main(): + parser = argparse.ArgumentParser() +@@ -10,18 +10,23 @@ def main(): + group.add_argument("-n", "--name", action="store_true", help="Print name") + group.add_argument("-v", "--version", action="store_true", help="Print version") + group.add_argument("-t", "--target-kinds", action="store_true", help="Print target kinds") ++ group.add_argument("-l", "--list-features", action="store_true", help="Print features") + group.add_argument("-P", "--provides", action="store_true", help="Print Provides") + group.add_argument("-R", "--requires", action="store_true", help="Print Requires") + group.add_argument("-BR", "--build-requires", action="store_true", help="Print BuildRequires") + group.add_argument("-TR", "--test-requires", action="store_true", help="Print TestRequires") ++ parser.add_argument("-f", "--feature", help="Feature to work on") + parser.add_argument("file", nargs="*", help="Path(s) to Cargo.toml") + args = parser.parse_args() + + files = args.file or sys.stdin.readlines() + ++ if not args.feature: ++ args.feature = None ++ + def print_deps(deps): + if len(deps) > 0: +- print("\n".join(str(dep) for dep in deps)) ++ print("\n".join(sorted(normalize_deps(deps)))) + + for f in files: + f = f.rstrip() +@@ -32,17 +37,20 @@ def main(): + print(md.version) + if args.target_kinds: + print("\n".join(set(tgt.kind for tgt in md.targets))) ++ if args.list_features: ++ for f in sorted(f for f in md.dependencies if f is not None): ++ print(f) + if args.provides: +- print_deps(md.provides) +- if args.requires or args.build_requires: +- print_deps(list(itertools.chain(md.requires, md.build_requires))) +- if args.test_requires: +- print_deps(md.test_requires) ++ print(md.provides(args.feature)) + if args.requires: + # Someone should own /usr/share/cargo/registry + print("cargo") ++ print_deps(md.requires(args.feature)) + if args.build_requires: + print("rust-packaging") ++ print_deps(md.requires(args.feature or "default", resolve=True)) ++ if args.test_requires: ++ print_deps(md.dev_dependencies) + + if __name__ == "__main__": + main() +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index 5adeb65..95aa142 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -1,208 +1,205 @@ + __all__ = ["Dependency", "Metadata"] + +-import itertools ++import copy + import json + import subprocess +-import sys + + import semantic_version as semver + import rustcfg + +-class Target(object): +- def __init__(self, kind, name): +- self.kind = kind ++class Target: ++ def __init__(self, name, kind): + self.name = name ++ self.kind = kind + + def __repr__(self): +- return "".format(self=self) +- +- +-def _req_to_str(name, spec=None, feature=None): +- f_part = "/{}".format(feature) if feature is not None else "" +- basestr = "crate({}{})".format(name, f_part) +- if spec is None: +- return basestr +- if spec.kind == spec.KIND_EQUAL: +- spec.kind = spec.KIND_SHORTEQ +- if spec.kind == spec.KIND_ANY: +- if spec.spec == "": +- # Just wildcard +- return basestr +- else: +- # Wildcard in string +- assert False, spec.spec +- version = str(spec.spec).replace("-", "~") +- return "{} {} {}".format(basestr, spec.kind, version) ++ return f"" + +-class Dependency(object): +- def __init__(self, name, req, features=(), provides=False): ++class Dependency: ++ def __init__(self, name, req=None, features=(), optional=False): + self.name = name +- self.spec = self._parse_req(req) ++ self.req = req + self.features = features +- self.provides = provides +- if self.provides: +- if len(self.spec.specs) > 1 or \ +- (len(self.spec.specs) == 1 and self.spec.specs[0].kind != self.spec.specs[0].KIND_EQUAL): +- raise Exception("Provides can't be applied to ranged version, {!r}".format(self.spec)) +- +- def __repr__(self): +- if self.provides: +- spec = self.spec.specs[0] +- provs = [_req_to_str(self.name, spec)] +- for feature in self.features: +- provs.append(_req_to_str(self.name, spec, feature)) +- return " and ".join(provs) +- +- reqs = [_req_to_str(self.name, spec=req) for req in self.spec.specs] +- features = [_req_to_str(self.name, feature=feature) for feature in self.features] ++ self.optional = optional + +- use_rich = False +- if len(reqs) > 1: +- reqstr = "({})".format(" with ".join(reqs)) +- use_rich = True +- elif len(reqs) == 1: +- reqstr = reqs[0] +- else: +- reqstr = "" +- if len(features) > 0: +- featurestr = " with ".join(features) +- use_rich = True +- else: +- featurestr = "" +- +- if use_rich: +- if reqstr and featurestr: +- return "({} with {})".format(reqstr, featurestr) +- elif reqstr and not featurestr: +- return reqstr +- elif not reqstr and featurestr: +- return "({})".format(featurestr) +- else: +- assert False +- else: +- return reqstr ++ @classmethod ++ def from_json(cls, metadata): ++ features = set(metadata['features']) ++ if metadata['uses_default_features']: ++ features.add('default') ++ kwargs = {'name': metadata['name'], ++ 'req': metadata['req'], ++ 'optional': metadata['optional'], ++ 'features': features} ++ return cls(**kwargs) + + @staticmethod +- def _parse_req(s): +- if "*" in s and s != "*": +- # XXX: https://github.com/rbarrois/python-semanticversion/issues/51 +- s = "~{}".format(s.replace(".*", "", 1)) +- if ".*" in s: +- s = s.replace(".*", "") +- spec = semver.Spec(s.replace(" ", "")) +- parsed = [] ++ def _normalize_req(req): ++ if "*" in req: ++ return NotImplemented ++ spec = semver.Spec(req) ++ reqs = [] + for req in spec.specs: +- ver = req.spec + if req.kind == req.KIND_ANY: +- parsed.append("*") ++ # Any means any + continue ++ ver = req.spec ++ if ver.prerelease or req.kind in (req.KIND_NEQ, req.KIND_EMPTY): ++ return NotImplemented + coerced = semver.Version.coerce(str(ver)) +- if req.kind in (req.KIND_CARET, req.KIND_TILDE): +- if ver.prerelease: +- # pre-release versions only match the same x.y.z +- if ver.patch is not None: +- upper = ver.next_patch() +- elif ver.minor is not None: +- upper = ver.next_minor() +- else: +- upper = ver.next_major() +- elif req.kind == req.KIND_CARET: +- if ver.major == 0: +- if ver.minor is not None: +- if ver.patch is None or ver.minor != 0: +- upper = ver.next_minor() +- else: +- upper = ver.next_patch() ++ if req.kind == req.KIND_EQUAL: ++ req.kind = req.KIND_SHORTEQ ++ if req.kind in (req.KIND_CARET, req.KIND_COMPATIBLE): ++ if ver.major == 0: ++ if ver.minor is not None: ++ if ver.minor != 0 or ver.patch is None: ++ upper = ver.next_minor() + else: +- upper = ver.next_major() ++ upper = ver.next_patch() + else: + upper = ver.next_major() +- elif req.kind == req.KIND_TILDE: +- if ver.minor is None: +- upper = ver.next_major() +- else: +- upper = ver.next_minor() + else: +- assert False +- parsed.append(">={}".format(coerced)) +- parsed.append("<{}".format(upper)) +- elif req.kind == req.KIND_NEQ: +- parsed.append(">{}".format(coerced)) +- parsed.append("<{}".format(coerced)) +- elif req.kind in (req.KIND_EQUAL, req.KIND_GT, req.KIND_GTE, req.KIND_LT, req.KIND_LTE): +- parsed.append("{}{}".format(req.kind, coerced)) ++ upper = ver.next_major() ++ reqs.append((">=", coerced)) ++ reqs.append(("<", upper)) ++ elif req.kind == req.KIND_TILDE: ++ if ver.minor is None: ++ upper = ver.next_major() ++ else: ++ upper = ver.next_minor() ++ reqs.append((">=", coerced)) ++ reqs.append(("<", upper)) ++ elif req.kind in (req.KIND_SHORTEQ, ++ req.KIND_GT, ++ req.KIND_GTE, ++ req.KIND_LT, ++ req.KIND_LTE): ++ reqs.append((str(req.kind), coerced)) + else: +- assert False, req.kind +- return semver.Spec(",".join(parsed)) ++ raise AssertionError(f"Found unhandled kind: {req.kind}") ++ return reqs + +-class Metadata(object): +- def __init__(self): +- self.name = None ++ @staticmethod ++ def _apply_reqs(name, reqs, feature=None): ++ fstr = f"/{feature}" if feature is not None else "" ++ cap = f"crate({name}{fstr})" ++ if not reqs: ++ return cap ++ deps = " with ".join(f"{cap} {op} {version}" for op, version in reqs) ++ if len(reqs) > 1: ++ return f"({deps})" ++ else: ++ return deps ++ ++ def normalize(self): ++ return [self._apply_reqs(self.name, self._normalize_req(self.req), feature) ++ for feature in self.features or (None,)] ++ ++ def __repr__(self): ++ return f"" ++ ++ def __str__(self): ++ return "\n".join(self.normalize()) ++ ++class Metadata: ++ def __init__(self, name, version): ++ self.name = name ++ self.version = version + self.license = None + self.license_file = None + self.readme = None + self.description = None +- self.version = None +- self._targets = [] +- self.provides = [] +- self.requires = [] +- self.build_requires = [] +- self.test_requires = [] ++ self.targets = set() ++ self.dependencies = {} ++ self.dev_dependencies = set() + + @classmethod + def from_json(cls, metadata): +- self = cls() +- + md = metadata +- self.name = md["name"] ++ self = cls(md["name"], md["version"]) ++ + self.license = md["license"] + self.license_file = md["license_file"] + self.readme = md["readme"] + self.description = md.get("description") +- self.version = md["version"] +- version = "={}".format(self.version) +- +- # Targets +- self.targets = [Target(tgt["kind"][0], tgt["name"]) for tgt in md["targets"]] +- +- # Provides +- # All optional dependencies are also features +- # https://github.com/rust-lang/cargo/issues/4911 +- features = itertools.chain((x["name"] for x in md["dependencies"] if x["optional"]), +- md["features"]) +- provides = Dependency(self.name, version, features=features, provides=True) +- self.provides = str(provides).split(" and ") +- +- ev = rustcfg.Evaluator.platform() +- +- # Dependencies +- for dep in md["dependencies"]: +- kind = dep["kind"] +- if kind is None: +- requires = self.requires +- elif kind == "build": +- requires = self.build_requires +- elif kind == "dev": +- requires = self.test_requires +- else: +- raise ValueError("Unknown kind: {!r}, please report bug.".format(kind)) + +- target = dep["target"] +- if target is None: +- pass ++ # dependencies + build-dependencies → runtime ++ deps_by_name = {dep["name"]: Dependency.from_json(dep) ++ for dep in md["dependencies"] ++ if dep["kind"] != "dev"} ++ ++ deps_by_feature = {} ++ for feature, f_deps in md["features"].items(): ++ features = {None} ++ deps = set() ++ for dep in f_deps: ++ if dep in md["features"]: ++ features.add(dep) ++ else: ++ pkg, _, f = dep.partition("/") ++ dep = copy.deepcopy(deps_by_name[pkg]) ++ if f: ++ dep.features = {f} ++ deps.add(dep) ++ deps_by_feature[feature] = (features, deps) ++ ++ mandatory_deps = set() ++ for dep in deps_by_name.values(): ++ if dep.optional: ++ deps_by_feature[dep.name] = ({None}, {copy.deepcopy(dep)}) + else: +- cond = ev.parse_and_eval(target) +- if not cond: +- print(f'Dependency {dep["name"]} for target {target!r} is not needed, ignoring.', +- file=sys.stderr) +- continue ++ mandatory_deps.add(copy.deepcopy(dep)) ++ deps_by_feature[None] = (set(), mandatory_deps) ++ ++ if "default" not in deps_by_feature: ++ deps_by_feature["default"] = ({None}, set()) + +- requires.append(Dependency(dep["name"], dep["req"], features=dep["features"])) ++ self.dependencies = deps_by_feature ++ self.dev_dependencies = {Dependency.from_json(dep) ++ for dep in md["dependencies"] ++ if dep["kind"] == "dev"} ++ ++ self.targets = {Target(tgt["name"], tgt["kind"][0]) ++ for tgt in md["targets"]} + + return self + + @classmethod + def from_file(cls, path): + metadata = subprocess.check_output(["cargo", "read-manifest", +- "--manifest-path={}".format(path)]) ++ f"--manifest-path={path}"]) + return cls.from_json(json.loads(metadata)) ++ ++ @property ++ def all_dependencies(self): ++ return set().union(*(x[1] for x in self.dependencies.values())) ++ ++ def provides(self, feature=None): ++ if feature not in self.dependencies: ++ raise KeyError(f"Feature {feature!r} doesn't exist") ++ return Dependency(self.name, f"={self.version}", features={feature}) ++ ++ @classmethod ++ def _resolve(cls, deps_by_feature, feature): ++ all_features = set() ++ all_deps = set() ++ ff, dd = copy.deepcopy(deps_by_feature[feature]) ++ all_features |= ff ++ all_deps |= dd ++ for f in ff: ++ ff1, dd1 = cls._resolve(deps_by_feature, f) ++ all_features |= ff1 ++ all_deps |= dd1 ++ return all_features, all_deps ++ ++ def requires(self, feature=None, resolve=False): ++ if resolve: ++ return self._resolve(self.dependencies, feature)[1] ++ else: ++ features, deps = self.dependencies[feature] ++ fdeps = set(Dependency(self.name, f"={self.version}", features={feature}) ++ for feature in features) ++ return fdeps | deps ++ ++def normalize_deps(deps): ++ return set().union(*(d.normalize() for d in deps)) +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 7dbcc3f..4acfab7 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -48,82 +48,101 @@ Patch0: {{ patch_file }} + ExclusiveArch: %{rust_arches} + + BuildRequires: rust-packaging +-{% if include_build_requires %} +-{% if md.requires|length > 0 %} +-# [dependencies] +-{% for req in md.requires|sort(attribute="name") %} ++{# We will put all non-optional and optional dependencies until ++ https://github.com/rust-lang/cargo/issues/5133 ++ is solved ++{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} ++#} ++{% set buildrequires = normalize_deps(md.all_dependencies)|sort %} ++{% for req in buildrequires %} + BuildRequires: {{ req }} + {% endfor %} +-{% endif %} +-{% if md.build_requires|length > 0 %} +-# [build-dependencies] +-{% for req in md.build_requires|sort(attribute="name") %} +-BuildRequires: {{ req }} +-{% endfor %} +-{% endif %} +-{% if md.test_requires|length > 0 %} ++{% set testrequires = normalize_deps(md.dev_dependencies)|sort %} ++{% if testrequires|length > 0 %} + %if %{with check} +-# [dev-dependencies] +-{% for req in md.test_requires|sort(attribute="name") %} ++ {% for req in testrequires %} + BuildRequires: {{ req }} +-{% endfor %} ++ {% endfor %} + %endif + {% endif %} +-{% endif %} + +-%description ++%global _description \ ++{% if md.description is none %} + %{summary}. ++{% else %} ++{{ md.description|wordwrap(wrapstring="\\\n")|trim }} ++{% endif %} ++ ++%description %{_description} + + {% if include_main %} + %package -n %{crate} + Summary: %{summary} +-{% if rust_group is defined %} ++ {% if rust_group is defined %} + Group: # FIXME +-{% endif %} ++ {% endif %} + + %description -n %{crate} + %{summary}. + +-{% endif %} ++%files -n %{crate} ++ {% if md.license_file is not none %} ++%license {{ md.license_file }} ++ {% endif %} ++ {% if md.readme is not none %} ++%doc {{ md.readme }} ++ {% endif %} ++ {% for bin in bins %} ++%{_bindir}/{{ bin.name }} ++ {% endfor %} ++{% endif -%} ++ + {% if include_devel %} +-%package devel ++ {% set features = md.dependencies.keys()|list %} ++ {% do features.remove(None) %} ++ {% do features.remove("default") %} ++ {% set features = features|sort %} ++ {% do features.insert(0, None) %} ++ {% do features.insert(1, "default") %} ++ {% for feature in features %} ++ {% set pkg = "-n %%{name}+%s-devel"|format(feature) if feature is not none else " devel" %} ++%package {{ pkg }} + Summary: %{summary} +-{% if rust_group is defined %} ++ {% if rust_group is defined %} + Group: {{ rust_group }} +-{% endif %} ++ {% endif %} + BuildArch: noarch +-{% if include_provides %} +-{% for prv in md.provides %} +-Provides: {{ prv }} +-{% endfor %} +-{% endif %} +-{% if include_requires %} ++ {% if include_provides %} ++Provides: {{ md.provides() }} ++ {% endif %} ++ {% if include_requires %} + Requires: cargo +-{% if md.requires|length > 0 %} +-# [dependencies] +-{% for req in md.requires|sort(attribute="name") %} +-Requires: {{ req }} +-{% endfor %} +-{% endif %} +-{% if md.build_requires|length > 0 %} +-# [build-dependencies] +-{% for req in md.build_requires|sort(attribute="name") %} ++ {% for req in md.requires(feature)|map("string")|sort %} + Requires: {{ req }} +-{% endfor %} +-{% endif %} +-{% endif %} ++ {% endfor %} ++ {% endif %} + +-%description devel +-{% if md.description is none %} +-%{summary}. +-{% else %} +-{{ md.description|wordwrap|trim }} +-{% endif %} ++%description {{ pkg }} %{_description} + + This package contains library source intended for building other packages +-which use %{crate} from crates.io. ++which use {% if feature is not none %}"{{ feature }}" of {% endif %}"%{crate}" crate. ++ ++%files {{ pkg }} ++ {% if feature is none %} ++ {% if md.license_file is not none %} ++%license {{ md.license_file }} ++ {% endif %} ++ {% if md.readme is not none %} ++%doc {{ md.readme }} ++ {% endif %} ++%{cargo_registry}/%{crate}-%{version}/ ++ {% else %} ++%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml ++ {% endif %} ++ ++ {% endfor %} ++{% endif -%} + +-{% endif %} + %prep + {% if md.name != crate %} + %autosetup -n %{real_crate}-%{version} -p1 +@@ -143,29 +162,5 @@ which use %{crate} from crates.io. + %cargo_test + %endif + +-{% if include_main %} +-%files -n %{crate} +-{% if md.license_file is not none %} +-%license {{ md.license_file }} +-{% endif %} +-{% if md.readme is not none %} +-%doc {{ md.readme }} +-{% endif %} +-{% for bin in bins %} +-%{_bindir}/{{ bin.name }} +-{% endfor %} +- +-{% endif %} +-{% if include_devel %} +-%files devel +-{% if md.license_file is not none %} +-%license {{ md.license_file }} +-{% endif %} +-{% if md.readme is not none %} +-%doc {{ md.readme }} +-{% endif %} +-%{cargo_registry}/%{crate}-%{version}/ +- +-{% endif %} + %changelog + {% include target ~ "-changelog.spec.inc" %} +-- +2.19.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 98159e2..a7ba418 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,14 +1,23 @@ -%bcond_without check +# Tests need fixing after patches +%bcond_with check %{?python_enable_dependency_generator} Name: rust-packaging Version: 6 -Release: 1%{?dist} +Release: 10%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz +Patch0001: 0001-name-spec-patch_file-by-real-crate-name.patch +Patch0002: 0002-generate-doc-statements.patch +Patch0003: 0003-do-better-for-renamed-crates.patch +Patch0004: 0004-remove-pre-3.6-leftovers.patch +Patch0005: 0005-Remove-half-downloaded-crate-on-C.patch +Patch0006: 0006-Throw-an-error-if-s-is-used-without-a-crate.patch +# Still in PR +Patch0007: 0007-split-features-into-subpackages.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -70,6 +79,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Fri Oct 26 2018 Igor Gnatenko - 6-10 +- Split features into subpackages + * Sun Sep 02 2018 Igor Gnatenko - 6-1 - Update to 6 From c28b58679db5bd1910f1edc87c2c0c0231805cd4 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 20:57:20 +0200 Subject: [PATCH 26/96] trivial fixes to last patchset Signed-off-by: Igor Gnatenko --- 0007-split-features-into-subpackages.patch | 8 ++++---- rust-packaging.spec | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 58e5e8d..79909ab 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,4 +1,4 @@ -From 83a9b92d68e8c5d6f2ab75b287be7ea69275fb90 Mon Sep 17 00:00:00 2001 +From 571ba6b1f2a886b40a7de76980cd8c479015cc9e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 Subject: [PATCH 7/7] split features into subpackages @@ -512,7 +512,7 @@ index 5adeb65..95aa142 100644 +def normalize_deps(deps): + return set().union(*(d.normalize() for d in deps)) diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 7dbcc3f..4acfab7 100644 +index 7dbcc3f..27a448f 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -48,82 +48,101 @@ Patch0: {{ patch_file }} @@ -613,7 +613,7 @@ index 7dbcc3f..4acfab7 100644 -{% endif %} -{% if include_requires %} + {% if include_provides %} -+Provides: {{ md.provides() }} ++Provides: {{ md.provides(feature) }} + {% endif %} + {% if include_requires %} Requires: cargo @@ -644,7 +644,7 @@ index 7dbcc3f..4acfab7 100644 This package contains library source intended for building other packages -which use %{crate} from crates.io. -+which use {% if feature is not none %}"{{ feature }}" of {% endif %}"%{crate}" crate. ++which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{crate}" crate. + +%files {{ pkg }} + {% if feature is none %} diff --git a/rust-packaging.spec b/rust-packaging.spec index a7ba418..e206b06 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 6 -Release: 10%{?dist} +Release: 11%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -79,6 +79,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 28d6d0d63a2ba1fc30449fb504ba7cdbe9bee3c2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 27 Oct 2018 12:57:42 +0200 Subject: [PATCH 27/96] fix dependencies with space Signed-off-by: Igor Gnatenko --- 0007-split-features-into-subpackages.patch | 6 +++--- rust-packaging.spec | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 79909ab..5455ccc 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,4 +1,4 @@ -From 571ba6b1f2a886b40a7de76980cd8c479015cc9e Mon Sep 17 00:00:00 2001 +From a61a367883b7cd60f600d25958fb634c530500fa Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 Subject: [PATCH 7/7] split features into subpackages @@ -143,7 +143,7 @@ index 2d488b2..9e79e88 100644 if __name__ == "__main__": main() diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 5adeb65..95aa142 100644 +index 5adeb65..119dea5 100644 --- a/rust2rpm/metadata.py +++ b/rust2rpm/metadata.py @@ -1,208 +1,205 @@ @@ -262,7 +262,7 @@ index 5adeb65..95aa142 100644 + def _normalize_req(req): + if "*" in req: + return NotImplemented -+ spec = semver.Spec(req) ++ spec = semver.Spec(req.replace(" ", "")) + reqs = [] for req in spec.specs: - ver = req.spec diff --git a/rust-packaging.spec b/rust-packaging.spec index e206b06..157a08e 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 6 -Release: 11%{?dist} +Release: 12%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -79,6 +79,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 7b23eaea0455f811e2ffad86346e9470612f9e8a Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:47:39 +0100 Subject: [PATCH 28/96] support multiple dependencies with same name Signed-off-by: Igor Gnatenko --- ...e-spec-patch_file-by-real-crate-name.patch | 2 +- 0002-generate-doc-statements.patch | 2 +- 0003-do-better-for-renamed-crates.patch | 2 +- 0004-remove-pre-3.6-leftovers.patch | 2 +- 0005-Remove-half-downloaded-crate-on-C.patch | 2 +- ...n-error-if-s-is-used-without-a-crate.patch | 2 +- 0007-split-features-into-subpackages.patch | 15 ++-- ...port-for-dependencies-with-same-name.patch | 74 +++++++++++++++++++ rust-packaging.spec | 6 +- 9 files changed, 93 insertions(+), 14 deletions(-) create mode 100644 0008-add-support-for-dependencies-with-same-name.patch diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch index 7a14de3..27fbbfa 100644 --- a/0001-name-spec-patch_file-by-real-crate-name.patch +++ b/0001-name-spec-patch_file-by-real-crate-name.patch @@ -1,7 +1,7 @@ From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:37:40 +0200 -Subject: [PATCH 1/7] name spec/patch_file by real crate name +Subject: [PATCH 1/8] name spec/patch_file by real crate name When renaming using patch file, we really want to change file names too. diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch index 3bb4409..fb5ec59 100644 --- a/0002-generate-doc-statements.patch +++ b/0002-generate-doc-statements.patch @@ -1,7 +1,7 @@ From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:40:18 +0200 -Subject: [PATCH 2/7] generate %doc statements +Subject: [PATCH 2/8] generate %doc statements Signed-off-by: Igor Gnatenko --- diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch index a501e87..0c9c3fd 100644 --- a/0003-do-better-for-renamed-crates.patch +++ b/0003-do-better-for-renamed-crates.patch @@ -1,7 +1,7 @@ From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 00:06:50 +0200 -Subject: [PATCH 3/7] do better for renamed crates +Subject: [PATCH 3/8] do better for renamed crates Signed-off-by: Igor Gnatenko --- diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch index 5e7848c..79d041d 100644 --- a/0004-remove-pre-3.6-leftovers.patch +++ b/0004-remove-pre-3.6-leftovers.patch @@ -1,7 +1,7 @@ From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 10:43:53 +0200 -Subject: [PATCH 4/7] remove pre-3.6 leftovers +Subject: [PATCH 4/8] remove pre-3.6 leftovers Signed-off-by: Igor Gnatenko --- diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch index d822219..ef0eb21 100644 --- a/0005-Remove-half-downloaded-crate-on-C.patch +++ b/0005-Remove-half-downloaded-crate-on-C.patch @@ -1,7 +1,7 @@ From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:03:48 +0200 -Subject: [PATCH 5/7] Remove half-downloaded crate on ^C +Subject: [PATCH 5/8] Remove half-downloaded crate on ^C Subsequent invocations would fail with an error about a corrupted file. We don't have support for resuming a failed download, so let's remove the diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch index 44219dd..44bc5b1 100644 --- a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch +++ b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch @@ -1,7 +1,7 @@ From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:18:59 +0200 -Subject: [PATCH 6/7] Throw an error if -s is used without a crate +Subject: [PATCH 6/8] Throw an error if -s is used without a crate In the future we might want to be smarter and find the crate, but let's at least not ignore the option completely. diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 5455ccc..fe96334 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,7 +1,7 @@ -From a61a367883b7cd60f600d25958fb634c530500fa Mon Sep 17 00:00:00 2001 +From d7caa1148d5fcac70030e3fb1eb698927e69960f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 -Subject: [PATCH 7/7] split features into subpackages +Subject: [PATCH 7/8] split features into subpackages References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain Signed-off-by: Igor Gnatenko @@ -11,8 +11,8 @@ Signed-off-by: Igor Gnatenko rust2rpm/__main__.py | 11 +- rust2rpm/inspector.py | 22 ++- rust2rpm/metadata.py | 315 +++++++++++++++++------------------ - rust2rpm/templates/main.spec | 141 ++++++++-------- - 6 files changed, 259 insertions(+), 244 deletions(-) + rust2rpm/templates/main.spec | 142 ++++++++-------- + 6 files changed, 260 insertions(+), 244 deletions(-) diff --git a/data/cargo.attr b/data/cargo.attr index 392a72b..4910b5c 100644 @@ -512,10 +512,10 @@ index 5adeb65..119dea5 100644 +def normalize_deps(deps): + return set().union(*(d.normalize() for d in deps)) diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 7dbcc3f..27a448f 100644 +index 7dbcc3f..0d9a80b 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec -@@ -48,82 +48,101 @@ Patch0: {{ patch_file }} +@@ -48,82 +48,102 @@ Patch0: {{ patch_file }} ExclusiveArch: %{rust_arches} BuildRequires: rust-packaging @@ -586,6 +586,7 @@ index 7dbcc3f..27a448f 100644 + {% for bin in bins %} +%{_bindir}/{{ bin.name }} + {% endfor %} ++ +{% endif -%} + {% if include_devel %} @@ -666,7 +667,7 @@ index 7dbcc3f..27a448f 100644 %prep {% if md.name != crate %} %autosetup -n %{real_crate}-%{version} -p1 -@@ -143,29 +162,5 @@ which use %{crate} from crates.io. +@@ -143,29 +163,5 @@ which use %{crate} from crates.io. %cargo_test %endif diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch new file mode 100644 index 0000000..5d8af44 --- /dev/null +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -0,0 +1,74 @@ +From 6b5c116b0369a0a6c6ecb40c8bcc0974a36fa714 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 30 Oct 2018 20:37:38 +0100 +Subject: [PATCH 8/8] add support for dependencies with same name + +Reported-by: Josh Stone +References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728 +Signed-off-by: Igor Gnatenko +--- + rust2rpm/metadata.py | 32 ++++++++++++++++++++------------ + 1 file changed, 20 insertions(+), 12 deletions(-) + +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index 119dea5..10c0011 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -1,5 +1,6 @@ + __all__ = ["Dependency", "Metadata"] + ++import collections + import copy + import json + import subprocess +@@ -124,9 +125,11 @@ class Metadata: + self.description = md.get("description") + + # dependencies + build-dependencies → runtime +- deps_by_name = {dep["name"]: Dependency.from_json(dep) +- for dep in md["dependencies"] +- if dep["kind"] != "dev"} ++ deps_by_name = collections.defaultdict(list) ++ for dep in md["dependencies"]: ++ if dep["kind"] == "dev": ++ continue ++ deps_by_name[dep["name"]].append(Dependency.from_json(dep)) + + deps_by_feature = {} + for feature, f_deps in md["features"].items(): +@@ -137,18 +140,23 @@ class Metadata: + features.add(dep) + else: + pkg, _, f = dep.partition("/") +- dep = copy.deepcopy(deps_by_name[pkg]) +- if f: +- dep.features = {f} +- deps.add(dep) ++ for dep in deps_by_name[pkg]: ++ dep = copy.deepcopy(dep) ++ if f: ++ dep.features = {f} ++ deps.add(dep) + deps_by_feature[feature] = (features, deps) + + mandatory_deps = set() +- for dep in deps_by_name.values(): +- if dep.optional: +- deps_by_feature[dep.name] = ({None}, {copy.deepcopy(dep)}) +- else: +- mandatory_deps.add(copy.deepcopy(dep)) ++ for deps in deps_by_name.values(): ++ fdeps = set() ++ for dep in deps: ++ if dep.optional: ++ fdeps.add(copy.deepcopy(dep)) ++ else: ++ mandatory_deps.add(copy.deepcopy(dep)) ++ if fdeps: ++ deps_by_feature[name] = ({None}, fdeps) + deps_by_feature[None] = (set(), mandatory_deps) + + if "default" not in deps_by_feature: +-- +2.19.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 157a08e..c5bd19c 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 6 -Release: 12%{?dist} +Release: 13%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -18,6 +18,7 @@ Patch0005: 0005-Remove-half-downloaded-crate-on-C.patch Patch0006: 0006-Throw-an-error-if-s-is-used-without-a-crate.patch # Still in PR Patch0007: 0007-split-features-into-subpackages.patch +Patch0008: 0008-add-support-for-dependencies-with-same-name.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -79,6 +80,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From a31cf1d2bad4be6805604ffb0230bf09d4f3f45f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 11:40:04 +0100 Subject: [PATCH 29/96] fix syntax error Signed-off-by: Igor Gnatenko --- 0008-add-support-for-dependencies-with-same-name.patch | 6 +++--- rust-packaging.spec | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index 5d8af44..dbbad89 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,4 +1,4 @@ -From 6b5c116b0369a0a6c6ecb40c8bcc0974a36fa714 Mon Sep 17 00:00:00 2001 +From 129d556d19d2e41135f5e98ed028d7d00e66b524 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 Subject: [PATCH 8/8] add support for dependencies with same name @@ -11,7 +11,7 @@ Signed-off-by: Igor Gnatenko 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 119dea5..10c0011 100644 +index 119dea5..febf1e5 100644 --- a/rust2rpm/metadata.py +++ b/rust2rpm/metadata.py @@ -1,5 +1,6 @@ @@ -57,7 +57,7 @@ index 119dea5..10c0011 100644 - deps_by_feature[dep.name] = ({None}, {copy.deepcopy(dep)}) - else: - mandatory_deps.add(copy.deepcopy(dep)) -+ for deps in deps_by_name.values(): ++ for name, deps in deps_by_name.items(): + fdeps = set() + for dep in deps: + if dep.optional: diff --git a/rust-packaging.spec b/rust-packaging.spec index c5bd19c..21198c6 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 6 -Release: 13%{?dist} +Release: 14%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -80,6 +80,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From ae59ba471de8c4fbf9b5b99030f71b5758ce1a2e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 2 Nov 2018 17:00:14 +0100 Subject: [PATCH 30/96] Support .rust2rpm.conf Signed-off-by: Igor Gnatenko --- ...e-spec-patch_file-by-real-crate-name.patch | 2 +- 0002-generate-doc-statements.patch | 2 +- 0003-do-better-for-renamed-crates.patch | 2 +- 0004-remove-pre-3.6-leftovers.patch | 2 +- 0005-Remove-half-downloaded-crate-on-C.patch | 2 +- ...n-error-if-s-is-used-without-a-crate.patch | 2 +- 0007-split-features-into-subpackages.patch | 4 +- ...port-for-dependencies-with-same-name.patch | 4 +- ...pport-for-feeding-user-configuration.patch | 148 ++++++++++++++++++ 0010-trivial-use-f-strings-everywhere.patch | 94 +++++++++++ rust-packaging.spec | 7 +- 11 files changed, 258 insertions(+), 11 deletions(-) create mode 100644 0009-add-support-for-feeding-user-configuration.patch create mode 100644 0010-trivial-use-f-strings-everywhere.patch diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch index 27fbbfa..3049ab2 100644 --- a/0001-name-spec-patch_file-by-real-crate-name.patch +++ b/0001-name-spec-patch_file-by-real-crate-name.patch @@ -1,7 +1,7 @@ From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:37:40 +0200 -Subject: [PATCH 1/8] name spec/patch_file by real crate name +Subject: [PATCH 01/10] name spec/patch_file by real crate name When renaming using patch file, we really want to change file names too. diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch index fb5ec59..fb8f36b 100644 --- a/0002-generate-doc-statements.patch +++ b/0002-generate-doc-statements.patch @@ -1,7 +1,7 @@ From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:40:18 +0200 -Subject: [PATCH 2/8] generate %doc statements +Subject: [PATCH 02/10] generate %doc statements Signed-off-by: Igor Gnatenko --- diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch index 0c9c3fd..e70a367 100644 --- a/0003-do-better-for-renamed-crates.patch +++ b/0003-do-better-for-renamed-crates.patch @@ -1,7 +1,7 @@ From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 00:06:50 +0200 -Subject: [PATCH 3/8] do better for renamed crates +Subject: [PATCH 03/10] do better for renamed crates Signed-off-by: Igor Gnatenko --- diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch index 79d041d..0f2a391 100644 --- a/0004-remove-pre-3.6-leftovers.patch +++ b/0004-remove-pre-3.6-leftovers.patch @@ -1,7 +1,7 @@ From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 10:43:53 +0200 -Subject: [PATCH 4/8] remove pre-3.6 leftovers +Subject: [PATCH 04/10] remove pre-3.6 leftovers Signed-off-by: Igor Gnatenko --- diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch index ef0eb21..6daebcc 100644 --- a/0005-Remove-half-downloaded-crate-on-C.patch +++ b/0005-Remove-half-downloaded-crate-on-C.patch @@ -1,7 +1,7 @@ From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:03:48 +0200 -Subject: [PATCH 5/8] Remove half-downloaded crate on ^C +Subject: [PATCH 05/10] Remove half-downloaded crate on ^C Subsequent invocations would fail with an error about a corrupted file. We don't have support for resuming a failed download, so let's remove the diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch index 44bc5b1..1f2a4e0 100644 --- a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch +++ b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch @@ -1,7 +1,7 @@ From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:18:59 +0200 -Subject: [PATCH 6/8] Throw an error if -s is used without a crate +Subject: [PATCH 06/10] Throw an error if -s is used without a crate In the future we might want to be smarter and find the crate, but let's at least not ignore the option completely. diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index fe96334..0d4c7e2 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,7 +1,7 @@ -From d7caa1148d5fcac70030e3fb1eb698927e69960f Mon Sep 17 00:00:00 2001 +From 6f95899a21799054165858cacbe588a2a8bc6020 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 -Subject: [PATCH 7/8] split features into subpackages +Subject: [PATCH 07/10] split features into subpackages References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain Signed-off-by: Igor Gnatenko diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index dbbad89..490338c 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,7 +1,7 @@ -From 129d556d19d2e41135f5e98ed028d7d00e66b524 Mon Sep 17 00:00:00 2001 +From a5fd01ecd0fd600a096c060ddfe77a21f54b045f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 -Subject: [PATCH 8/8] add support for dependencies with same name +Subject: [PATCH 08/10] add support for dependencies with same name Reported-by: Josh Stone References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728 diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch new file mode 100644 index 0000000..1a33fae --- /dev/null +++ b/0009-add-support-for-feeding-user-configuration.patch @@ -0,0 +1,148 @@ +From 52b6ff8d55d59ace29950621ed41175ac31fa90c Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 31 Oct 2018 18:03:21 +0100 +Subject: [PATCH 09/10] add support for feeding user configuration + +Signed-off-by: Igor Gnatenko +--- + README.md | 26 ++++++++++++++++++++++++++ + README.rst | 5 ----- + rust2rpm/__main__.py | 13 +++++++++++++ + rust2rpm/templates/main.spec | 17 ++++++++++++++++- + 4 files changed, 55 insertions(+), 6 deletions(-) + create mode 100644 README.md + delete mode 100644 README.rst + +diff --git a/README.md b/README.md +new file mode 100644 +index 0000000..22b4b30 +--- /dev/null ++++ b/README.md +@@ -0,0 +1,26 @@ ++# rust2rpm ++ ++Convert Rust crates to RPM. ++ ++## `.rust2rpm.conf` ++ ++You can place configuration file which is used as source for additional ++information for spec generation. ++ ++Some simple example would be better than many words ;) ++ ++```ini ++[DEFAULT] ++buildrequires = ++ pkgconfig(foo) >= 1.2.3 ++lib.requires = ++ pkgconfig(foo) >= 1.2.3 ++ ++[fedora] ++bin.requires = ++ findutils ++buildrequires = ++lib.requires = ++lib+default.requires = ++ pkgconfig(bar) >= 2.0.0 ++``` +diff --git a/README.rst b/README.rst +deleted file mode 100644 +index 8866027..0000000 +--- a/README.rst ++++ /dev/null +@@ -1,5 +0,0 @@ +-======== +-rust2rpm +-======== +- +-Convert Rust crates to RPM. +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index d19cb47..18fac5c 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -199,6 +199,11 @@ def make_diff_metadata(crate, version, patch=False, store=False): + shutil.copy2(cratef, os.path.join(os.getcwd(), f"{metadata.name}-{version}.crate")) + return crate, diff, metadata + ++def to_list(s): ++ if not s: ++ return [] ++ return list(filter(None, (l.strip() for l in s.splitlines()))) ++ + def main(): + parser = argparse.ArgumentParser("rust2rpm", + formatter_class=argparse.RawTextHelpFormatter) +@@ -232,6 +237,7 @@ def main(): + store=args.store_crate) + + JINJA_ENV.globals["normalize_deps"] = normalize_deps ++ JINJA_ENV.globals["to_list"] = to_list + template = JINJA_ENV.get_template("main.spec") + + if args.patch and len(diff) > 0: +@@ -287,6 +293,13 @@ def main(): + kwargs["license"] = license + kwargs["license_comments"] = comments + ++ conf = configparser.ConfigParser() ++ conf.read(".rust2rpm.conf") ++ if args.target not in conf: ++ conf.add_section(args.target) ++ ++ kwargs["distconf"] = conf[args.target] ++ + spec_file = f"rust-{metadata.name}.spec" + spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) + if args.stdout: +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 0d9a80b..d901e6d 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -65,6 +65,9 @@ BuildRequires: {{ req }} + {% endfor %} + %endif + {% endif %} ++{% for req in to_list(distconf.get("buildrequires"))|sort %} ++BuildRequires: {{ req }} ++{% endfor %} + + %global _description \ + {% if md.description is none %} +@@ -81,6 +84,9 @@ Summary: %{summary} + {% if rust_group is defined %} + Group: # FIXME + {% endif %} ++ {% for req in to_list(distconf.get("bin.requires"))|sort %} ++Requires: {{ req }} ++ {% endfor %} + + %description -n %{crate} + %{summary}. +@@ -106,7 +112,13 @@ Group: # FIXME + {% do features.insert(0, None) %} + {% do features.insert(1, "default") %} + {% for feature in features %} +- {% set pkg = "-n %%{name}+%s-devel"|format(feature) if feature is not none else " devel" %} ++ {% if feature is none %} ++ {% set pkg = " devel" %} ++ {% set conf_prefix = "lib" %} ++ {% else %} ++ {% set pkg = "-n %%{name}+%s-devel"|format(feature) %} ++ {% set conf_prefix = "lib+%s"|format(feature) %} ++ {% endif %} + %package {{ pkg }} + Summary: %{summary} + {% if rust_group is defined %} +@@ -122,6 +134,9 @@ Requires: cargo + Requires: {{ req }} + {% endfor %} + {% endif %} ++ {% for req in to_list(distconf.get("%s.requires"|format(conf_prefix)))|sort %} ++Requires: {{ req }} ++ {% endfor %} + + %description {{ pkg }} %{_description} + +-- +2.19.1 + diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch new file mode 100644 index 0000000..3d8ca14 --- /dev/null +++ b/0010-trivial-use-f-strings-everywhere.patch @@ -0,0 +1,94 @@ +From 00ed1ce05d9dd4c8042f27ca959350ce34fb1be5 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 31 Oct 2018 17:00:58 +0100 +Subject: [PATCH 10/10] trivial: use f-strings everywhere + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/__main__.py | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index 18fac5c..b4eb624 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -79,7 +79,7 @@ def detect_packager(): + if git is not None: + name = subprocess.check_output([git, "config", "user.name"], universal_newlines=True).strip() + email = subprocess.check_output([git, "config", "user.email"], universal_newlines=True).strip() +- return "{} <{}>".format(name, email) ++ return f"{name} <{email}>" + + return None + +@@ -108,23 +108,23 @@ def local_crate(crate, version): + def download(crate, version): + if version is None: + # Now we need to get latest version +- url = requests.compat.urljoin(API_URL, "crates/{}/versions".format(crate)) ++ url = requests.compat.urljoin(API_URL, f"crates/{crate}/versions") + req = requests.get(url) + req.raise_for_status() + versions = req.json()["versions"] + version = next(version["num"] for version in versions if not version["yanked"]) + + os.makedirs(CACHEDIR, exist_ok=True) +- cratef_base = "{}-{}.crate".format(crate, version) ++ cratef_base = f"{crate}-{version}.crate" + cratef = os.path.join(CACHEDIR, cratef_base) + if not os.path.isfile(cratef): +- url = requests.compat.urljoin(API_URL, "crates/{}/{}/download#".format(crate, version)) ++ url = requests.compat.urljoin(API_URL, f"crates/{crate}/{version}/download#") + req = requests.get(url, stream=True) + req.raise_for_status() + total = int(req.headers["Content-Length"]) + with remove_on_error(cratef), \ + open(cratef, "wb") as f: +- for chunk in tqdm.tqdm(req.iter_content(), "Downloading {}".format(cratef_base), ++ for chunk in tqdm.tqdm(req.iter_content(), f"Downloading {cratef_base}".format(cratef_base), + total=total, unit="B", unit_scale=True): + f.write(chunk) + return cratef, crate, version +@@ -132,14 +132,14 @@ def download(crate, version): + @contextlib.contextmanager + def toml_from_crate(cratef, crate, version): + with tempfile.TemporaryDirectory() as tmpdir: +- target_dir = "{}/".format(tmpdir) ++ target_dir = f"{tmpdir}/" + with tarfile.open(cratef, "r") as archive: + for n in archive.getnames(): + if not os.path.abspath(os.path.join(target_dir, n)).startswith(target_dir): + raise Exception("Unsafe filenames!") + archive.extractall(target_dir) +- toml_relpath = "{}-{}/Cargo.toml".format(crate, version) +- toml = "{}/{}".format(tmpdir, toml_relpath) ++ toml_relpath = f"{crate}-{version}/Cargo.toml" ++ toml = f"{tmpdir}/{toml_relpath}" + if not os.path.isfile(toml): + raise IOError("crate does not contain Cargo.toml file") + yield toml +@@ -270,7 +270,7 @@ def main(): + kwargs["include_provides"] = True + kwargs["include_requires"] = True + else: +- assert False, "Unknown target {!r}".format(args.target) ++ assert False, f"Unknown target {args.target!r}" + + if args.target == "mageia": + kwargs["pkg_release"] = "%mkrel 1" +@@ -303,10 +303,10 @@ def main(): + spec_file = f"rust-{metadata.name}.spec" + spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) + if args.stdout: +- print("# {}".format(spec_file)) ++ print(f"# {spec_file}") + print(spec_contents) + if patch_file is not None: +- print("# {}".format(patch_file)) ++ print(f"# {patch_file}") + print("".join(diff), end="") + else: + with open(spec_file, "w") as fobj: +-- +2.19.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 21198c6..524b739 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 6 -Release: 14%{?dist} +Release: 15%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -19,6 +19,8 @@ Patch0006: 0006-Throw-an-error-if-s-is-used-without-a-crate.patch # Still in PR Patch0007: 0007-split-features-into-subpackages.patch Patch0008: 0008-add-support-for-dependencies-with-same-name.patch +Patch0009: 0009-add-support-for-feeding-user-configuration.patch +Patch0010: 0010-trivial-use-f-strings-everywhere.patch BuildArch: noarch ExclusiveArch: %{rust_arches} noarch @@ -80,6 +82,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Fri Nov 02 2018 Igor Gnatenko - 6-15 +- Support .rust2rpm.conf + * Wed Oct 31 2018 Igor Gnatenko - 6-14 - Fix syntax error From 5ab9ed56cb2342f2e30413ce4cf1d3c499b5bfd2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 2 Nov 2018 17:05:14 +0100 Subject: [PATCH 31/96] update patches Signed-off-by: Igor Gnatenko --- 0007-split-features-into-subpackages.patch | 2 +- 0008-add-support-for-dependencies-with-same-name.patch | 2 +- 0009-add-support-for-feeding-user-configuration.patch | 6 +++--- 0010-trivial-use-f-strings-everywhere.patch | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 0d4c7e2..519b6ac 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,4 +1,4 @@ -From 6f95899a21799054165858cacbe588a2a8bc6020 Mon Sep 17 00:00:00 2001 +From 5471c1916a5e947ba1b21343b70abd6d4aaf97de Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 Subject: [PATCH 07/10] split features into subpackages diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index 490338c..1932281 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,4 +1,4 @@ -From a5fd01ecd0fd600a096c060ddfe77a21f54b045f Mon Sep 17 00:00:00 2001 +From 8905032db2b0198c6426011807f3b75fc91c38b5 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 Subject: [PATCH 08/10] add support for dependencies with same name diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch index 1a33fae..d811dac 100644 --- a/0009-add-support-for-feeding-user-configuration.patch +++ b/0009-add-support-for-feeding-user-configuration.patch @@ -1,4 +1,4 @@ -From 52b6ff8d55d59ace29950621ed41175ac31fa90c Mon Sep 17 00:00:00 2001 +From 9ef415cbd5e204849793a16fa1b8a9ed40c0be73 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 18:03:21 +0100 Subject: [PATCH 09/10] add support for feeding user configuration @@ -57,7 +57,7 @@ index 8866027..0000000 - -Convert Rust crates to RPM. diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index d19cb47..18fac5c 100644 +index d19cb47..c691274 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -199,6 +199,11 @@ def make_diff_metadata(crate, version, patch=False, store=False): @@ -84,7 +84,7 @@ index d19cb47..18fac5c 100644 kwargs["license"] = license kwargs["license_comments"] = comments -+ conf = configparser.ConfigParser() ++ conf = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation()) + conf.read(".rust2rpm.conf") + if args.target not in conf: + conf.add_section(args.target) diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch index 3d8ca14..dd42d58 100644 --- a/0010-trivial-use-f-strings-everywhere.patch +++ b/0010-trivial-use-f-strings-everywhere.patch @@ -1,4 +1,4 @@ -From 00ed1ce05d9dd4c8042f27ca959350ce34fb1be5 Mon Sep 17 00:00:00 2001 +From be0464ab8a235b4c3b49e711140c2de2f0dcf6d8 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 17:00:58 +0100 Subject: [PATCH 10/10] trivial: use f-strings everywhere @@ -9,7 +9,7 @@ Signed-off-by: Igor Gnatenko 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index 18fac5c..b4eb624 100644 +index c691274..b60e6c4 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -79,7 +79,7 @@ def detect_packager(): From 965e2b87b5dc2618aacb99bd2875fc673f6746eb Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 3 Nov 2018 10:15:56 +0100 Subject: [PATCH 32/96] Make package archful Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 524b739..f80f490 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,10 +1,12 @@ # Tests need fixing after patches %bcond_with check %{?python_enable_dependency_generator} +# https://pagure.io/koji/issue/659 +%global debug_package %{nil} Name: rust-packaging Version: 6 -Release: 15%{?dist} +Release: 16%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -22,8 +24,7 @@ Patch0008: 0008-add-support-for-dependencies-with-same-name.patch Patch0009: 0009-add-support-for-feeding-user-configuration.patch Patch0010: 0010-trivial-use-f-strings-everywhere.patch -BuildArch: noarch -ExclusiveArch: %{rust_arches} noarch +ExclusiveArch: %{rust_arches} # gawk is needed for stripping dev-deps in macro, 4.1.0 is needed for inplace feature Requires: gawk >= 4.1.0 @@ -82,6 +83,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Sat Nov 03 2018 Igor Gnatenko - 6-16 +- Make package archful + * Fri Nov 02 2018 Igor Gnatenko - 6-15 - Support .rust2rpm.conf From 04e7ad287a632a68ccd10cfd35a636852108ad28 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 3 Nov 2018 21:45:54 +0100 Subject: [PATCH 33/96] Update patchset Signed-off-by: Igor Gnatenko --- 0007-split-features-into-subpackages.patch | 384 +++++++++++++++++- ...port-for-dependencies-with-same-name.patch | 8 +- ...pport-for-feeding-user-configuration.patch | 2 +- 0010-trivial-use-f-strings-everywhere.patch | 2 +- rust-packaging.spec | 8 +- 5 files changed, 384 insertions(+), 20 deletions(-) diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 519b6ac..ac08472 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,4 +1,4 @@ -From 5471c1916a5e947ba1b21343b70abd6d4aaf97de Mon Sep 17 00:00:00 2001 +From 2cac5e5ad5ff5472923ce333bef59679612bbaa2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 Subject: [PATCH 07/10] split features into subpackages @@ -7,12 +7,13 @@ References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-desi Signed-off-by: Igor Gnatenko --- data/cargo.attr | 4 +- - data/macros.cargo | 10 ++ + data/macros.cargo | 10 + rust2rpm/__main__.py | 11 +- rust2rpm/inspector.py | 22 ++- - rust2rpm/metadata.py | 315 +++++++++++++++++------------------ - rust2rpm/templates/main.spec | 142 ++++++++-------- - 6 files changed, 260 insertions(+), 244 deletions(-) + rust2rpm/metadata.py | 317 ++++++++++++++++---------------- + rust2rpm/templates/main.spec | 142 +++++++------- + test.py | 347 ++++------------------------------- + 7 files changed, 298 insertions(+), 555 deletions(-) diff --git a/data/cargo.attr b/data/cargo.attr index 392a72b..4910b5c 100644 @@ -143,10 +144,10 @@ index 2d488b2..9e79e88 100644 if __name__ == "__main__": main() diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 5adeb65..119dea5 100644 +index 5adeb65..4929cdd 100644 --- a/rust2rpm/metadata.py +++ b/rust2rpm/metadata.py -@@ -1,208 +1,205 @@ +@@ -1,208 +1,207 @@ __all__ = ["Dependency", "Metadata"] -import itertools @@ -260,8 +261,8 @@ index 5adeb65..119dea5 100644 - spec = semver.Spec(s.replace(" ", "")) - parsed = [] + def _normalize_req(req): -+ if "*" in req: -+ return NotImplemented ++ if "*" in req and req != "*": ++ raise NotImplementedError(f"'*' is not supported: {req}") + spec = semver.Spec(req.replace(" ", "")) + reqs = [] for req in spec.specs: @@ -271,8 +272,10 @@ index 5adeb65..119dea5 100644 + # Any means any continue + ver = req.spec -+ if ver.prerelease or req.kind in (req.KIND_NEQ, req.KIND_EMPTY): -+ return NotImplemented ++ if ver.prerelease: ++ raise NotImplementedError(f"Pre-release requirement is not supported: {ver}") ++ if req.kind in (req.KIND_NEQ, req.KIND_EMPTY): ++ raise NotImplementedError(f"'!=' and empty kinds are not supported: {req}") coerced = semver.Version.coerce(str(ver)) - if req.kind in (req.KIND_CARET, req.KIND_TILDE): - if ver.prerelease: @@ -697,6 +700,365 @@ index 7dbcc3f..0d9a80b 100644 -{% endif %} %changelog {% include target ~ "-changelog.spec.inc" %} +diff --git a/test.py b/test.py +index b856fdd..30263b4 100644 +--- a/test.py ++++ b/test.py +@@ -1,318 +1,43 @@ +-import os +-import shutil +-import subprocess +-import sys +-import tempfile +-import textwrap +- + import pytest + + import rust2rpm + +-DUMMY_LIB = """ +-pub fn say_hello() { +- println!("Hello, World!"); +-} +-""" +-DEPGEN = os.path.join(os.path.dirname(__file__), "cargodeps.py") +- +- +-@pytest.mark.parametrize("req, features, rpmdep", [ +- ("=1.0.0", [], +- "crate(test) = 1.0.0"), +- ("=1.0.0", ["feature"], +- "(crate(test) = 1.0.0 with crate(test/feature))"), +- (">=1.0.0,<2.0.0", [], ++@pytest.mark.parametrize("req, rpmdep", [ ++ ("^1.2.3", ++ "(crate(test) >= 1.2.3 with crate(test) < 2.0.0)"), ++ ("^1.2", ++ "(crate(test) >= 1.2.0 with crate(test) < 2.0.0)"), ++ ("^1", + "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), +- (">=1.0.0,<2.0.0", ["feature"], +- "((crate(test) >= 1.0.0 with crate(test) < 2.0.0) with crate(test/feature))"), ++ ("^0.2.3", ++ "(crate(test) >= 0.2.3 with crate(test) < 0.3.0)"), ++ ("^0.2", ++ "(crate(test) >= 0.2.0 with crate(test) < 0.3.0)"), ++ ("^0.0.3", ++ "(crate(test) >= 0.0.3 with crate(test) < 0.0.4)"), ++ ("^0.0", ++ "(crate(test) >= 0.0.0 with crate(test) < 0.1.0)"), ++ ("^0", ++ "(crate(test) >= 0.0.0 with crate(test) < 1.0.0)"), ++ ("~1.2.3", ++ "(crate(test) >= 1.2.3 with crate(test) < 1.3.0)"), ++ ("~1.2", ++ "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"), ++ ("~1", ++ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), ++ ("*", ++ "crate(test)"), ++ (">= 1.2.0", ++ "crate(test) >= 1.2.0"), ++ ("> 1", ++ "crate(test) > 1.0.0"), ++ ("< 2", ++ "crate(test) < 2.0.0"), ++ ("= 1.2.3", ++ "crate(test) = 1.2.3"), ++ (">= 1.2, < 1.5", ++ "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"), + ]) +-def test_dependency(req, features, rpmdep): +- dep = rust2rpm.Dependency("test", req, features) ++def test_dependency(req, rpmdep): ++ dep = rust2rpm.Dependency("test", req) + assert str(dep) == rpmdep +- +-@pytest.fixture +-def cargo_toml(request): +- def make_cargo_toml(contents): +- toml = os.path.join(tmpdir, "Cargo.toml") +- with open(toml, "w") as fobj: +- fobj.write(textwrap.dedent(contents)) +- return toml +- +- tmpdir = tempfile.mkdtemp(prefix="cargo-deps-") +- srcdir = os.path.join(tmpdir, "src") +- os.mkdir(srcdir) +- with open(os.path.join(srcdir, "lib.rs"), "w") as fobj: +- fobj.write(DUMMY_LIB) +- +- def finalize(): +- shutil.rmtree(tmpdir) +- request.addfinalizer(finalize) +- +- return make_cargo_toml +- +-@pytest.mark.parametrize("toml, provides, requires", [ +- +- # Basic provides +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- """, +- ["crate(hello) = 0.0.0"], +- []), +- +- # Basic provides for feature +- (""" +- [package] +- name = "hello" +- version = "1.2.3" +- +- [features] +- color = [] +- """, +- ["crate(hello) = 1.2.3", +- "crate(hello/color) = 1.2.3"], +- []), +- +- # Provides for optional dependencies +- (""" +- [package] +- name = "hello" +- version = "1.2.3" +- +- [dependencies] +- non_optional = "1" +- serde = { version = "1", optional = true } +- rand = { version = "0.4", optional = true } +- +- [features] +- std = [] +- v1 = ["rand"] +- """, +- ["crate(hello) = 1.2.3", +- "crate(hello/rand) = 1.2.3", +- "crate(hello/serde) = 1.2.3", +- "crate(hello/std) = 1.2.3", +- "crate(hello/v1) = 1.2.3"], +- ["(crate(non_optional) >= 1.0.0 with crate(non_optional) < 2.0.0)", +- "(crate(rand) >= 0.4.0 with crate(rand) < 0.5.0)", +- "(crate(serde) >= 1.0.0 with crate(serde) < 2.0.0)"]), +- +- # Caret requirements +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "^0" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 0.0.0 with crate(libc) < 1.0.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "^0.0" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 0.0.0 with crate(libc) < 0.1.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "^0.0.3" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 0.0.3 with crate(libc) < 0.0.4)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "^0.2.3" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 0.2.3 with crate(libc) < 0.3.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "^1" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "^1.2" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.2.0 with crate(libc) < 2.0.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "^1.2.3" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.2.3 with crate(libc) < 2.0.0)"]), +- +- # Tilde requirements +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "~1" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "~1.2" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "~1.2.3" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.2.3 with crate(libc) < 1.3.0)"]), +- +- # Wildcard requirements +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "*" +- """, +- ["crate(hello) = 0.0.0"], +- ["crate(libc)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "1.*" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "1.2.*" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.0)"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "1.*.*" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), +- +- # Inequality requirements +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = ">= 1.2.0" +- """, +- ["crate(hello) = 0.0.0"], +- ["crate(libc) >= 1.2.0"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "> 1" +- """, +- ["crate(hello) = 0.0.0"], +- ["crate(libc) > 1.0.0"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "< 2" +- """, +- ["crate(hello) = 0.0.0"], +- ["crate(libc) < 2.0.0"]), +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = "= 1.2.3" +- """, +- ["crate(hello) = 0.0.0"], +- ["crate(libc) = 1.2.3"]), +- +- # Multiple requirements +- (""" +- [package] +- name = "hello" +- version = "0.0.0" +- +- [dependencies] +- libc = ">= 1.2, < 1.5" +- """, +- ["crate(hello) = 0.0.0"], +- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.5.0)"]), +- +- # Pre-release requirements +- (""" +- [package] +- name = "hello" +- version = "0.0.0-alpha" +- +- [dependencies] +- foo-bar = "1.2.3-beta" +- """, +- ["crate(hello) = 0.0.0~alpha"], +- ["(crate(foo-bar) >= 1.2.3~beta with crate(foo-bar) < 1.2.3)"]), +- +-]) +-def test_depgen(toml, provides, requires, cargo_toml): +- md = rust2rpm.Metadata.from_file(cargo_toml(toml)) +- assert [str(x) for x in md.provides] == provides +- assert [str(x) for x in md.requires] == requires -- 2.19.1 diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index 1932281..d63d0c4 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,4 +1,4 @@ -From 8905032db2b0198c6426011807f3b75fc91c38b5 Mon Sep 17 00:00:00 2001 +From a1d3a84645aa7bbe5ca07b60bead1ddf90a21cc1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 Subject: [PATCH 08/10] add support for dependencies with same name @@ -11,7 +11,7 @@ Signed-off-by: Igor Gnatenko 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 119dea5..febf1e5 100644 +index 4929cdd..328b67a 100644 --- a/rust2rpm/metadata.py +++ b/rust2rpm/metadata.py @@ -1,5 +1,6 @@ @@ -21,7 +21,7 @@ index 119dea5..febf1e5 100644 import copy import json import subprocess -@@ -124,9 +125,11 @@ class Metadata: +@@ -126,9 +127,11 @@ class Metadata: self.description = md.get("description") # dependencies + build-dependencies → runtime @@ -36,7 +36,7 @@ index 119dea5..febf1e5 100644 deps_by_feature = {} for feature, f_deps in md["features"].items(): -@@ -137,18 +140,23 @@ class Metadata: +@@ -139,18 +142,23 @@ class Metadata: features.add(dep) else: pkg, _, f = dep.partition("/") diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch index d811dac..233c11c 100644 --- a/0009-add-support-for-feeding-user-configuration.patch +++ b/0009-add-support-for-feeding-user-configuration.patch @@ -1,4 +1,4 @@ -From 9ef415cbd5e204849793a16fa1b8a9ed40c0be73 Mon Sep 17 00:00:00 2001 +From 197150ee2e862edcd46f7ab02c9e4d17e49ca75d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 18:03:21 +0100 Subject: [PATCH 09/10] add support for feeding user configuration diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch index dd42d58..32bae14 100644 --- a/0010-trivial-use-f-strings-everywhere.patch +++ b/0010-trivial-use-f-strings-everywhere.patch @@ -1,4 +1,4 @@ -From be0464ab8a235b4c3b49e711140c2de2f0dcf6d8 Mon Sep 17 00:00:00 2001 +From 83ea3796cd28ec7689b39e7dc7a70bd11af1abf1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 17:00:58 +0100 Subject: [PATCH 10/10] trivial: use f-strings everywhere diff --git a/rust-packaging.spec b/rust-packaging.spec index f80f490..98fa000 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,12 +1,11 @@ -# Tests need fixing after patches -%bcond_with check +%bcond_without check %{?python_enable_dependency_generator} # https://pagure.io/koji/issue/659 %global debug_package %{nil} Name: rust-packaging Version: 6 -Release: 16%{?dist} +Release: 17%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -83,6 +82,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Sat Nov 03 2018 Igor Gnatenko - 6-17 +- Update patchset + * Sat Nov 03 2018 Igor Gnatenko - 6-16 - Make package archful From 6745bc623a3106cefedced2c8073010a7ac732aa Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 7 Dec 2018 23:17:39 +0100 Subject: [PATCH 34/96] Set CARGO_HOME Signed-off-by: Igor Gnatenko --- ...e-spec-patch_file-by-real-crate-name.patch | 4 +- 0002-generate-doc-statements.patch | 4 +- 0003-do-better-for-renamed-crates.patch | 4 +- 0004-remove-pre-3.6-leftovers.patch | 4 +- 0005-Remove-half-downloaded-crate-on-C.patch | 4 +- ...n-error-if-s-is-used-without-a-crate.patch | 4 +- 0007-split-features-into-subpackages.patch | 4 +- ...port-for-dependencies-with-same-name.patch | 4 +- ...pport-for-feeding-user-configuration.patch | 4 +- 0010-trivial-use-f-strings-everywhere.patch | 4 +- ...t-generate-a-default-changelog-entry.patch | 63 +++++++++++++++++++ ...-Set-CARGO_HOME-to-the-local-.config.patch | 26 ++++++++ ...et-the-install-root-in-.cargo-config.patch | 34 ++++++++++ rust-packaging.spec | 9 ++- 14 files changed, 150 insertions(+), 22 deletions(-) create mode 100644 0011-Add-option-to-not-generate-a-default-changelog-entry.patch create mode 100644 0012-Set-CARGO_HOME-to-the-local-.config.patch create mode 100644 0013-Set-the-install-root-in-.cargo-config.patch diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch index 3049ab2..1f65e7f 100644 --- a/0001-name-spec-patch_file-by-real-crate-name.patch +++ b/0001-name-spec-patch_file-by-real-crate-name.patch @@ -1,7 +1,7 @@ From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:37:40 +0200 -Subject: [PATCH 01/10] name spec/patch_file by real crate name +Subject: [PATCH 01/13] name spec/patch_file by real crate name When renaming using patch file, we really want to change file names too. @@ -33,5 +33,5 @@ index dc78828..1575ce6 100644 if args.stdout: print("# {}".format(spec_file)) -- -2.19.1 +2.20.0.rc2 diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch index fb8f36b..581990d 100644 --- a/0002-generate-doc-statements.patch +++ b/0002-generate-doc-statements.patch @@ -1,7 +1,7 @@ From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:40:18 +0200 -Subject: [PATCH 02/10] generate %doc statements +Subject: [PATCH 02/13] generate %doc statements Signed-off-by: Igor Gnatenko --- @@ -54,5 +54,5 @@ index 1aeb969..2e9f841 100644 {% endif %} -- -2.19.1 +2.20.0.rc2 diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch index e70a367..1640604 100644 --- a/0003-do-better-for-renamed-crates.patch +++ b/0003-do-better-for-renamed-crates.patch @@ -1,7 +1,7 @@ From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 00:06:50 +0200 -Subject: [PATCH 03/10] do better for renamed crates +Subject: [PATCH 03/13] do better for renamed crates Signed-off-by: Igor Gnatenko --- @@ -86,5 +86,5 @@ index 2e9f841..7dbcc3f 100644 %build -- -2.19.1 +2.20.0.rc2 diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch index 0f2a391..0ba106c 100644 --- a/0004-remove-pre-3.6-leftovers.patch +++ b/0004-remove-pre-3.6-leftovers.patch @@ -1,7 +1,7 @@ From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 10:43:53 +0200 -Subject: [PATCH 04/10] remove pre-3.6 leftovers +Subject: [PATCH 04/13] remove pre-3.6 leftovers Signed-off-by: Igor Gnatenko --- @@ -23,5 +23,5 @@ index f52d968..5adeb65 100644 + "--manifest-path={}".format(path)]) return cls.from_json(json.loads(metadata)) -- -2.19.1 +2.20.0.rc2 diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch index 6daebcc..6f67bb9 100644 --- a/0005-Remove-half-downloaded-crate-on-C.patch +++ b/0005-Remove-half-downloaded-crate-on-C.patch @@ -1,7 +1,7 @@ From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:03:48 +0200 -Subject: [PATCH 05/10] Remove half-downloaded crate on ^C +Subject: [PATCH 05/13] Remove half-downloaded crate on ^C Subsequent invocations would fail with an error about a corrupted file. We don't have support for resuming a failed download, so let's remove the @@ -40,5 +40,5 @@ index e993e7b..8e6f6eb 100644 total=total, unit="B", unit_scale=True): f.write(chunk) -- -2.19.1 +2.20.0.rc2 diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch index 1f2a4e0..cc09ce2 100644 --- a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch +++ b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch @@ -1,7 +1,7 @@ From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:18:59 +0200 -Subject: [PATCH 06/10] Throw an error if -s is used without a crate +Subject: [PATCH 06/13] Throw an error if -s is used without a crate In the future we might want to be smarter and find the crate, but let's at least not ignore the option completely. @@ -24,5 +24,5 @@ index 8e6f6eb..f23ebbc 100644 diff = make_patch(toml, enabled=patch, tmpfile=True) metadata = Metadata.from_file(toml) -- -2.19.1 +2.20.0.rc2 diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index ac08472..52d253e 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,7 +1,7 @@ From 2cac5e5ad5ff5472923ce333bef59679612bbaa2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 -Subject: [PATCH 07/10] split features into subpackages +Subject: [PATCH 07/13] split features into subpackages References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain Signed-off-by: Igor Gnatenko @@ -1060,5 +1060,5 @@ index b856fdd..30263b4 100644 - assert [str(x) for x in md.provides] == provides - assert [str(x) for x in md.requires] == requires -- -2.19.1 +2.20.0.rc2 diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index d63d0c4..378edfc 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,7 +1,7 @@ From a1d3a84645aa7bbe5ca07b60bead1ddf90a21cc1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 -Subject: [PATCH 08/10] add support for dependencies with same name +Subject: [PATCH 08/13] add support for dependencies with same name Reported-by: Josh Stone References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728 @@ -70,5 +70,5 @@ index 4929cdd..328b67a 100644 if "default" not in deps_by_feature: -- -2.19.1 +2.20.0.rc2 diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch index 233c11c..b130ebe 100644 --- a/0009-add-support-for-feeding-user-configuration.patch +++ b/0009-add-support-for-feeding-user-configuration.patch @@ -1,7 +1,7 @@ From 197150ee2e862edcd46f7ab02c9e4d17e49ca75d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 18:03:21 +0100 -Subject: [PATCH 09/10] add support for feeding user configuration +Subject: [PATCH 09/13] add support for feeding user configuration Signed-off-by: Igor Gnatenko --- @@ -144,5 +144,5 @@ index 0d9a80b..d901e6d 100644 %description {{ pkg }} %{_description} -- -2.19.1 +2.20.0.rc2 diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch index 32bae14..f6ff2f4 100644 --- a/0010-trivial-use-f-strings-everywhere.patch +++ b/0010-trivial-use-f-strings-everywhere.patch @@ -1,7 +1,7 @@ From 83ea3796cd28ec7689b39e7dc7a70bd11af1abf1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 17:00:58 +0100 -Subject: [PATCH 10/10] trivial: use f-strings everywhere +Subject: [PATCH 10/13] trivial: use f-strings everywhere Signed-off-by: Igor Gnatenko --- @@ -90,5 +90,5 @@ index c691274..b60e6c4 100644 else: with open(spec_file, "w") as fobj: -- -2.19.1 +2.20.0.rc2 diff --git a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch new file mode 100644 index 0000000..ccad736 --- /dev/null +++ b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch @@ -0,0 +1,63 @@ +From 294c6f571c0f4f7ed5a4fcb34142b0d332c55f29 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Sun, 11 Nov 2018 11:06:27 -0500 +Subject: [PATCH 11/13] Add option to not generate a default changelog entry + +For Rust packages created through the OBS source service, the +changelog is managed by an external .changes file that is +transformed into an RPM changelog and appended to the spec file +automatically by the Open Build Service. + +Having a default entry means that the changelog handling will not +always work correctly and package builds may fail due to changelog +entries not being in reverse chronological order. + +This also is a future enabler for other workflows for external +changelog management in automated package builds. + +Signed-off-by: Neal Gompa +--- + rust2rpm/__main__.py | 7 +++++++ + rust2rpm/templates/main.spec | 4 +++- + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index b60e6c4..747328e 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -209,6 +209,8 @@ def main(): + formatter_class=argparse.RawTextHelpFormatter) + parser.add_argument("--show-license-map", action="store_true", + help="Print license mappings and exit") ++ parser.add_argument("--no-auto-changelog-entry", action="store_true", ++ help="Do not generate a changelog entry") + parser.add_argument("-", "--stdout", action="store_true", + help="Print spec and patches into stdout") + parser.add_argument("-t", "--target", action="store", +@@ -261,6 +263,11 @@ def main(): + raise ValueError("No bins and no libs") + kwargs["include_devel"] = is_lib + ++ if args.no_auto_changelog_entry: ++ kwargs["auto_changelog_entry"] = False ++ else: ++ kwargs["auto_changelog_entry"] = True ++ + if args.target in ("fedora", "mageia", "opensuse"): + kwargs["include_build_requires"] = True + kwargs["include_provides"] = False +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index d901e6d..84bd97d 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -179,4 +179,6 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c + %endif + + %changelog +-{% include target ~ "-changelog.spec.inc" %} ++{% if auto_changelog_entry %} ++ {% include target ~ "-changelog.spec.inc" %} ++{% endif %} +-- +2.20.0.rc2 + diff --git a/0012-Set-CARGO_HOME-to-the-local-.config.patch b/0012-Set-CARGO_HOME-to-the-local-.config.patch new file mode 100644 index 0000000..9f81757 --- /dev/null +++ b/0012-Set-CARGO_HOME-to-the-local-.config.patch @@ -0,0 +1,26 @@ +From b4e25038296cd57eba639a059e8baaf139a5d287 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 7 Dec 2018 13:58:41 -0800 +Subject: [PATCH 12/13] Set CARGO_HOME to the local .config + +--- + data/macros.cargo | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 7fb025b..e760721 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -1,4 +1,8 @@ +-%__cargo %{_bindir}/cargo ++# Since cargo 1.31, install only uses $CARGO_HOME/config, ignoring $PWD. ++# https://github.com/rust-lang/cargo/issues/6397 ++# But we can set CARGO_HOME locally, which is a good idea anyway to make sure ++# it never writes to ~/.cargo during rpmbuild. ++%__cargo %{_bindir}/env CARGO_HOME=.cargo %{_bindir}/cargo + %__cargo_common_opts %{?_smp_mflags} + %__cargo_inspector %{_bindir}/cargo-inspector + +-- +2.20.0.rc2 + diff --git a/0013-Set-the-install-root-in-.cargo-config.patch b/0013-Set-the-install-root-in-.cargo-config.patch new file mode 100644 index 0000000..cb106e8 --- /dev/null +++ b/0013-Set-the-install-root-in-.cargo-config.patch @@ -0,0 +1,34 @@ +From a04e95bc4f807139bd3c4b75f46fd9a60ec1db8f Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 7 Dec 2018 13:59:03 -0800 +Subject: [PATCH 13/13] Set the install root in .cargo/config + +--- + data/macros.cargo | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index e760721..9a9ce6a 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -20,6 +20,9 @@ rustc = "%{__rustc}"\ + rustdoc = "%{__rustdoc}"\ + rustflags = %{__global_rustflags_toml}\ + \ ++[install]\ ++root = "%{buildroot}%{_prefix}"\ ++\ + [term]\ + verbose = true\ + \ +@@ -81,7 +84,6 @@ if %__cargo_is_bin; then \ + %{shrink:%{__cargo} install \ + %{__cargo_common_opts} \ + --path . \ +- --root %{buildroot}%{_prefix} \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ + }\ +-- +2.20.0.rc2 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 98fa000..5b5682d 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 17%{?dist} +Release: 18%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -17,11 +17,13 @@ Patch0003: 0003-do-better-for-renamed-crates.patch Patch0004: 0004-remove-pre-3.6-leftovers.patch Patch0005: 0005-Remove-half-downloaded-crate-on-C.patch Patch0006: 0006-Throw-an-error-if-s-is-used-without-a-crate.patch -# Still in PR Patch0007: 0007-split-features-into-subpackages.patch Patch0008: 0008-add-support-for-dependencies-with-same-name.patch Patch0009: 0009-add-support-for-feeding-user-configuration.patch Patch0010: 0010-trivial-use-f-strings-everywhere.patch +Patch0011: 0011-Add-option-to-not-generate-a-default-changelog-entry.patch +Patch0012: 0012-Set-CARGO_HOME-to-the-local-.config.patch +Patch0013: 0013-Set-the-install-root-in-.cargo-config.patch ExclusiveArch: %{rust_arches} @@ -82,6 +84,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Fri Dec 07 2018 Igor Gnatenko - 6-18 +- Set CARGO_HOME + * Sat Nov 03 2018 Igor Gnatenko - 6-17 - Update patchset From b078c549828898a71063bac9e3104b5a915b92ec Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 26 Jan 2019 09:31:56 +0100 Subject: [PATCH 35/96] Add support for pre-release versions Signed-off-by: Igor Gnatenko --- ...e-spec-patch_file-by-real-crate-name.patch | 4 +- 0002-generate-doc-statements.patch | 4 +- 0003-do-better-for-renamed-crates.patch | 4 +- 0004-remove-pre-3.6-leftovers.patch | 4 +- 0005-Remove-half-downloaded-crate-on-C.patch | 4 +- ...n-error-if-s-is-used-without-a-crate.patch | 4 +- 0007-split-features-into-subpackages.patch | 4 +- ...port-for-dependencies-with-same-name.patch | 4 +- ...pport-for-feeding-user-configuration.patch | 4 +- 0010-trivial-use-f-strings-everywhere.patch | 4 +- ...t-generate-a-default-changelog-entry.patch | 4 +- ...-Set-CARGO_HOME-to-the-local-.config.patch | 4 +- ...et-the-install-root-in-.cargo-config.patch | 4 +- ...-Add-support-for-prerelease-versions.patch | 85 +++++++++++++++++++ rust-packaging.spec | 6 +- 15 files changed, 116 insertions(+), 27 deletions(-) create mode 100644 0014-Add-support-for-prerelease-versions.patch diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch index 1f65e7f..4d55717 100644 --- a/0001-name-spec-patch_file-by-real-crate-name.patch +++ b/0001-name-spec-patch_file-by-real-crate-name.patch @@ -1,7 +1,7 @@ From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:37:40 +0200 -Subject: [PATCH 01/13] name spec/patch_file by real crate name +Subject: [PATCH 01/14] name spec/patch_file by real crate name When renaming using patch file, we really want to change file names too. @@ -33,5 +33,5 @@ index dc78828..1575ce6 100644 if args.stdout: print("# {}".format(spec_file)) -- -2.20.0.rc2 +2.20.1 diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch index 581990d..42ca40d 100644 --- a/0002-generate-doc-statements.patch +++ b/0002-generate-doc-statements.patch @@ -1,7 +1,7 @@ From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:40:18 +0200 -Subject: [PATCH 02/13] generate %doc statements +Subject: [PATCH 02/14] generate %doc statements Signed-off-by: Igor Gnatenko --- @@ -54,5 +54,5 @@ index 1aeb969..2e9f841 100644 {% endif %} -- -2.20.0.rc2 +2.20.1 diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch index 1640604..3f1bc98 100644 --- a/0003-do-better-for-renamed-crates.patch +++ b/0003-do-better-for-renamed-crates.patch @@ -1,7 +1,7 @@ From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 00:06:50 +0200 -Subject: [PATCH 03/13] do better for renamed crates +Subject: [PATCH 03/14] do better for renamed crates Signed-off-by: Igor Gnatenko --- @@ -86,5 +86,5 @@ index 2e9f841..7dbcc3f 100644 %build -- -2.20.0.rc2 +2.20.1 diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch index 0ba106c..7133f4e 100644 --- a/0004-remove-pre-3.6-leftovers.patch +++ b/0004-remove-pre-3.6-leftovers.patch @@ -1,7 +1,7 @@ From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 10:43:53 +0200 -Subject: [PATCH 04/13] remove pre-3.6 leftovers +Subject: [PATCH 04/14] remove pre-3.6 leftovers Signed-off-by: Igor Gnatenko --- @@ -23,5 +23,5 @@ index f52d968..5adeb65 100644 + "--manifest-path={}".format(path)]) return cls.from_json(json.loads(metadata)) -- -2.20.0.rc2 +2.20.1 diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch index 6f67bb9..8ae52e4 100644 --- a/0005-Remove-half-downloaded-crate-on-C.patch +++ b/0005-Remove-half-downloaded-crate-on-C.patch @@ -1,7 +1,7 @@ From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:03:48 +0200 -Subject: [PATCH 05/13] Remove half-downloaded crate on ^C +Subject: [PATCH 05/14] Remove half-downloaded crate on ^C Subsequent invocations would fail with an error about a corrupted file. We don't have support for resuming a failed download, so let's remove the @@ -40,5 +40,5 @@ index e993e7b..8e6f6eb 100644 total=total, unit="B", unit_scale=True): f.write(chunk) -- -2.20.0.rc2 +2.20.1 diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch index cc09ce2..8684175 100644 --- a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch +++ b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch @@ -1,7 +1,7 @@ From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:18:59 +0200 -Subject: [PATCH 06/13] Throw an error if -s is used without a crate +Subject: [PATCH 06/14] Throw an error if -s is used without a crate In the future we might want to be smarter and find the crate, but let's at least not ignore the option completely. @@ -24,5 +24,5 @@ index 8e6f6eb..f23ebbc 100644 diff = make_patch(toml, enabled=patch, tmpfile=True) metadata = Metadata.from_file(toml) -- -2.20.0.rc2 +2.20.1 diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 52d253e..19fd5e5 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,7 +1,7 @@ From 2cac5e5ad5ff5472923ce333bef59679612bbaa2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 -Subject: [PATCH 07/13] split features into subpackages +Subject: [PATCH 07/14] split features into subpackages References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain Signed-off-by: Igor Gnatenko @@ -1060,5 +1060,5 @@ index b856fdd..30263b4 100644 - assert [str(x) for x in md.provides] == provides - assert [str(x) for x in md.requires] == requires -- -2.20.0.rc2 +2.20.1 diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index 378edfc..f6f2743 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,7 +1,7 @@ From a1d3a84645aa7bbe5ca07b60bead1ddf90a21cc1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 -Subject: [PATCH 08/13] add support for dependencies with same name +Subject: [PATCH 08/14] add support for dependencies with same name Reported-by: Josh Stone References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728 @@ -70,5 +70,5 @@ index 4929cdd..328b67a 100644 if "default" not in deps_by_feature: -- -2.20.0.rc2 +2.20.1 diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch index b130ebe..5078943 100644 --- a/0009-add-support-for-feeding-user-configuration.patch +++ b/0009-add-support-for-feeding-user-configuration.patch @@ -1,7 +1,7 @@ From 197150ee2e862edcd46f7ab02c9e4d17e49ca75d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 18:03:21 +0100 -Subject: [PATCH 09/13] add support for feeding user configuration +Subject: [PATCH 09/14] add support for feeding user configuration Signed-off-by: Igor Gnatenko --- @@ -144,5 +144,5 @@ index 0d9a80b..d901e6d 100644 %description {{ pkg }} %{_description} -- -2.20.0.rc2 +2.20.1 diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch index f6ff2f4..72c5828 100644 --- a/0010-trivial-use-f-strings-everywhere.patch +++ b/0010-trivial-use-f-strings-everywhere.patch @@ -1,7 +1,7 @@ From 83ea3796cd28ec7689b39e7dc7a70bd11af1abf1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 17:00:58 +0100 -Subject: [PATCH 10/13] trivial: use f-strings everywhere +Subject: [PATCH 10/14] trivial: use f-strings everywhere Signed-off-by: Igor Gnatenko --- @@ -90,5 +90,5 @@ index c691274..b60e6c4 100644 else: with open(spec_file, "w") as fobj: -- -2.20.0.rc2 +2.20.1 diff --git a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch index ccad736..4345add 100644 --- a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch +++ b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch @@ -1,7 +1,7 @@ From 294c6f571c0f4f7ed5a4fcb34142b0d332c55f29 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sun, 11 Nov 2018 11:06:27 -0500 -Subject: [PATCH 11/13] Add option to not generate a default changelog entry +Subject: [PATCH 11/14] Add option to not generate a default changelog entry For Rust packages created through the OBS source service, the changelog is managed by an external .changes file that is @@ -59,5 +59,5 @@ index d901e6d..84bd97d 100644 + {% include target ~ "-changelog.spec.inc" %} +{% endif %} -- -2.20.0.rc2 +2.20.1 diff --git a/0012-Set-CARGO_HOME-to-the-local-.config.patch b/0012-Set-CARGO_HOME-to-the-local-.config.patch index 9f81757..ddf86d1 100644 --- a/0012-Set-CARGO_HOME-to-the-local-.config.patch +++ b/0012-Set-CARGO_HOME-to-the-local-.config.patch @@ -1,7 +1,7 @@ From b4e25038296cd57eba639a059e8baaf139a5d287 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 7 Dec 2018 13:58:41 -0800 -Subject: [PATCH 12/13] Set CARGO_HOME to the local .config +Subject: [PATCH 12/14] Set CARGO_HOME to the local .config --- data/macros.cargo | 6 +++++- @@ -22,5 +22,5 @@ index 7fb025b..e760721 100644 %__cargo_inspector %{_bindir}/cargo-inspector -- -2.20.0.rc2 +2.20.1 diff --git a/0013-Set-the-install-root-in-.cargo-config.patch b/0013-Set-the-install-root-in-.cargo-config.patch index cb106e8..baa5e3a 100644 --- a/0013-Set-the-install-root-in-.cargo-config.patch +++ b/0013-Set-the-install-root-in-.cargo-config.patch @@ -1,7 +1,7 @@ From a04e95bc4f807139bd3c4b75f46fd9a60ec1db8f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 7 Dec 2018 13:59:03 -0800 -Subject: [PATCH 13/13] Set the install root in .cargo/config +Subject: [PATCH 13/14] Set the install root in .cargo/config --- data/macros.cargo | 4 +++- @@ -30,5 +30,5 @@ index e760721..9a9ce6a 100644 %* \ }\ -- -2.20.0.rc2 +2.20.1 diff --git a/0014-Add-support-for-prerelease-versions.patch b/0014-Add-support-for-prerelease-versions.patch new file mode 100644 index 0000000..cf16439 --- /dev/null +++ b/0014-Add-support-for-prerelease-versions.patch @@ -0,0 +1,85 @@ +From 29a3c1b84e0971fc0c2edf483ae3b04139c19b32 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 26 Jan 2019 08:33:37 +0100 +Subject: [PATCH 14/14] Add support for prerelease versions + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/metadata.py | 18 ++++++++++++------ + test.py | 8 ++++++++ + 2 files changed, 20 insertions(+), 6 deletions(-) + +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index 328b67a..f0718d5 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -45,11 +45,13 @@ class Dependency: + # Any means any + continue + ver = req.spec +- if ver.prerelease: +- raise NotImplementedError(f"Pre-release requirement is not supported: {ver}") + if req.kind in (req.KIND_NEQ, req.KIND_EMPTY): + raise NotImplementedError(f"'!=' and empty kinds are not supported: {req}") +- coerced = semver.Version.coerce(str(ver)) ++ coerced = str(semver.Version.coerce(str(ver))) ++ if ver.prerelease: ++ coerced = coerced.replace("-", "~") ++ # This will advance us to closest stable version (2.0.0-beta.6 → 2.0.0) ++ ver = ver.next_patch() + if req.kind == req.KIND_EQUAL: + req.kind = req.KIND_SHORTEQ + if req.kind in (req.KIND_CARET, req.KIND_COMPATIBLE): +@@ -107,7 +109,11 @@ class Dependency: + class Metadata: + def __init__(self, name, version): + self.name = name +- self.version = version ++ self._version = version ++ version_normalized = Dependency._normalize_req(f"={self._version}") ++ if len(version_normalized) != 1: ++ raise Exception(f"Incorrect version: {self._version}") ++ self.version = version_normalized[0][1] + self.license = None + self.license_file = None + self.readme = None +@@ -187,7 +193,7 @@ class Metadata: + def provides(self, feature=None): + if feature not in self.dependencies: + raise KeyError(f"Feature {feature!r} doesn't exist") +- return Dependency(self.name, f"={self.version}", features={feature}) ++ return Dependency(self.name, f"={self._version}", features={feature}) + + @classmethod + def _resolve(cls, deps_by_feature, feature): +@@ -207,7 +213,7 @@ class Metadata: + return self._resolve(self.dependencies, feature)[1] + else: + features, deps = self.dependencies[feature] +- fdeps = set(Dependency(self.name, f"={self.version}", features={feature}) ++ fdeps = set(Dependency(self.name, f"={self._version}", features={feature}) + for feature in features) + return fdeps | deps + +diff --git a/test.py b/test.py +index 30263b4..035df79 100644 +--- a/test.py ++++ b/test.py +@@ -37,6 +37,14 @@ import rust2rpm + "crate(test) = 1.2.3"), + (">= 1.2, < 1.5", + "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"), ++ ("^2.0.0-alpha.6", ++ "(crate(test) >= 2.0.0~alpha.6 with crate(test) < 3.0.0)"), ++ ("^0.1.0-alpha.6", ++ "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0)"), ++ ("^0.0.1-alpha.6", ++ "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2)"), ++ ("^0.0.0-alpha.6", ++ "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1)"), + ]) + def test_dependency(req, rpmdep): + dep = rust2rpm.Dependency("test", req) +-- +2.20.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 5b5682d..0d97e56 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 18%{?dist} +Release: 19%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -24,6 +24,7 @@ Patch0010: 0010-trivial-use-f-strings-everywhere.patch Patch0011: 0011-Add-option-to-not-generate-a-default-changelog-entry.patch Patch0012: 0012-Set-CARGO_HOME-to-the-local-.config.patch Patch0013: 0013-Set-the-install-root-in-.cargo-config.patch +Patch0014: 0014-Add-support-for-prerelease-versions.patch ExclusiveArch: %{rust_arches} @@ -84,6 +85,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 2c9257ea1223fa871a2bdbd80a29eefde7b5fe5b Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 26 Jan 2019 10:36:39 +0100 Subject: [PATCH 36/96] Trivial fixes for pre-release versions Signed-off-by: Igor Gnatenko --- ...-Add-support-for-prerelease-versions.patch | 56 +++++++++++++++++-- rust-packaging.spec | 5 +- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/0014-Add-support-for-prerelease-versions.patch b/0014-Add-support-for-prerelease-versions.patch index cf16439..d4c48ef 100644 --- a/0014-Add-support-for-prerelease-versions.patch +++ b/0014-Add-support-for-prerelease-versions.patch @@ -1,14 +1,45 @@ -From 29a3c1b84e0971fc0c2edf483ae3b04139c19b32 Mon Sep 17 00:00:00 2001 +From 769506caf08edb5ea2342d9add22e4db1b347375 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 26 Jan 2019 08:33:37 +0100 Subject: [PATCH 14/14] Add support for prerelease versions Signed-off-by: Igor Gnatenko --- - rust2rpm/metadata.py | 18 ++++++++++++------ - test.py | 8 ++++++++ - 2 files changed, 20 insertions(+), 6 deletions(-) + data/macros.rust-srpm | 23 +++++++++++++++++++++++ + rust2rpm/metadata.py | 18 ++++++++++++------ + rust2rpm/templates/main.spec | 6 +----- + test.py | 8 ++++++++ + 4 files changed, 44 insertions(+), 11 deletions(-) +diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm +index f2bae9d..bd21cb5 100644 +--- a/data/macros.rust-srpm ++++ b/data/macros.rust-srpm +@@ -1 +1,24 @@ + %rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x ++%__crates_url https://crates.io/api/v1/crates/ ++%crates_source %{lua: ++ local crate = rpm.expand('%1') ++ local version = rpm.expand('%2') ++ local url = rpm.expand('%__crates_url') ++\ ++ if crate == '%1' then ++ crate = rpm.expand('%real_crate') ++ end ++ if crate == '%real_crate' then ++ crate = rpm.expand('%crate') ++ end ++ if crate == '%crate' then ++ crate = rpm.expand('%name') ++ end ++\ ++ if version == '%2' then ++ version = rpm.expand('%version') ++ end ++ version = version:gsub('~', '-') ++\ ++ print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate') ++} diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py index 328b67a..f0718d5 100644 --- a/rust2rpm/metadata.py @@ -61,6 +92,23 @@ index 328b67a..f0718d5 100644 for feature in features) return fdeps | deps +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 84bd97d..f67e023 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -31,11 +31,7 @@ License: {{ license|default("# FIXME") }} + {{ license_comments }} + {% endif %} + URL: https://crates.io/crates/{{ crate }} +-{% if md.name != crate %} +-Source0: https://crates.io/api/v1/crates/%{real_crate}/%{version}/download#/%{crate}-%{version}.crate +-{% else %} +-Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +-{% endif %} ++Source: %{crates_source} + {% if patch_file is not none %} + {% if target == "opensuse" %} + # PATCH-FIX-OPENSUSE {{ patch_file }} -- Initial patched metadata diff --git a/test.py b/test.py index 30263b4..035df79 100644 --- a/test.py diff --git a/rust-packaging.spec b/rust-packaging.spec index 0d97e56..2162d19 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 19%{?dist} +Release: 20%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -85,6 +85,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 6d95cfa0b0f183cb32e9a8818e582b16780a2296 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 26 Jan 2019 12:07:13 +0100 Subject: [PATCH 37/96] Use %version_no_tilde Signed-off-by: Igor Gnatenko --- ...-Add-support-for-prerelease-versions.patch | 45 +++++++++++++++---- rust-packaging.spec | 5 ++- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/0014-Add-support-for-prerelease-versions.patch b/0014-Add-support-for-prerelease-versions.patch index d4c48ef..e7ec8ef 100644 --- a/0014-Add-support-for-prerelease-versions.patch +++ b/0014-Add-support-for-prerelease-versions.patch @@ -1,24 +1,39 @@ -From 769506caf08edb5ea2342d9add22e4db1b347375 Mon Sep 17 00:00:00 2001 +From cfe4e77674ccb6e25e54a3749f4ef91b377e808f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 26 Jan 2019 08:33:37 +0100 Subject: [PATCH 14/14] Add support for prerelease versions Signed-off-by: Igor Gnatenko --- - data/macros.rust-srpm | 23 +++++++++++++++++++++++ - rust2rpm/metadata.py | 18 ++++++++++++------ - rust2rpm/templates/main.spec | 6 +----- + data/macros.rust-srpm | 38 ++++++++++++++++++++++++++++++++++++ + rust2rpm/metadata.py | 18 +++++++++++------ + rust2rpm/templates/main.spec | 10 +++------- test.py | 8 ++++++++ - 4 files changed, 44 insertions(+), 11 deletions(-) + 4 files changed, 61 insertions(+), 13 deletions(-) diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm -index f2bae9d..bd21cb5 100644 +index f2bae9d..872b87f 100644 --- a/data/macros.rust-srpm +++ b/data/macros.rust-srpm -@@ -1 +1,24 @@ +@@ -1 +1,39 @@ %rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x ++%version_no_tilde() %{lua: ++ local sep = rpm.expand('%1') ++ local ver = rpm.expand('%2') ++\ ++ if sep == '%1' then ++ sep = '-' ++ end ++\ ++ if ver == '%2' then ++ ver = rpm.expand('%version') ++ end ++ ver = ver:gsub('~', sep) ++\ ++ print(ver) ++} +%__crates_url https://crates.io/api/v1/crates/ -+%crates_source %{lua: ++%crates_source() %{lua: + local crate = rpm.expand('%1') + local version = rpm.expand('%2') + local url = rpm.expand('%__crates_url') @@ -93,7 +108,7 @@ index 328b67a..f0718d5 100644 return fdeps | deps diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 84bd97d..f67e023 100644 +index 84bd97d..1ebef7b 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -31,11 +31,7 @@ License: {{ license|default("# FIXME") }} @@ -109,6 +124,18 @@ index 84bd97d..f67e023 100644 {% if patch_file is not none %} {% if target == "opensuse" %} # PATCH-FIX-OPENSUSE {{ patch_file }} -- Initial patched metadata +@@ -161,9 +157,9 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c + + %prep + {% if md.name != crate %} +-%autosetup -n %{real_crate}-%{version} -p1 ++%autosetup -n %{real_crate}-%{version_no_tilde} -p1 + {% else %} +-%autosetup -n %{crate}-%{version} -p1 ++%autosetup -n %{crate}-%{version_no_tilde} -p1 + {% endif %} + %cargo_prep + diff --git a/test.py b/test.py index 30263b4..035df79 100644 --- a/test.py diff --git a/rust-packaging.spec b/rust-packaging.spec index 2162d19..29dc5ec 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 20%{?dist} +Release: 21%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -85,6 +85,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 17a86d1495e6c6374add1f4f72dee83b14930d2e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 2 Feb 2019 14:06:10 +0000 Subject: [PATCH 38/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 29dc5ec..374a238 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 21%{?dist} +Release: 22%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -85,6 +85,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 5955f7d37d64720aa2f2f4147085f23fcce36d95 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 10 Mar 2019 09:49:25 +0100 Subject: [PATCH 39/96] Do not pull optional deps into BRs and trivial fixes Signed-off-by: Igor Gnatenko --- ...e-spec-patch_file-by-real-crate-name.patch | 4 +- 0002-generate-doc-statements.patch | 4 +- 0003-do-better-for-renamed-crates.patch | 4 +- 0004-remove-pre-3.6-leftovers.patch | 4 +- 0005-Remove-half-downloaded-crate-on-C.patch | 4 +- ...n-error-if-s-is-used-without-a-crate.patch | 4 +- 0007-split-features-into-subpackages.patch | 4 +- ...port-for-dependencies-with-same-name.patch | 4 +- ...pport-for-feeding-user-configuration.patch | 4 +- 0010-trivial-use-f-strings-everywhere.patch | 4 +- ...t-generate-a-default-changelog-entry.patch | 4 +- ...-Set-CARGO_HOME-to-the-local-.config.patch | 4 +- ...et-the-install-root-in-.cargo-config.patch | 4 +- ...censing-fix-zlib-license-translation.patch | 35 ++++++++++ ...ename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch | 31 +++++++++ ...-Add-support-for-prerelease-versions.patch | 6 +- ...argo-doesn-t-escape-paths-with-space.patch | 31 +++++++++ 0018-Do-not-pull-optional-dependencies.patch | 66 +++++++++++++++++++ rust-packaging.spec | 12 +++- 19 files changed, 202 insertions(+), 31 deletions(-) create mode 100644 0014-licensing-fix-zlib-license-translation.patch create mode 100644 0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch rename 0014-Add-support-for-prerelease-versions.patch => 0016-Add-support-for-prerelease-versions.patch (97%) create mode 100644 0017-data-Cargo-doesn-t-escape-paths-with-space.patch create mode 100644 0018-Do-not-pull-optional-dependencies.patch diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch index 4d55717..54c5624 100644 --- a/0001-name-spec-patch_file-by-real-crate-name.patch +++ b/0001-name-spec-patch_file-by-real-crate-name.patch @@ -1,7 +1,7 @@ From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:37:40 +0200 -Subject: [PATCH 01/14] name spec/patch_file by real crate name +Subject: [PATCH 01/18] name spec/patch_file by real crate name When renaming using patch file, we really want to change file names too. @@ -33,5 +33,5 @@ index dc78828..1575ce6 100644 if args.stdout: print("# {}".format(spec_file)) -- -2.20.1 +2.21.0 diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch index 42ca40d..5264c8d 100644 --- a/0002-generate-doc-statements.patch +++ b/0002-generate-doc-statements.patch @@ -1,7 +1,7 @@ From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:40:18 +0200 -Subject: [PATCH 02/14] generate %doc statements +Subject: [PATCH 02/18] generate %doc statements Signed-off-by: Igor Gnatenko --- @@ -54,5 +54,5 @@ index 1aeb969..2e9f841 100644 {% endif %} -- -2.20.1 +2.21.0 diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch index 3f1bc98..2f72093 100644 --- a/0003-do-better-for-renamed-crates.patch +++ b/0003-do-better-for-renamed-crates.patch @@ -1,7 +1,7 @@ From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 00:06:50 +0200 -Subject: [PATCH 03/14] do better for renamed crates +Subject: [PATCH 03/18] do better for renamed crates Signed-off-by: Igor Gnatenko --- @@ -86,5 +86,5 @@ index 2e9f841..7dbcc3f 100644 %build -- -2.20.1 +2.21.0 diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch index 7133f4e..34dcf6a 100644 --- a/0004-remove-pre-3.6-leftovers.patch +++ b/0004-remove-pre-3.6-leftovers.patch @@ -1,7 +1,7 @@ From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 10:43:53 +0200 -Subject: [PATCH 04/14] remove pre-3.6 leftovers +Subject: [PATCH 04/18] remove pre-3.6 leftovers Signed-off-by: Igor Gnatenko --- @@ -23,5 +23,5 @@ index f52d968..5adeb65 100644 + "--manifest-path={}".format(path)]) return cls.from_json(json.loads(metadata)) -- -2.20.1 +2.21.0 diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch index 8ae52e4..6546060 100644 --- a/0005-Remove-half-downloaded-crate-on-C.patch +++ b/0005-Remove-half-downloaded-crate-on-C.patch @@ -1,7 +1,7 @@ From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:03:48 +0200 -Subject: [PATCH 05/14] Remove half-downloaded crate on ^C +Subject: [PATCH 05/18] Remove half-downloaded crate on ^C Subsequent invocations would fail with an error about a corrupted file. We don't have support for resuming a failed download, so let's remove the @@ -40,5 +40,5 @@ index e993e7b..8e6f6eb 100644 total=total, unit="B", unit_scale=True): f.write(chunk) -- -2.20.1 +2.21.0 diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch index 8684175..8efbc88 100644 --- a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch +++ b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch @@ -1,7 +1,7 @@ From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:18:59 +0200 -Subject: [PATCH 06/14] Throw an error if -s is used without a crate +Subject: [PATCH 06/18] Throw an error if -s is used without a crate In the future we might want to be smarter and find the crate, but let's at least not ignore the option completely. @@ -24,5 +24,5 @@ index 8e6f6eb..f23ebbc 100644 diff = make_patch(toml, enabled=patch, tmpfile=True) metadata = Metadata.from_file(toml) -- -2.20.1 +2.21.0 diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 19fd5e5..9aba559 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,7 +1,7 @@ From 2cac5e5ad5ff5472923ce333bef59679612bbaa2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 -Subject: [PATCH 07/14] split features into subpackages +Subject: [PATCH 07/18] split features into subpackages References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain Signed-off-by: Igor Gnatenko @@ -1060,5 +1060,5 @@ index b856fdd..30263b4 100644 - assert [str(x) for x in md.provides] == provides - assert [str(x) for x in md.requires] == requires -- -2.20.1 +2.21.0 diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index f6f2743..30b6c33 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,7 +1,7 @@ From a1d3a84645aa7bbe5ca07b60bead1ddf90a21cc1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 -Subject: [PATCH 08/14] add support for dependencies with same name +Subject: [PATCH 08/18] add support for dependencies with same name Reported-by: Josh Stone References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728 @@ -70,5 +70,5 @@ index 4929cdd..328b67a 100644 if "default" not in deps_by_feature: -- -2.20.1 +2.21.0 diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch index 5078943..e2abc6e 100644 --- a/0009-add-support-for-feeding-user-configuration.patch +++ b/0009-add-support-for-feeding-user-configuration.patch @@ -1,7 +1,7 @@ From 197150ee2e862edcd46f7ab02c9e4d17e49ca75d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 18:03:21 +0100 -Subject: [PATCH 09/14] add support for feeding user configuration +Subject: [PATCH 09/18] add support for feeding user configuration Signed-off-by: Igor Gnatenko --- @@ -144,5 +144,5 @@ index 0d9a80b..d901e6d 100644 %description {{ pkg }} %{_description} -- -2.20.1 +2.21.0 diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch index 72c5828..dd9436d 100644 --- a/0010-trivial-use-f-strings-everywhere.patch +++ b/0010-trivial-use-f-strings-everywhere.patch @@ -1,7 +1,7 @@ From 83ea3796cd28ec7689b39e7dc7a70bd11af1abf1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 17:00:58 +0100 -Subject: [PATCH 10/14] trivial: use f-strings everywhere +Subject: [PATCH 10/18] trivial: use f-strings everywhere Signed-off-by: Igor Gnatenko --- @@ -90,5 +90,5 @@ index c691274..b60e6c4 100644 else: with open(spec_file, "w") as fobj: -- -2.20.1 +2.21.0 diff --git a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch index 4345add..c03faa6 100644 --- a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch +++ b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch @@ -1,7 +1,7 @@ From 294c6f571c0f4f7ed5a4fcb34142b0d332c55f29 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sun, 11 Nov 2018 11:06:27 -0500 -Subject: [PATCH 11/14] Add option to not generate a default changelog entry +Subject: [PATCH 11/18] Add option to not generate a default changelog entry For Rust packages created through the OBS source service, the changelog is managed by an external .changes file that is @@ -59,5 +59,5 @@ index d901e6d..84bd97d 100644 + {% include target ~ "-changelog.spec.inc" %} +{% endif %} -- -2.20.1 +2.21.0 diff --git a/0012-Set-CARGO_HOME-to-the-local-.config.patch b/0012-Set-CARGO_HOME-to-the-local-.config.patch index ddf86d1..a8e5ea1 100644 --- a/0012-Set-CARGO_HOME-to-the-local-.config.patch +++ b/0012-Set-CARGO_HOME-to-the-local-.config.patch @@ -1,7 +1,7 @@ From b4e25038296cd57eba639a059e8baaf139a5d287 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 7 Dec 2018 13:58:41 -0800 -Subject: [PATCH 12/14] Set CARGO_HOME to the local .config +Subject: [PATCH 12/18] Set CARGO_HOME to the local .config --- data/macros.cargo | 6 +++++- @@ -22,5 +22,5 @@ index 7fb025b..e760721 100644 %__cargo_inspector %{_bindir}/cargo-inspector -- -2.20.1 +2.21.0 diff --git a/0013-Set-the-install-root-in-.cargo-config.patch b/0013-Set-the-install-root-in-.cargo-config.patch index baa5e3a..e2ef86e 100644 --- a/0013-Set-the-install-root-in-.cargo-config.patch +++ b/0013-Set-the-install-root-in-.cargo-config.patch @@ -1,7 +1,7 @@ From a04e95bc4f807139bd3c4b75f46fd9a60ec1db8f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 7 Dec 2018 13:59:03 -0800 -Subject: [PATCH 13/14] Set the install root in .cargo/config +Subject: [PATCH 13/18] Set the install root in .cargo/config --- data/macros.cargo | 4 +++- @@ -30,5 +30,5 @@ index e760721..9a9ce6a 100644 %* \ }\ -- -2.20.1 +2.21.0 diff --git a/0014-licensing-fix-zlib-license-translation.patch b/0014-licensing-fix-zlib-license-translation.patch new file mode 100644 index 0000000..fc8a165 --- /dev/null +++ b/0014-licensing-fix-zlib-license-translation.patch @@ -0,0 +1,35 @@ +From 7c00b0f29085166b1a89aec766945b10dc7aca23 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sat, 1 Dec 2018 15:40:08 +0100 +Subject: [PATCH 14/18] licensing: fix zlib license translation + +The file was mangled, and something about "teeworlds" was inserted +into the line for zlib. The spdx database doesn't list "teeworlds +license", so let's just remove that part. +Both [1] and [2] agree that "zlib" and "zlib license" are the same thing. + +[1] https://spdx.org/licenses/Zlib +[2] https://fedoraproject.org/wiki/Licensing:Main#Good_Licenses + +Fixes #61. +--- + rust2rpm/spdx_to_fedora.csv | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv +index 829571a..1ca5a7e 100644 +--- a/rust2rpm/spdx_to_fedora.csv ++++ b/rust2rpm/spdx_to_fedora.csv +@@ -306,8 +306,7 @@ Zed License,Zed,Zed,,, + Zend License v2.0,Zend-2.0,Zend,,, + Zimbra Public License v1.3,Zimbra-1.3,,,Fedora bad list, + Zimbra Public License v1.4,Zimbra-1.4,,,not on Fedora list, +-zlib License,Zlib,"zlib +-Teeworlds",,,Teeworlds License ++zlib License,Zlib,zlib,,, + zlib/libpng License with Acknowledgement,zlib-acknowledgement,zlib with acknowledgement,,, + Zope Public License 1.1,ZPL-1.1,,,This specific version not on Fedora list, + Zope Public License 2.0,ZPL-2.0,ZPLv2.0,,, +-- +2.21.0 + diff --git a/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch b/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch new file mode 100644 index 0000000..76be3f8 --- /dev/null +++ b/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch @@ -0,0 +1,31 @@ +From b0d2756917b380a5d66d2407dbeb8891c51875e8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sat, 1 Dec 2018 15:46:08 +0100 +Subject: [PATCH 15/18] licensing: rename EPL to EPL-1.0 and add EPL-2.0 + +According to https://fedoraproject.org/wiki/Licensing:Main#Software_License_List +EPL-1.0 and EPL-2.0 are the short tags that should be used now. +(C.f. https://spdx.org/licenses/EPL-2.0.html.) + +Fixes #64. +--- + rust2rpm/spdx_to_fedora.csv | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv +index 1ca5a7e..c42e66e 100644 +--- a/rust2rpm/spdx_to_fedora.csv ++++ b/rust2rpm/spdx_to_fedora.csv +@@ -112,7 +112,8 @@ DOC License,DOC,DOC,,, + Dotseqn License,Dotseqn,Dotseqn,,, + DSDP License,DSDP,DSDP,,, + dvipdfm License,dvipdfm,dvipdfm,,, +-Eclipse Public License 1.0,EPL-1.0,EPL,,, ++Eclipse Public License 1.0,EPL-1.0,EPL-1.0,,, ++Eclipse Public License 2.0,EPL-2.0,EPL-2.0,,, + Educational Community License v1.0,ECL-1.0,ECL 1.0,,, + Educational Community License v2.0,ECL-2.0,ECL 2.0,,, + eGenix.com Public License 1.1.0,eGenix,eGenix,,, +-- +2.21.0 + diff --git a/0014-Add-support-for-prerelease-versions.patch b/0016-Add-support-for-prerelease-versions.patch similarity index 97% rename from 0014-Add-support-for-prerelease-versions.patch rename to 0016-Add-support-for-prerelease-versions.patch index e7ec8ef..187a47d 100644 --- a/0014-Add-support-for-prerelease-versions.patch +++ b/0016-Add-support-for-prerelease-versions.patch @@ -1,7 +1,7 @@ -From cfe4e77674ccb6e25e54a3749f4ef91b377e808f Mon Sep 17 00:00:00 2001 +From 00c0c5cec90d5d6abbfd4acb2f5d65439b4bfd27 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 26 Jan 2019 08:33:37 +0100 -Subject: [PATCH 14/14] Add support for prerelease versions +Subject: [PATCH 16/18] Add support for prerelease versions Signed-off-by: Igor Gnatenko --- @@ -156,5 +156,5 @@ index 30263b4..035df79 100644 def test_dependency(req, rpmdep): dep = rust2rpm.Dependency("test", req) -- -2.20.1 +2.21.0 diff --git a/0017-data-Cargo-doesn-t-escape-paths-with-space.patch b/0017-data-Cargo-doesn-t-escape-paths-with-space.patch new file mode 100644 index 0000000..90dadeb --- /dev/null +++ b/0017-data-Cargo-doesn-t-escape-paths-with-space.patch @@ -0,0 +1,31 @@ +From 84a73bfa24ce11602a1f19554dc495125be4d0aa Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sun, 17 Feb 2019 17:19:25 +0100 +Subject: [PATCH 17/18] data: Cargo doesn't escape paths with space + +When building matrixmultiply v0.2.2: + +BUILDSTDERR: /usr/bin/cp: cannot stat 'spare': No such file or directory +BUILDSTDERR: /usr/bin/cp: failed to get attributes of 'kernels': No such file or directory + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 9a9ce6a..9a375d0 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -74,7 +74,7 @@ if %__cargo_is_lib; then \ + CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ + REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ + %{__mkdir} -p $REG_DIR \ +- %{__cargo} package -l | xargs %{__cp} --parents -a -t $REG_DIR \ ++ %{__cargo} package -l | xargs -d '\n' %{__cp} --parents -a -t $REG_DIR \ + %if ! %{with check} \ + %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ + %endif \ +-- +2.21.0 + diff --git a/0018-Do-not-pull-optional-dependencies.patch b/0018-Do-not-pull-optional-dependencies.patch new file mode 100644 index 0000000..68f2a8c --- /dev/null +++ b/0018-Do-not-pull-optional-dependencies.patch @@ -0,0 +1,66 @@ +From b0f34c2b6a7b8ca5b924e5c230f1271826114cb0 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 9 Mar 2019 22:04:49 +0100 +Subject: [PATCH 18/18] Do not pull optional dependencies + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 13 +++++++++++-- + rust2rpm/templates/main.spec | 5 ----- + 2 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 9a375d0..0e382c8 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -2,8 +2,10 @@ + # https://github.com/rust-lang/cargo/issues/6397 + # But we can set CARGO_HOME locally, which is a good idea anyway to make sure + # it never writes to ~/.cargo during rpmbuild. +-%__cargo %{_bindir}/env CARGO_HOME=.cargo %{_bindir}/cargo +-%__cargo_common_opts %{?_smp_mflags} ++# We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps ++# until it gets stabilized: https://github.com/rust-lang/cargo/issues/5133 ++%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo ++%__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps + %__cargo_inspector %{_bindir}/cargo-inspector + + %cargo_registry %{_datadir}/cargo/registry +@@ -74,10 +76,17 @@ if %__cargo_is_lib; then \ + CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ + REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ + %{__mkdir} -p $REG_DIR \ ++# Drop all dependency/features information \ ++# so that cargo doesn't fail resolving dependencies: \ ++# https://github.com/rust-lang/cargo/pull/6729 \ ++ %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((dev-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ + %{__cargo} package -l | xargs -d '\n' %{__cp} --parents -a -t $REG_DIR \ + %if ! %{with check} \ + %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ ++%else \ ++ %{__cp} -a Cargo.toml.deps $REG_DIR/Cargo.toml \ + %endif \ ++ %{__rm} $REG_DIR/Cargo.toml.{orig,deps} \ + echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ + fi \ + if %__cargo_is_bin; then \ +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 1ebef7b..f0c5445 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -44,12 +44,7 @@ Patch0: {{ patch_file }} + ExclusiveArch: %{rust_arches} + + BuildRequires: rust-packaging +-{# We will put all non-optional and optional dependencies until +- https://github.com/rust-lang/cargo/issues/5133 +- is solved + {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} +-#} +-{% set buildrequires = normalize_deps(md.all_dependencies)|sort %} + {% for req in buildrequires %} + BuildRequires: {{ req }} + {% endfor %} +-- +2.21.0 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 374a238..3f2294c 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 22%{?dist} +Release: 23%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -24,7 +24,12 @@ Patch0010: 0010-trivial-use-f-strings-everywhere.patch Patch0011: 0011-Add-option-to-not-generate-a-default-changelog-entry.patch Patch0012: 0012-Set-CARGO_HOME-to-the-local-.config.patch Patch0013: 0013-Set-the-install-root-in-.cargo-config.patch -Patch0014: 0014-Add-support-for-prerelease-versions.patch +Patch0014: 0014-licensing-fix-zlib-license-translation.patch +Patch0015: 0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch +Patch0016: 0016-Add-support-for-prerelease-versions.patch +Patch0017: 0017-data-Cargo-doesn-t-escape-paths-with-space.patch +# https://pagure.io/fedora-rust/rust2rpm/pull-request/68 +Patch0018: 0018-Do-not-pull-optional-dependencies.patch ExclusiveArch: %{rust_arches} @@ -85,6 +90,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 60f3d8f016932795e43c88d70d9bb7d733da9a92 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 10 Mar 2019 10:16:51 +0100 Subject: [PATCH 40/96] Escape `\n` properly in macro file Signed-off-by: Igor Gnatenko --- ...e-spec-patch_file-by-real-crate-name.patch | 2 +- 0002-generate-doc-statements.patch | 2 +- 0003-do-better-for-renamed-crates.patch | 2 +- 0004-remove-pre-3.6-leftovers.patch | 2 +- 0005-Remove-half-downloaded-crate-on-C.patch | 2 +- ...n-error-if-s-is-used-without-a-crate.patch | 2 +- 0007-split-features-into-subpackages.patch | 2 +- ...port-for-dependencies-with-same-name.patch | 2 +- ...pport-for-feeding-user-configuration.patch | 2 +- 0010-trivial-use-f-strings-everywhere.patch | 2 +- ...t-generate-a-default-changelog-entry.patch | 2 +- ...-Set-CARGO_HOME-to-the-local-.config.patch | 2 +- ...et-the-install-root-in-.cargo-config.patch | 2 +- ...censing-fix-zlib-license-translation.patch | 2 +- ...ename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch | 2 +- ...-Add-support-for-prerelease-versions.patch | 2 +- ...argo-doesn-t-escape-paths-with-space.patch | 2 +- 0018-data-Escape-n-properly.patch | 26 +++++++++++++++++++ ...19-Do-not-pull-optional-dependencies.patch | 8 +++--- rust-packaging.spec | 10 ++++--- 20 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 0018-data-Escape-n-properly.patch rename 0018-Do-not-pull-optional-dependencies.patch => 0019-Do-not-pull-optional-dependencies.patch (92%) diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch index 54c5624..d8df04a 100644 --- a/0001-name-spec-patch_file-by-real-crate-name.patch +++ b/0001-name-spec-patch_file-by-real-crate-name.patch @@ -1,7 +1,7 @@ From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:37:40 +0200 -Subject: [PATCH 01/18] name spec/patch_file by real crate name +Subject: [PATCH 01/19] name spec/patch_file by real crate name When renaming using patch file, we really want to change file names too. diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch index 5264c8d..7d5550b 100644 --- a/0002-generate-doc-statements.patch +++ b/0002-generate-doc-statements.patch @@ -1,7 +1,7 @@ From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:40:18 +0200 -Subject: [PATCH 02/18] generate %doc statements +Subject: [PATCH 02/19] generate %doc statements Signed-off-by: Igor Gnatenko --- diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch index 2f72093..97d5815 100644 --- a/0003-do-better-for-renamed-crates.patch +++ b/0003-do-better-for-renamed-crates.patch @@ -1,7 +1,7 @@ From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 00:06:50 +0200 -Subject: [PATCH 03/18] do better for renamed crates +Subject: [PATCH 03/19] do better for renamed crates Signed-off-by: Igor Gnatenko --- diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch index 34dcf6a..017fb26 100644 --- a/0004-remove-pre-3.6-leftovers.patch +++ b/0004-remove-pre-3.6-leftovers.patch @@ -1,7 +1,7 @@ From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 11 Sep 2018 10:43:53 +0200 -Subject: [PATCH 04/18] remove pre-3.6 leftovers +Subject: [PATCH 04/19] remove pre-3.6 leftovers Signed-off-by: Igor Gnatenko --- diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch index 6546060..033815b 100644 --- a/0005-Remove-half-downloaded-crate-on-C.patch +++ b/0005-Remove-half-downloaded-crate-on-C.patch @@ -1,7 +1,7 @@ From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:03:48 +0200 -Subject: [PATCH 05/18] Remove half-downloaded crate on ^C +Subject: [PATCH 05/19] Remove half-downloaded crate on ^C Subsequent invocations would fail with an error about a corrupted file. We don't have support for resuming a failed download, so let's remove the diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch index 8efbc88..861d233 100644 --- a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch +++ b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch @@ -1,7 +1,7 @@ From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 17 Aug 2018 10:18:59 +0200 -Subject: [PATCH 06/18] Throw an error if -s is used without a crate +Subject: [PATCH 06/19] Throw an error if -s is used without a crate In the future we might want to be smarter and find the crate, but let's at least not ignore the option completely. diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch index 9aba559..acf5911 100644 --- a/0007-split-features-into-subpackages.patch +++ b/0007-split-features-into-subpackages.patch @@ -1,7 +1,7 @@ From 2cac5e5ad5ff5472923ce333bef59679612bbaa2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 26 Oct 2018 11:20:13 +0200 -Subject: [PATCH 07/18] split features into subpackages +Subject: [PATCH 07/19] split features into subpackages References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain Signed-off-by: Igor Gnatenko diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch index 30b6c33..5412d76 100644 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ b/0008-add-support-for-dependencies-with-same-name.patch @@ -1,7 +1,7 @@ From a1d3a84645aa7bbe5ca07b60bead1ddf90a21cc1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 30 Oct 2018 20:37:38 +0100 -Subject: [PATCH 08/18] add support for dependencies with same name +Subject: [PATCH 08/19] add support for dependencies with same name Reported-by: Josh Stone References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728 diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch index e2abc6e..8985513 100644 --- a/0009-add-support-for-feeding-user-configuration.patch +++ b/0009-add-support-for-feeding-user-configuration.patch @@ -1,7 +1,7 @@ From 197150ee2e862edcd46f7ab02c9e4d17e49ca75d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 18:03:21 +0100 -Subject: [PATCH 09/18] add support for feeding user configuration +Subject: [PATCH 09/19] add support for feeding user configuration Signed-off-by: Igor Gnatenko --- diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch index dd9436d..c98be77 100644 --- a/0010-trivial-use-f-strings-everywhere.patch +++ b/0010-trivial-use-f-strings-everywhere.patch @@ -1,7 +1,7 @@ From 83ea3796cd28ec7689b39e7dc7a70bd11af1abf1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 31 Oct 2018 17:00:58 +0100 -Subject: [PATCH 10/18] trivial: use f-strings everywhere +Subject: [PATCH 10/19] trivial: use f-strings everywhere Signed-off-by: Igor Gnatenko --- diff --git a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch index c03faa6..8457b4a 100644 --- a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch +++ b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch @@ -1,7 +1,7 @@ From 294c6f571c0f4f7ed5a4fcb34142b0d332c55f29 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sun, 11 Nov 2018 11:06:27 -0500 -Subject: [PATCH 11/18] Add option to not generate a default changelog entry +Subject: [PATCH 11/19] Add option to not generate a default changelog entry For Rust packages created through the OBS source service, the changelog is managed by an external .changes file that is diff --git a/0012-Set-CARGO_HOME-to-the-local-.config.patch b/0012-Set-CARGO_HOME-to-the-local-.config.patch index a8e5ea1..e9e37de 100644 --- a/0012-Set-CARGO_HOME-to-the-local-.config.patch +++ b/0012-Set-CARGO_HOME-to-the-local-.config.patch @@ -1,7 +1,7 @@ From b4e25038296cd57eba639a059e8baaf139a5d287 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 7 Dec 2018 13:58:41 -0800 -Subject: [PATCH 12/18] Set CARGO_HOME to the local .config +Subject: [PATCH 12/19] Set CARGO_HOME to the local .config --- data/macros.cargo | 6 +++++- diff --git a/0013-Set-the-install-root-in-.cargo-config.patch b/0013-Set-the-install-root-in-.cargo-config.patch index e2ef86e..0b97943 100644 --- a/0013-Set-the-install-root-in-.cargo-config.patch +++ b/0013-Set-the-install-root-in-.cargo-config.patch @@ -1,7 +1,7 @@ From a04e95bc4f807139bd3c4b75f46fd9a60ec1db8f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 7 Dec 2018 13:59:03 -0800 -Subject: [PATCH 13/18] Set the install root in .cargo/config +Subject: [PATCH 13/19] Set the install root in .cargo/config --- data/macros.cargo | 4 +++- diff --git a/0014-licensing-fix-zlib-license-translation.patch b/0014-licensing-fix-zlib-license-translation.patch index fc8a165..a04f0db 100644 --- a/0014-licensing-fix-zlib-license-translation.patch +++ b/0014-licensing-fix-zlib-license-translation.patch @@ -1,7 +1,7 @@ From 7c00b0f29085166b1a89aec766945b10dc7aca23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 1 Dec 2018 15:40:08 +0100 -Subject: [PATCH 14/18] licensing: fix zlib license translation +Subject: [PATCH 14/19] licensing: fix zlib license translation The file was mangled, and something about "teeworlds" was inserted into the line for zlib. The spdx database doesn't list "teeworlds diff --git a/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch b/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch index 76be3f8..ffe83aa 100644 --- a/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch +++ b/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch @@ -1,7 +1,7 @@ From b0d2756917b380a5d66d2407dbeb8891c51875e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 1 Dec 2018 15:46:08 +0100 -Subject: [PATCH 15/18] licensing: rename EPL to EPL-1.0 and add EPL-2.0 +Subject: [PATCH 15/19] licensing: rename EPL to EPL-1.0 and add EPL-2.0 According to https://fedoraproject.org/wiki/Licensing:Main#Software_License_List EPL-1.0 and EPL-2.0 are the short tags that should be used now. diff --git a/0016-Add-support-for-prerelease-versions.patch b/0016-Add-support-for-prerelease-versions.patch index 187a47d..cbffd10 100644 --- a/0016-Add-support-for-prerelease-versions.patch +++ b/0016-Add-support-for-prerelease-versions.patch @@ -1,7 +1,7 @@ From 00c0c5cec90d5d6abbfd4acb2f5d65439b4bfd27 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 26 Jan 2019 08:33:37 +0100 -Subject: [PATCH 16/18] Add support for prerelease versions +Subject: [PATCH 16/19] Add support for prerelease versions Signed-off-by: Igor Gnatenko --- diff --git a/0017-data-Cargo-doesn-t-escape-paths-with-space.patch b/0017-data-Cargo-doesn-t-escape-paths-with-space.patch index 90dadeb..0d031b0 100644 --- a/0017-data-Cargo-doesn-t-escape-paths-with-space.patch +++ b/0017-data-Cargo-doesn-t-escape-paths-with-space.patch @@ -1,7 +1,7 @@ From 84a73bfa24ce11602a1f19554dc495125be4d0aa Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 17 Feb 2019 17:19:25 +0100 -Subject: [PATCH 17/18] data: Cargo doesn't escape paths with space +Subject: [PATCH 17/19] data: Cargo doesn't escape paths with space When building matrixmultiply v0.2.2: diff --git a/0018-data-Escape-n-properly.patch b/0018-data-Escape-n-properly.patch new file mode 100644 index 0000000..c9bffdf --- /dev/null +++ b/0018-data-Escape-n-properly.patch @@ -0,0 +1,26 @@ +From 7f0a499ff3fca046869ab754151ae068903c4ab9 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sun, 10 Mar 2019 10:14:28 +0100 +Subject: [PATCH 18/19] data: Escape `\n` properly + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 9a375d0..96dc354 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -74,7 +74,7 @@ if %__cargo_is_lib; then \ + CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ + REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ + %{__mkdir} -p $REG_DIR \ +- %{__cargo} package -l | xargs -d '\n' %{__cp} --parents -a -t $REG_DIR \ ++ %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ + %if ! %{with check} \ + %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ + %endif \ +-- +2.21.0 + diff --git a/0018-Do-not-pull-optional-dependencies.patch b/0019-Do-not-pull-optional-dependencies.patch similarity index 92% rename from 0018-Do-not-pull-optional-dependencies.patch rename to 0019-Do-not-pull-optional-dependencies.patch index 68f2a8c..363fdc4 100644 --- a/0018-Do-not-pull-optional-dependencies.patch +++ b/0019-Do-not-pull-optional-dependencies.patch @@ -1,7 +1,7 @@ -From b0f34c2b6a7b8ca5b924e5c230f1271826114cb0 Mon Sep 17 00:00:00 2001 +From ccc7ed42c168675efc4b9719dad12800b92450d5 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 9 Mar 2019 22:04:49 +0100 -Subject: [PATCH 18/18] Do not pull optional dependencies +Subject: [PATCH 19/19] Do not pull optional dependencies Signed-off-by: Igor Gnatenko --- @@ -10,7 +10,7 @@ Signed-off-by: Igor Gnatenko 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/data/macros.cargo b/data/macros.cargo -index 9a375d0..0e382c8 100644 +index 96dc354..4e8f0c9 100644 --- a/data/macros.cargo +++ b/data/macros.cargo @@ -2,8 +2,10 @@ @@ -34,7 +34,7 @@ index 9a375d0..0e382c8 100644 +# so that cargo doesn't fail resolving dependencies: \ +# https://github.com/rust-lang/cargo/pull/6729 \ + %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((dev-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ - %{__cargo} package -l | xargs -d '\n' %{__cp} --parents -a -t $REG_DIR \ + %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ %if ! %{with check} \ %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ +%else \ diff --git a/rust-packaging.spec b/rust-packaging.spec index 3f2294c..80e49bc 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 23%{?dist} +Release: 24%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -28,8 +28,9 @@ Patch0014: 0014-licensing-fix-zlib-license-translation.patch Patch0015: 0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch Patch0016: 0016-Add-support-for-prerelease-versions.patch Patch0017: 0017-data-Cargo-doesn-t-escape-paths-with-space.patch -# https://pagure.io/fedora-rust/rust2rpm/pull-request/68 -Patch0018: 0018-Do-not-pull-optional-dependencies.patch +Patch0018: 0018-data-Escape-n-properly.patch +# https://pagure.io/fedora-rust/rust2rpm/pull-request/68 +Patch0019: 0019-Do-not-pull-optional-dependencies.patch ExclusiveArch: %{rust_arches} @@ -90,6 +91,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From e9a1f98b3d12d3661a330dc1ff11a1593f8a594e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 10 Mar 2019 10:42:12 +0100 Subject: [PATCH 41/96] Do not error on removing files which do not exist Signed-off-by: Igor Gnatenko --- 0019-Do-not-pull-optional-dependencies.patch | 6 +++--- rust-packaging.spec | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/0019-Do-not-pull-optional-dependencies.patch b/0019-Do-not-pull-optional-dependencies.patch index 363fdc4..0d746e6 100644 --- a/0019-Do-not-pull-optional-dependencies.patch +++ b/0019-Do-not-pull-optional-dependencies.patch @@ -1,4 +1,4 @@ -From ccc7ed42c168675efc4b9719dad12800b92450d5 Mon Sep 17 00:00:00 2001 +From 5fbb0558d401c26f04e274b6b1fc5b0ed9d6e4cd Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 9 Mar 2019 22:04:49 +0100 Subject: [PATCH 19/19] Do not pull optional dependencies @@ -10,7 +10,7 @@ Signed-off-by: Igor Gnatenko 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/data/macros.cargo b/data/macros.cargo -index 96dc354..4e8f0c9 100644 +index 96dc354..a816578 100644 --- a/data/macros.cargo +++ b/data/macros.cargo @@ -2,8 +2,10 @@ @@ -40,7 +40,7 @@ index 96dc354..4e8f0c9 100644 +%else \ + %{__cp} -a Cargo.toml.deps $REG_DIR/Cargo.toml \ %endif \ -+ %{__rm} $REG_DIR/Cargo.toml.{orig,deps} \ ++ %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \ echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ fi \ if %__cargo_is_bin; then \ diff --git a/rust-packaging.spec b/rust-packaging.spec index 80e49bc..2418d1d 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 24%{?dist} +Release: 25%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -91,6 +91,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 2736dc0ce240753e28a3a2d5092925317eb8b5fe Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 10 Mar 2019 20:12:00 +0100 Subject: [PATCH 42/96] Strip out target dependencies too Signed-off-by: Igor Gnatenko --- 0019-Do-not-pull-optional-dependencies.patch | 6 +++--- rust-packaging.spec | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/0019-Do-not-pull-optional-dependencies.patch b/0019-Do-not-pull-optional-dependencies.patch index 0d746e6..80d715a 100644 --- a/0019-Do-not-pull-optional-dependencies.patch +++ b/0019-Do-not-pull-optional-dependencies.patch @@ -1,4 +1,4 @@ -From 5fbb0558d401c26f04e274b6b1fc5b0ed9d6e4cd Mon Sep 17 00:00:00 2001 +From 72d9afecc6da319e1d59170f07a7b78afbbb1a68 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 9 Mar 2019 22:04:49 +0100 Subject: [PATCH 19/19] Do not pull optional dependencies @@ -10,7 +10,7 @@ Signed-off-by: Igor Gnatenko 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/data/macros.cargo b/data/macros.cargo -index 96dc354..a816578 100644 +index 96dc354..b1a2e0b 100644 --- a/data/macros.cargo +++ b/data/macros.cargo @@ -2,8 +2,10 @@ @@ -33,7 +33,7 @@ index 96dc354..a816578 100644 +# Drop all dependency/features information \ +# so that cargo doesn't fail resolving dependencies: \ +# https://github.com/rust-lang/cargo/pull/6729 \ -+ %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((dev-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ ++ %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ %if ! %{with check} \ %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ diff --git a/rust-packaging.spec b/rust-packaging.spec index 2418d1d..f315a93 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 25%{?dist} +Release: 26%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -91,6 +91,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 56c2dbcef5aaf80855873b67964e94c48d137df3 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 10 Mar 2019 23:34:05 +0100 Subject: [PATCH 43/96] Restore Cargo.toml.deps into $PWD/Cargo.toml Signed-off-by: Igor Gnatenko --- 0019-Do-not-pull-optional-dependencies.patch | 33 +++++++++++++------- rust-packaging.spec | 5 ++- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/0019-Do-not-pull-optional-dependencies.patch b/0019-Do-not-pull-optional-dependencies.patch index 80d715a..5b8a70e 100644 --- a/0019-Do-not-pull-optional-dependencies.patch +++ b/0019-Do-not-pull-optional-dependencies.patch @@ -1,16 +1,16 @@ -From 72d9afecc6da319e1d59170f07a7b78afbbb1a68 Mon Sep 17 00:00:00 2001 +From 643bf0d32982b67854a39586244b25f54518de02 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 9 Mar 2019 22:04:49 +0100 Subject: [PATCH 19/19] Do not pull optional dependencies Signed-off-by: Igor Gnatenko --- - data/macros.cargo | 13 +++++++++++-- + data/macros.cargo | 20 +++++++++++--------- rust2rpm/templates/main.spec | 5 ----- - 2 files changed, 11 insertions(+), 7 deletions(-) + 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/data/macros.cargo b/data/macros.cargo -index 96dc354..b1a2e0b 100644 +index 96dc354..f950e79 100644 --- a/data/macros.cargo +++ b/data/macros.cargo @@ -2,8 +2,10 @@ @@ -26,7 +26,18 @@ index 96dc354..b1a2e0b 100644 %__cargo_inspector %{_bindir}/cargo-inspector %cargo_registry %{_datadir}/cargo/registry -@@ -74,10 +76,17 @@ if %__cargo_is_lib; then \ +@@ -36,10 +38,6 @@ registry = "https://crates.io"\ + replace-with = "local-registry"\ + EOF\ + %{__rm} -f Cargo.lock \ +-%if ! %{with check} \ +-# https://github.com/rust-lang/cargo/issues/3732 \ +-%{__awk} -i inplace -v INPLACE_SUFFIX=.orig '/^\\\[dev-dependencies/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ +-%endif \ + ) + + %__cargo_parse_opts(naf:) %{shrink:\ +@@ -74,10 +72,14 @@ if %__cargo_is_lib; then \ CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ %{__mkdir} -p $REG_DIR \ @@ -35,12 +46,12 @@ index 96dc354..b1a2e0b 100644 +# https://github.com/rust-lang/cargo/pull/6729 \ + %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ - %if ! %{with check} \ - %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ -+%else \ -+ %{__cp} -a Cargo.toml.deps $REG_DIR/Cargo.toml \ - %endif \ -+ %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \ +-%if ! %{with check} \ +- %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ +-%endif \ ++ %{__mv} Cargo.toml{.deps,} \ ++ %{__mv} $REG_DIR/Cargo.toml{.deps,} \ ++ %{__rm} -f $REG_DIR/Cargo.toml.orig \ echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ fi \ if %__cargo_is_bin; then \ diff --git a/rust-packaging.spec b/rust-packaging.spec index f315a93..0ea39e1 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 26%{?dist} +Release: 27%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -91,6 +91,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 9d3869c3408529507f7902b2b2903f0de9edf4a3 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 11 Mar 2019 00:09:20 +0100 Subject: [PATCH 44/96] Install $PWD/Cargo.toml into $REG_DIR/Cargo.toml For things which are just including files, deps one doesn't get installed into the registry. Signed-off-by: Igor Gnatenko --- 0019-Do-not-pull-optional-dependencies.patch | 6 +++--- rust-packaging.spec | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/0019-Do-not-pull-optional-dependencies.patch b/0019-Do-not-pull-optional-dependencies.patch index 5b8a70e..814c920 100644 --- a/0019-Do-not-pull-optional-dependencies.patch +++ b/0019-Do-not-pull-optional-dependencies.patch @@ -1,4 +1,4 @@ -From 643bf0d32982b67854a39586244b25f54518de02 Mon Sep 17 00:00:00 2001 +From 604938a8bab778c58333643c3e069533327699e2 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 9 Mar 2019 22:04:49 +0100 Subject: [PATCH 19/19] Do not pull optional dependencies @@ -10,7 +10,7 @@ Signed-off-by: Igor Gnatenko 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/data/macros.cargo b/data/macros.cargo -index 96dc354..f950e79 100644 +index 96dc354..999d787 100644 --- a/data/macros.cargo +++ b/data/macros.cargo @@ -2,8 +2,10 @@ @@ -50,7 +50,7 @@ index 96dc354..f950e79 100644 - %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ -%endif \ + %{__mv} Cargo.toml{.deps,} \ -+ %{__mv} $REG_DIR/Cargo.toml{.deps,} \ ++ %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \ + %{__rm} -f $REG_DIR/Cargo.toml.orig \ echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ fi \ diff --git a/rust-packaging.spec b/rust-packaging.spec index 0ea39e1..7412fdf 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 6 -Release: 27%{?dist} +Release: 28%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -91,6 +91,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 1b37f08c707d7f52a93555b56e31303a81e2684f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 23 Apr 2019 16:18:29 +0200 Subject: [PATCH 45/96] Update to 7 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + ...e-spec-patch_file-by-real-crate-name.patch | 37 - 0002-generate-doc-statements.patch | 58 - 0003-do-better-for-renamed-crates.patch | 90 -- 0004-remove-pre-3.6-leftovers.patch | 27 - 0005-Remove-half-downloaded-crate-on-C.patch | 44 - ...n-error-if-s-is-used-without-a-crate.patch | 28 - 0007-split-features-into-subpackages.patch | 1064 ----------------- ...port-for-dependencies-with-same-name.patch | 74 -- ...pport-for-feeding-user-configuration.patch | 148 --- 0010-trivial-use-f-strings-everywhere.patch | 94 -- ...t-generate-a-default-changelog-entry.patch | 63 - ...-Set-CARGO_HOME-to-the-local-.config.patch | 26 - ...et-the-install-root-in-.cargo-config.patch | 34 - ...censing-fix-zlib-license-translation.patch | 35 - ...ename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch | 31 - ...-Add-support-for-prerelease-versions.patch | 160 --- ...argo-doesn-t-escape-paths-with-space.patch | 31 - 0018-data-Escape-n-properly.patch | 26 - 0019-Do-not-pull-optional-dependencies.patch | 77 -- rust-packaging.spec | 28 +- sources | 2 +- 22 files changed, 7 insertions(+), 2171 deletions(-) delete mode 100644 0001-name-spec-patch_file-by-real-crate-name.patch delete mode 100644 0002-generate-doc-statements.patch delete mode 100644 0003-do-better-for-renamed-crates.patch delete mode 100644 0004-remove-pre-3.6-leftovers.patch delete mode 100644 0005-Remove-half-downloaded-crate-on-C.patch delete mode 100644 0006-Throw-an-error-if-s-is-used-without-a-crate.patch delete mode 100644 0007-split-features-into-subpackages.patch delete mode 100644 0008-add-support-for-dependencies-with-same-name.patch delete mode 100644 0009-add-support-for-feeding-user-configuration.patch delete mode 100644 0010-trivial-use-f-strings-everywhere.patch delete mode 100644 0011-Add-option-to-not-generate-a-default-changelog-entry.patch delete mode 100644 0012-Set-CARGO_HOME-to-the-local-.config.patch delete mode 100644 0013-Set-the-install-root-in-.cargo-config.patch delete mode 100644 0014-licensing-fix-zlib-license-translation.patch delete mode 100644 0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch delete mode 100644 0016-Add-support-for-prerelease-versions.patch delete mode 100644 0017-data-Cargo-doesn-t-escape-paths-with-space.patch delete mode 100644 0018-data-Escape-n-properly.patch delete mode 100644 0019-Do-not-pull-optional-dependencies.patch diff --git a/.gitignore b/.gitignore index 388ca95..aa71c2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /rust2rpm-4.tar.xz /rust2rpm-5.tar.xz /rust2rpm-6.tar.xz +/rust2rpm-7.tar.xz diff --git a/0001-name-spec-patch_file-by-real-crate-name.patch b/0001-name-spec-patch_file-by-real-crate-name.patch deleted file mode 100644 index d8df04a..0000000 --- a/0001-name-spec-patch_file-by-real-crate-name.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0dc9fc182edf0791ca697f587e48dd39948d63c1 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Mon, 10 Sep 2018 23:37:40 +0200 -Subject: [PATCH 01/19] name spec/patch_file by real crate name - -When renaming using patch file, we really want to change file names too. - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/__main__.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index dc78828..1575ce6 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -218,7 +218,7 @@ def main(): - template = JINJA_ENV.get_template("main.spec") - - if args.patch and len(diff) > 0: -- patch_file = "{}-fix-metadata.diff".format(crate) -+ patch_file = "{}-fix-metadata.diff".format(metadata.name) - else: - patch_file = None - -@@ -269,7 +269,7 @@ def main(): - kwargs["license"] = license - kwargs["license_comments"] = comments - -- spec_file = "rust-{}.spec".format(crate) -+ spec_file = "rust-{}.spec".format(metadata.name) - spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) - if args.stdout: - print("# {}".format(spec_file)) --- -2.21.0 - diff --git a/0002-generate-doc-statements.patch b/0002-generate-doc-statements.patch deleted file mode 100644 index 7d5550b..0000000 --- a/0002-generate-doc-statements.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Mon, 10 Sep 2018 23:40:18 +0200 -Subject: [PATCH 02/19] generate %doc statements - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/metadata.py | 2 ++ - rust2rpm/templates/main.spec | 6 ++++++ - 2 files changed, 8 insertions(+) - -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 5dae1d3..f52d968 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -140,6 +140,7 @@ class Metadata(object): - self.name = None - self.license = None - self.license_file = None -+ self.readme = None - self.description = None - self.version = None - self._targets = [] -@@ -156,6 +157,7 @@ class Metadata(object): - self.name = md["name"] - self.license = md["license"] - self.license_file = md["license_file"] -+ self.readme = md["readme"] - self.description = md.get("description") - self.version = md["version"] - version = "={}".format(self.version) -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 1aeb969..2e9f841 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -137,6 +137,9 @@ which use %{crate} from crates.io. - {% if md.license_file is not none %} - %license {{ md.license_file }} - {% endif %} -+{% if md.readme is not none %} -+%doc {{ md.readme }} -+{% endif %} - {% for bin in bins %} - %{_bindir}/{{ bin.name }} - {% endfor %} -@@ -147,6 +150,9 @@ which use %{crate} from crates.io. - {% if md.license_file is not none %} - %license {{ md.license_file }} - {% endif %} -+{% if md.readme is not none %} -+%doc {{ md.readme }} -+{% endif %} - %{cargo_registry}/%{crate}-%{version}/ - - {% endif %} --- -2.21.0 - diff --git a/0003-do-better-for-renamed-crates.patch b/0003-do-better-for-renamed-crates.patch deleted file mode 100644 index 97d5815..0000000 --- a/0003-do-better-for-renamed-crates.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 2050880140d4953b9ebdc7211e30df3ccf5dd61d Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Tue, 11 Sep 2018 00:06:50 +0200 -Subject: [PATCH 03/19] do better for renamed crates - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/__main__.py | 7 ++++--- - rust2rpm/templates/main.spec | 13 ++++++++++++- - 2 files changed, 16 insertions(+), 4 deletions(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index 1575ce6..e993e7b 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -180,7 +180,7 @@ def make_diff_metadata(crate, version, patch=False, store=False): - diff = make_patch(toml, enabled=patch) - metadata = Metadata.from_file(toml) - if store: -- shutil.copy2(cratef, os.path.join(os.getcwd(), f"{crate}-{version}.crate")) -+ shutil.copy2(cratef, os.path.join(os.getcwd(), f"{metadata.name}-{version}.crate")) - return crate, diff, metadata - - def main(): -@@ -218,11 +218,12 @@ def main(): - template = JINJA_ENV.get_template("main.spec") - - if args.patch and len(diff) > 0: -- patch_file = "{}-fix-metadata.diff".format(metadata.name) -+ patch_file = f"{metadata.name}-fix-metadata.diff" - else: - patch_file = None - - kwargs = {} -+ kwargs["crate"] = crate - kwargs["target"] = args.target - bins = [tgt for tgt in metadata.targets if tgt.kind == "bin"] - libs = [tgt for tgt in metadata.targets if tgt.kind in ("lib", "rlib", "proc-macro")] -@@ -269,7 +270,7 @@ def main(): - kwargs["license"] = license - kwargs["license_comments"] = comments - -- spec_file = "rust-{}.spec".format(metadata.name) -+ spec_file = f"rust-{metadata.name}.spec" - spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) - if args.stdout: - print("# {}".format(spec_file)) -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 2e9f841..7dbcc3f 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -6,6 +6,9 @@ - {% endif %} - - %global crate {{ md.name }} -+{% if md.name != crate %} -+%global real_crate {{ crate }} -+{% endif %} - - Name: rust-%{crate} - Version: {{ md.version }} -@@ -27,8 +30,12 @@ License: {{ license|default("# FIXME") }} - {% if license_comments is not none %} - {{ license_comments }} - {% endif %} --URL: https://crates.io/crates/{{ md.name }} -+URL: https://crates.io/crates/{{ crate }} -+{% if md.name != crate %} -+Source0: https://crates.io/api/v1/crates/%{real_crate}/%{version}/download#/%{crate}-%{version}.crate -+{% else %} - Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate -+{% endif %} - {% if patch_file is not none %} - {% if target == "opensuse" %} - # PATCH-FIX-OPENSUSE {{ patch_file }} -- Initial patched metadata -@@ -118,7 +125,11 @@ which use %{crate} from crates.io. - - {% endif %} - %prep -+{% if md.name != crate %} -+%autosetup -n %{real_crate}-%{version} -p1 -+{% else %} - %autosetup -n %{crate}-%{version} -p1 -+{% endif %} - %cargo_prep - - %build --- -2.21.0 - diff --git a/0004-remove-pre-3.6-leftovers.patch b/0004-remove-pre-3.6-leftovers.patch deleted file mode 100644 index 017fb26..0000000 --- a/0004-remove-pre-3.6-leftovers.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e6e9cbbb71199c2773b47fa21f1c917a167c1743 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Tue, 11 Sep 2018 10:43:53 +0200 -Subject: [PATCH 04/19] remove pre-3.6 leftovers - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/metadata.py | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index f52d968..5adeb65 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -203,8 +203,6 @@ class Metadata(object): - - @classmethod - def from_file(cls, path): -- do_decode = sys.version_info < (3, 6) - metadata = subprocess.check_output(["cargo", "read-manifest", -- "--manifest-path={}".format(path)], -- universal_newlines=do_decode) -+ "--manifest-path={}".format(path)]) - return cls.from_json(json.loads(metadata)) --- -2.21.0 - diff --git a/0005-Remove-half-downloaded-crate-on-C.patch b/0005-Remove-half-downloaded-crate-on-C.patch deleted file mode 100644 index 033815b..0000000 --- a/0005-Remove-half-downloaded-crate-on-C.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 2f12c83d14afe71e9efed2d1be62e1e610e602e9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Fri, 17 Aug 2018 10:03:48 +0200 -Subject: [PATCH 05/19] Remove half-downloaded crate on ^C - -Subsequent invocations would fail with an error about a corrupted file. -We don't have support for resuming a failed download, so let's remove the -partial download results. ---- - rust2rpm/__main__.py | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index e993e7b..8e6f6eb 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -83,6 +83,14 @@ def file_mtime(path): - t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) - return t.astimezone().isoformat() - -+@contextlib.contextmanager -+def remove_on_error(path): -+ try: -+ yield -+ except: # this is supposed to include ^C -+ os.unlink(path) -+ raise -+ - def local_toml(toml, version): - if os.path.isdir(toml): - toml = os.path.join(toml, "Cargo.toml") -@@ -110,7 +118,8 @@ def download(crate, version): - req = requests.get(url, stream=True) - req.raise_for_status() - total = int(req.headers["Content-Length"]) -- with open(cratef, "wb") as f: -+ with remove_on_error(cratef), \ -+ open(cratef, "wb") as f: - for chunk in tqdm.tqdm(req.iter_content(), "Downloading {}".format(cratef_base), - total=total, unit="B", unit_scale=True): - f.write(chunk) --- -2.21.0 - diff --git a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch b/0006-Throw-an-error-if-s-is-used-without-a-crate.patch deleted file mode 100644 index 861d233..0000000 --- a/0006-Throw-an-error-if-s-is-used-without-a-crate.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 5a1cde5b8dcaea74ebb2050879036bf46df63adc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Fri, 17 Aug 2018 10:18:59 +0200 -Subject: [PATCH 06/19] Throw an error if -s is used without a crate - -In the future we might want to be smarter and find the crate, but let's at least -not ignore the option completely. ---- - rust2rpm/__main__.py | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index 8e6f6eb..f23ebbc 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -178,6 +178,9 @@ def make_diff_metadata(crate, version, patch=False, store=False): - if crate.endswith(".crate"): - cratef, crate, version = local_crate(crate, version) - else: -+ if store: -+ raise ValueError('--store-crate can only be used for a crate') -+ - toml, crate, version = local_toml(crate, version) - diff = make_patch(toml, enabled=patch, tmpfile=True) - metadata = Metadata.from_file(toml) --- -2.21.0 - diff --git a/0007-split-features-into-subpackages.patch b/0007-split-features-into-subpackages.patch deleted file mode 100644 index acf5911..0000000 --- a/0007-split-features-into-subpackages.patch +++ /dev/null @@ -1,1064 +0,0 @@ -From 2cac5e5ad5ff5472923ce333bef59679612bbaa2 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Fri, 26 Oct 2018 11:20:13 +0200 -Subject: [PATCH 07/19] split features into subpackages - -References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain -Signed-off-by: Igor Gnatenko ---- - data/cargo.attr | 4 +- - data/macros.cargo | 10 + - rust2rpm/__main__.py | 11 +- - rust2rpm/inspector.py | 22 ++- - rust2rpm/metadata.py | 317 ++++++++++++++++---------------- - rust2rpm/templates/main.spec | 142 +++++++------- - test.py | 347 ++++------------------------------- - 7 files changed, 298 insertions(+), 555 deletions(-) - -diff --git a/data/cargo.attr b/data/cargo.attr -index 392a72b..4910b5c 100644 ---- a/data/cargo.attr -+++ b/data/cargo.attr -@@ -1,3 +1,3 @@ --%__cargo_provides %{_bindir}/cargo-inspector --provides --%__cargo_requires %{_bindir}/cargo-inspector --requires -+%__cargo_provides %{_bindir}/cargo-inspector --provides --feature=%{__cargo_feature_from_name -n %{name}} -+%__cargo_requires %{_bindir}/cargo-inspector --requires --feature=%{__cargo_feature_from_name -n %{name}} - %__cargo_path ^%{cargo_registry}/[^/]+/Cargo\\.toml$ -diff --git a/data/macros.cargo b/data/macros.cargo -index a0c456a..7fb025b 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -84,3 +84,13 @@ if %__cargo_is_bin; then \ - %{__rm} %{buildroot}%{_prefix}/.crates.toml \ - fi \ - ) -+ -+%__cargo_feature_from_name(n:) %{lua: -+local name = rpm.expand("%{-n*}") -+local feature = string.match(name, "^.+%+(.+)-devel$") -+if feature == nil then -+ print() -+else -+ print(feature) -+end -+} -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index f23ebbc..d19cb47 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -18,15 +18,19 @@ import requests - import tqdm - - from . import Metadata, licensing -+from .metadata import normalize_deps - - DEFAULT_EDITOR = "vi" - XDG_CACHE_HOME = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache")) - CACHEDIR = os.path.join(XDG_CACHE_HOME, "rust2rpm") - API_URL = "https://crates.io/api/v1/" - JINJA_ENV = jinja2.Environment(loader=jinja2.ChoiceLoader([ -- jinja2.FileSystemLoader(["/"]), -- jinja2.PackageLoader("rust2rpm", "templates"), ]), -- trim_blocks=True, lstrip_blocks=True) -+ jinja2.FileSystemLoader(["/"]), -+ jinja2.PackageLoader("rust2rpm", "templates"), -+ ]), -+ extensions=["jinja2.ext.do"], -+ trim_blocks=True, -+ lstrip_blocks=True) - - def get_default_target(): - # TODO: add fallback for /usr/lib/os-release -@@ -227,6 +231,7 @@ def main(): - patch=args.patch, - store=args.store_crate) - -+ JINJA_ENV.globals["normalize_deps"] = normalize_deps - template = JINJA_ENV.get_template("main.spec") - - if args.patch and len(diff) > 0: -diff --git a/rust2rpm/inspector.py b/rust2rpm/inspector.py -index 2d488b2..9e79e88 100644 ---- a/rust2rpm/inspector.py -+++ b/rust2rpm/inspector.py -@@ -1,8 +1,8 @@ - import argparse --import itertools - import sys - - from . import Metadata -+from .metadata import normalize_deps - - def main(): - parser = argparse.ArgumentParser() -@@ -10,18 +10,23 @@ def main(): - group.add_argument("-n", "--name", action="store_true", help="Print name") - group.add_argument("-v", "--version", action="store_true", help="Print version") - group.add_argument("-t", "--target-kinds", action="store_true", help="Print target kinds") -+ group.add_argument("-l", "--list-features", action="store_true", help="Print features") - group.add_argument("-P", "--provides", action="store_true", help="Print Provides") - group.add_argument("-R", "--requires", action="store_true", help="Print Requires") - group.add_argument("-BR", "--build-requires", action="store_true", help="Print BuildRequires") - group.add_argument("-TR", "--test-requires", action="store_true", help="Print TestRequires") -+ parser.add_argument("-f", "--feature", help="Feature to work on") - parser.add_argument("file", nargs="*", help="Path(s) to Cargo.toml") - args = parser.parse_args() - - files = args.file or sys.stdin.readlines() - -+ if not args.feature: -+ args.feature = None -+ - def print_deps(deps): - if len(deps) > 0: -- print("\n".join(str(dep) for dep in deps)) -+ print("\n".join(sorted(normalize_deps(deps)))) - - for f in files: - f = f.rstrip() -@@ -32,17 +37,20 @@ def main(): - print(md.version) - if args.target_kinds: - print("\n".join(set(tgt.kind for tgt in md.targets))) -+ if args.list_features: -+ for f in sorted(f for f in md.dependencies if f is not None): -+ print(f) - if args.provides: -- print_deps(md.provides) -- if args.requires or args.build_requires: -- print_deps(list(itertools.chain(md.requires, md.build_requires))) -- if args.test_requires: -- print_deps(md.test_requires) -+ print(md.provides(args.feature)) - if args.requires: - # Someone should own /usr/share/cargo/registry - print("cargo") -+ print_deps(md.requires(args.feature)) - if args.build_requires: - print("rust-packaging") -+ print_deps(md.requires(args.feature or "default", resolve=True)) -+ if args.test_requires: -+ print_deps(md.dev_dependencies) - - if __name__ == "__main__": - main() -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 5adeb65..4929cdd 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -1,208 +1,207 @@ - __all__ = ["Dependency", "Metadata"] - --import itertools -+import copy - import json - import subprocess --import sys - - import semantic_version as semver - import rustcfg - --class Target(object): -- def __init__(self, kind, name): -- self.kind = kind -+class Target: -+ def __init__(self, name, kind): - self.name = name -+ self.kind = kind - - def __repr__(self): -- return "".format(self=self) -- -- --def _req_to_str(name, spec=None, feature=None): -- f_part = "/{}".format(feature) if feature is not None else "" -- basestr = "crate({}{})".format(name, f_part) -- if spec is None: -- return basestr -- if spec.kind == spec.KIND_EQUAL: -- spec.kind = spec.KIND_SHORTEQ -- if spec.kind == spec.KIND_ANY: -- if spec.spec == "": -- # Just wildcard -- return basestr -- else: -- # Wildcard in string -- assert False, spec.spec -- version = str(spec.spec).replace("-", "~") -- return "{} {} {}".format(basestr, spec.kind, version) -+ return f"" - --class Dependency(object): -- def __init__(self, name, req, features=(), provides=False): -+class Dependency: -+ def __init__(self, name, req=None, features=(), optional=False): - self.name = name -- self.spec = self._parse_req(req) -+ self.req = req - self.features = features -- self.provides = provides -- if self.provides: -- if len(self.spec.specs) > 1 or \ -- (len(self.spec.specs) == 1 and self.spec.specs[0].kind != self.spec.specs[0].KIND_EQUAL): -- raise Exception("Provides can't be applied to ranged version, {!r}".format(self.spec)) -- -- def __repr__(self): -- if self.provides: -- spec = self.spec.specs[0] -- provs = [_req_to_str(self.name, spec)] -- for feature in self.features: -- provs.append(_req_to_str(self.name, spec, feature)) -- return " and ".join(provs) -- -- reqs = [_req_to_str(self.name, spec=req) for req in self.spec.specs] -- features = [_req_to_str(self.name, feature=feature) for feature in self.features] -+ self.optional = optional - -- use_rich = False -- if len(reqs) > 1: -- reqstr = "({})".format(" with ".join(reqs)) -- use_rich = True -- elif len(reqs) == 1: -- reqstr = reqs[0] -- else: -- reqstr = "" -- if len(features) > 0: -- featurestr = " with ".join(features) -- use_rich = True -- else: -- featurestr = "" -- -- if use_rich: -- if reqstr and featurestr: -- return "({} with {})".format(reqstr, featurestr) -- elif reqstr and not featurestr: -- return reqstr -- elif not reqstr and featurestr: -- return "({})".format(featurestr) -- else: -- assert False -- else: -- return reqstr -+ @classmethod -+ def from_json(cls, metadata): -+ features = set(metadata['features']) -+ if metadata['uses_default_features']: -+ features.add('default') -+ kwargs = {'name': metadata['name'], -+ 'req': metadata['req'], -+ 'optional': metadata['optional'], -+ 'features': features} -+ return cls(**kwargs) - - @staticmethod -- def _parse_req(s): -- if "*" in s and s != "*": -- # XXX: https://github.com/rbarrois/python-semanticversion/issues/51 -- s = "~{}".format(s.replace(".*", "", 1)) -- if ".*" in s: -- s = s.replace(".*", "") -- spec = semver.Spec(s.replace(" ", "")) -- parsed = [] -+ def _normalize_req(req): -+ if "*" in req and req != "*": -+ raise NotImplementedError(f"'*' is not supported: {req}") -+ spec = semver.Spec(req.replace(" ", "")) -+ reqs = [] - for req in spec.specs: -- ver = req.spec - if req.kind == req.KIND_ANY: -- parsed.append("*") -+ # Any means any - continue -+ ver = req.spec -+ if ver.prerelease: -+ raise NotImplementedError(f"Pre-release requirement is not supported: {ver}") -+ if req.kind in (req.KIND_NEQ, req.KIND_EMPTY): -+ raise NotImplementedError(f"'!=' and empty kinds are not supported: {req}") - coerced = semver.Version.coerce(str(ver)) -- if req.kind in (req.KIND_CARET, req.KIND_TILDE): -- if ver.prerelease: -- # pre-release versions only match the same x.y.z -- if ver.patch is not None: -- upper = ver.next_patch() -- elif ver.minor is not None: -- upper = ver.next_minor() -- else: -- upper = ver.next_major() -- elif req.kind == req.KIND_CARET: -- if ver.major == 0: -- if ver.minor is not None: -- if ver.patch is None or ver.minor != 0: -- upper = ver.next_minor() -- else: -- upper = ver.next_patch() -+ if req.kind == req.KIND_EQUAL: -+ req.kind = req.KIND_SHORTEQ -+ if req.kind in (req.KIND_CARET, req.KIND_COMPATIBLE): -+ if ver.major == 0: -+ if ver.minor is not None: -+ if ver.minor != 0 or ver.patch is None: -+ upper = ver.next_minor() - else: -- upper = ver.next_major() -+ upper = ver.next_patch() - else: - upper = ver.next_major() -- elif req.kind == req.KIND_TILDE: -- if ver.minor is None: -- upper = ver.next_major() -- else: -- upper = ver.next_minor() - else: -- assert False -- parsed.append(">={}".format(coerced)) -- parsed.append("<{}".format(upper)) -- elif req.kind == req.KIND_NEQ: -- parsed.append(">{}".format(coerced)) -- parsed.append("<{}".format(coerced)) -- elif req.kind in (req.KIND_EQUAL, req.KIND_GT, req.KIND_GTE, req.KIND_LT, req.KIND_LTE): -- parsed.append("{}{}".format(req.kind, coerced)) -+ upper = ver.next_major() -+ reqs.append((">=", coerced)) -+ reqs.append(("<", upper)) -+ elif req.kind == req.KIND_TILDE: -+ if ver.minor is None: -+ upper = ver.next_major() -+ else: -+ upper = ver.next_minor() -+ reqs.append((">=", coerced)) -+ reqs.append(("<", upper)) -+ elif req.kind in (req.KIND_SHORTEQ, -+ req.KIND_GT, -+ req.KIND_GTE, -+ req.KIND_LT, -+ req.KIND_LTE): -+ reqs.append((str(req.kind), coerced)) - else: -- assert False, req.kind -- return semver.Spec(",".join(parsed)) -+ raise AssertionError(f"Found unhandled kind: {req.kind}") -+ return reqs - --class Metadata(object): -- def __init__(self): -- self.name = None -+ @staticmethod -+ def _apply_reqs(name, reqs, feature=None): -+ fstr = f"/{feature}" if feature is not None else "" -+ cap = f"crate({name}{fstr})" -+ if not reqs: -+ return cap -+ deps = " with ".join(f"{cap} {op} {version}" for op, version in reqs) -+ if len(reqs) > 1: -+ return f"({deps})" -+ else: -+ return deps -+ -+ def normalize(self): -+ return [self._apply_reqs(self.name, self._normalize_req(self.req), feature) -+ for feature in self.features or (None,)] -+ -+ def __repr__(self): -+ return f"" -+ -+ def __str__(self): -+ return "\n".join(self.normalize()) -+ -+class Metadata: -+ def __init__(self, name, version): -+ self.name = name -+ self.version = version - self.license = None - self.license_file = None - self.readme = None - self.description = None -- self.version = None -- self._targets = [] -- self.provides = [] -- self.requires = [] -- self.build_requires = [] -- self.test_requires = [] -+ self.targets = set() -+ self.dependencies = {} -+ self.dev_dependencies = set() - - @classmethod - def from_json(cls, metadata): -- self = cls() -- - md = metadata -- self.name = md["name"] -+ self = cls(md["name"], md["version"]) -+ - self.license = md["license"] - self.license_file = md["license_file"] - self.readme = md["readme"] - self.description = md.get("description") -- self.version = md["version"] -- version = "={}".format(self.version) -- -- # Targets -- self.targets = [Target(tgt["kind"][0], tgt["name"]) for tgt in md["targets"]] -- -- # Provides -- # All optional dependencies are also features -- # https://github.com/rust-lang/cargo/issues/4911 -- features = itertools.chain((x["name"] for x in md["dependencies"] if x["optional"]), -- md["features"]) -- provides = Dependency(self.name, version, features=features, provides=True) -- self.provides = str(provides).split(" and ") -- -- ev = rustcfg.Evaluator.platform() -- -- # Dependencies -- for dep in md["dependencies"]: -- kind = dep["kind"] -- if kind is None: -- requires = self.requires -- elif kind == "build": -- requires = self.build_requires -- elif kind == "dev": -- requires = self.test_requires -- else: -- raise ValueError("Unknown kind: {!r}, please report bug.".format(kind)) - -- target = dep["target"] -- if target is None: -- pass -+ # dependencies + build-dependencies → runtime -+ deps_by_name = {dep["name"]: Dependency.from_json(dep) -+ for dep in md["dependencies"] -+ if dep["kind"] != "dev"} -+ -+ deps_by_feature = {} -+ for feature, f_deps in md["features"].items(): -+ features = {None} -+ deps = set() -+ for dep in f_deps: -+ if dep in md["features"]: -+ features.add(dep) -+ else: -+ pkg, _, f = dep.partition("/") -+ dep = copy.deepcopy(deps_by_name[pkg]) -+ if f: -+ dep.features = {f} -+ deps.add(dep) -+ deps_by_feature[feature] = (features, deps) -+ -+ mandatory_deps = set() -+ for dep in deps_by_name.values(): -+ if dep.optional: -+ deps_by_feature[dep.name] = ({None}, {copy.deepcopy(dep)}) - else: -- cond = ev.parse_and_eval(target) -- if not cond: -- print(f'Dependency {dep["name"]} for target {target!r} is not needed, ignoring.', -- file=sys.stderr) -- continue -+ mandatory_deps.add(copy.deepcopy(dep)) -+ deps_by_feature[None] = (set(), mandatory_deps) -+ -+ if "default" not in deps_by_feature: -+ deps_by_feature["default"] = ({None}, set()) - -- requires.append(Dependency(dep["name"], dep["req"], features=dep["features"])) -+ self.dependencies = deps_by_feature -+ self.dev_dependencies = {Dependency.from_json(dep) -+ for dep in md["dependencies"] -+ if dep["kind"] == "dev"} -+ -+ self.targets = {Target(tgt["name"], tgt["kind"][0]) -+ for tgt in md["targets"]} - - return self - - @classmethod - def from_file(cls, path): - metadata = subprocess.check_output(["cargo", "read-manifest", -- "--manifest-path={}".format(path)]) -+ f"--manifest-path={path}"]) - return cls.from_json(json.loads(metadata)) -+ -+ @property -+ def all_dependencies(self): -+ return set().union(*(x[1] for x in self.dependencies.values())) -+ -+ def provides(self, feature=None): -+ if feature not in self.dependencies: -+ raise KeyError(f"Feature {feature!r} doesn't exist") -+ return Dependency(self.name, f"={self.version}", features={feature}) -+ -+ @classmethod -+ def _resolve(cls, deps_by_feature, feature): -+ all_features = set() -+ all_deps = set() -+ ff, dd = copy.deepcopy(deps_by_feature[feature]) -+ all_features |= ff -+ all_deps |= dd -+ for f in ff: -+ ff1, dd1 = cls._resolve(deps_by_feature, f) -+ all_features |= ff1 -+ all_deps |= dd1 -+ return all_features, all_deps -+ -+ def requires(self, feature=None, resolve=False): -+ if resolve: -+ return self._resolve(self.dependencies, feature)[1] -+ else: -+ features, deps = self.dependencies[feature] -+ fdeps = set(Dependency(self.name, f"={self.version}", features={feature}) -+ for feature in features) -+ return fdeps | deps -+ -+def normalize_deps(deps): -+ return set().union(*(d.normalize() for d in deps)) -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 7dbcc3f..0d9a80b 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -48,82 +48,102 @@ Patch0: {{ patch_file }} - ExclusiveArch: %{rust_arches} - - BuildRequires: rust-packaging --{% if include_build_requires %} --{% if md.requires|length > 0 %} --# [dependencies] --{% for req in md.requires|sort(attribute="name") %} -+{# We will put all non-optional and optional dependencies until -+ https://github.com/rust-lang/cargo/issues/5133 -+ is solved -+{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} -+#} -+{% set buildrequires = normalize_deps(md.all_dependencies)|sort %} -+{% for req in buildrequires %} - BuildRequires: {{ req }} - {% endfor %} --{% endif %} --{% if md.build_requires|length > 0 %} --# [build-dependencies] --{% for req in md.build_requires|sort(attribute="name") %} --BuildRequires: {{ req }} --{% endfor %} --{% endif %} --{% if md.test_requires|length > 0 %} -+{% set testrequires = normalize_deps(md.dev_dependencies)|sort %} -+{% if testrequires|length > 0 %} - %if %{with check} --# [dev-dependencies] --{% for req in md.test_requires|sort(attribute="name") %} -+ {% for req in testrequires %} - BuildRequires: {{ req }} --{% endfor %} -+ {% endfor %} - %endif - {% endif %} --{% endif %} - --%description -+%global _description \ -+{% if md.description is none %} - %{summary}. -+{% else %} -+{{ md.description|wordwrap(wrapstring="\\\n")|trim }} -+{% endif %} -+ -+%description %{_description} - - {% if include_main %} - %package -n %{crate} - Summary: %{summary} --{% if rust_group is defined %} -+ {% if rust_group is defined %} - Group: # FIXME --{% endif %} -+ {% endif %} - - %description -n %{crate} - %{summary}. - --{% endif %} -+%files -n %{crate} -+ {% if md.license_file is not none %} -+%license {{ md.license_file }} -+ {% endif %} -+ {% if md.readme is not none %} -+%doc {{ md.readme }} -+ {% endif %} -+ {% for bin in bins %} -+%{_bindir}/{{ bin.name }} -+ {% endfor %} -+ -+{% endif -%} -+ - {% if include_devel %} --%package devel -+ {% set features = md.dependencies.keys()|list %} -+ {% do features.remove(None) %} -+ {% do features.remove("default") %} -+ {% set features = features|sort %} -+ {% do features.insert(0, None) %} -+ {% do features.insert(1, "default") %} -+ {% for feature in features %} -+ {% set pkg = "-n %%{name}+%s-devel"|format(feature) if feature is not none else " devel" %} -+%package {{ pkg }} - Summary: %{summary} --{% if rust_group is defined %} -+ {% if rust_group is defined %} - Group: {{ rust_group }} --{% endif %} -+ {% endif %} - BuildArch: noarch --{% if include_provides %} --{% for prv in md.provides %} --Provides: {{ prv }} --{% endfor %} --{% endif %} --{% if include_requires %} -+ {% if include_provides %} -+Provides: {{ md.provides(feature) }} -+ {% endif %} -+ {% if include_requires %} - Requires: cargo --{% if md.requires|length > 0 %} --# [dependencies] --{% for req in md.requires|sort(attribute="name") %} --Requires: {{ req }} --{% endfor %} --{% endif %} --{% if md.build_requires|length > 0 %} --# [build-dependencies] --{% for req in md.build_requires|sort(attribute="name") %} -+ {% for req in md.requires(feature)|map("string")|sort %} - Requires: {{ req }} --{% endfor %} --{% endif %} --{% endif %} -+ {% endfor %} -+ {% endif %} - --%description devel --{% if md.description is none %} --%{summary}. --{% else %} --{{ md.description|wordwrap|trim }} --{% endif %} -+%description {{ pkg }} %{_description} - - This package contains library source intended for building other packages --which use %{crate} from crates.io. -+which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{crate}" crate. -+ -+%files {{ pkg }} -+ {% if feature is none %} -+ {% if md.license_file is not none %} -+%license {{ md.license_file }} -+ {% endif %} -+ {% if md.readme is not none %} -+%doc {{ md.readme }} -+ {% endif %} -+%{cargo_registry}/%{crate}-%{version}/ -+ {% else %} -+%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml -+ {% endif %} -+ -+ {% endfor %} -+{% endif -%} - --{% endif %} - %prep - {% if md.name != crate %} - %autosetup -n %{real_crate}-%{version} -p1 -@@ -143,29 +163,5 @@ which use %{crate} from crates.io. - %cargo_test - %endif - --{% if include_main %} --%files -n %{crate} --{% if md.license_file is not none %} --%license {{ md.license_file }} --{% endif %} --{% if md.readme is not none %} --%doc {{ md.readme }} --{% endif %} --{% for bin in bins %} --%{_bindir}/{{ bin.name }} --{% endfor %} -- --{% endif %} --{% if include_devel %} --%files devel --{% if md.license_file is not none %} --%license {{ md.license_file }} --{% endif %} --{% if md.readme is not none %} --%doc {{ md.readme }} --{% endif %} --%{cargo_registry}/%{crate}-%{version}/ -- --{% endif %} - %changelog - {% include target ~ "-changelog.spec.inc" %} -diff --git a/test.py b/test.py -index b856fdd..30263b4 100644 ---- a/test.py -+++ b/test.py -@@ -1,318 +1,43 @@ --import os --import shutil --import subprocess --import sys --import tempfile --import textwrap -- - import pytest - - import rust2rpm - --DUMMY_LIB = """ --pub fn say_hello() { -- println!("Hello, World!"); --} --""" --DEPGEN = os.path.join(os.path.dirname(__file__), "cargodeps.py") -- -- --@pytest.mark.parametrize("req, features, rpmdep", [ -- ("=1.0.0", [], -- "crate(test) = 1.0.0"), -- ("=1.0.0", ["feature"], -- "(crate(test) = 1.0.0 with crate(test/feature))"), -- (">=1.0.0,<2.0.0", [], -+@pytest.mark.parametrize("req, rpmdep", [ -+ ("^1.2.3", -+ "(crate(test) >= 1.2.3 with crate(test) < 2.0.0)"), -+ ("^1.2", -+ "(crate(test) >= 1.2.0 with crate(test) < 2.0.0)"), -+ ("^1", - "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), -- (">=1.0.0,<2.0.0", ["feature"], -- "((crate(test) >= 1.0.0 with crate(test) < 2.0.0) with crate(test/feature))"), -+ ("^0.2.3", -+ "(crate(test) >= 0.2.3 with crate(test) < 0.3.0)"), -+ ("^0.2", -+ "(crate(test) >= 0.2.0 with crate(test) < 0.3.0)"), -+ ("^0.0.3", -+ "(crate(test) >= 0.0.3 with crate(test) < 0.0.4)"), -+ ("^0.0", -+ "(crate(test) >= 0.0.0 with crate(test) < 0.1.0)"), -+ ("^0", -+ "(crate(test) >= 0.0.0 with crate(test) < 1.0.0)"), -+ ("~1.2.3", -+ "(crate(test) >= 1.2.3 with crate(test) < 1.3.0)"), -+ ("~1.2", -+ "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"), -+ ("~1", -+ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), -+ ("*", -+ "crate(test)"), -+ (">= 1.2.0", -+ "crate(test) >= 1.2.0"), -+ ("> 1", -+ "crate(test) > 1.0.0"), -+ ("< 2", -+ "crate(test) < 2.0.0"), -+ ("= 1.2.3", -+ "crate(test) = 1.2.3"), -+ (">= 1.2, < 1.5", -+ "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"), - ]) --def test_dependency(req, features, rpmdep): -- dep = rust2rpm.Dependency("test", req, features) -+def test_dependency(req, rpmdep): -+ dep = rust2rpm.Dependency("test", req) - assert str(dep) == rpmdep -- --@pytest.fixture --def cargo_toml(request): -- def make_cargo_toml(contents): -- toml = os.path.join(tmpdir, "Cargo.toml") -- with open(toml, "w") as fobj: -- fobj.write(textwrap.dedent(contents)) -- return toml -- -- tmpdir = tempfile.mkdtemp(prefix="cargo-deps-") -- srcdir = os.path.join(tmpdir, "src") -- os.mkdir(srcdir) -- with open(os.path.join(srcdir, "lib.rs"), "w") as fobj: -- fobj.write(DUMMY_LIB) -- -- def finalize(): -- shutil.rmtree(tmpdir) -- request.addfinalizer(finalize) -- -- return make_cargo_toml -- --@pytest.mark.parametrize("toml, provides, requires", [ -- -- # Basic provides -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- """, -- ["crate(hello) = 0.0.0"], -- []), -- -- # Basic provides for feature -- (""" -- [package] -- name = "hello" -- version = "1.2.3" -- -- [features] -- color = [] -- """, -- ["crate(hello) = 1.2.3", -- "crate(hello/color) = 1.2.3"], -- []), -- -- # Provides for optional dependencies -- (""" -- [package] -- name = "hello" -- version = "1.2.3" -- -- [dependencies] -- non_optional = "1" -- serde = { version = "1", optional = true } -- rand = { version = "0.4", optional = true } -- -- [features] -- std = [] -- v1 = ["rand"] -- """, -- ["crate(hello) = 1.2.3", -- "crate(hello/rand) = 1.2.3", -- "crate(hello/serde) = 1.2.3", -- "crate(hello/std) = 1.2.3", -- "crate(hello/v1) = 1.2.3"], -- ["(crate(non_optional) >= 1.0.0 with crate(non_optional) < 2.0.0)", -- "(crate(rand) >= 0.4.0 with crate(rand) < 0.5.0)", -- "(crate(serde) >= 1.0.0 with crate(serde) < 2.0.0)"]), -- -- # Caret requirements -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "^0" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 0.0.0 with crate(libc) < 1.0.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "^0.0" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 0.0.0 with crate(libc) < 0.1.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "^0.0.3" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 0.0.3 with crate(libc) < 0.0.4)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "^0.2.3" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 0.2.3 with crate(libc) < 0.3.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "^1" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "^1.2" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.2.0 with crate(libc) < 2.0.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "^1.2.3" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.2.3 with crate(libc) < 2.0.0)"]), -- -- # Tilde requirements -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "~1" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "~1.2" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "~1.2.3" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.2.3 with crate(libc) < 1.3.0)"]), -- -- # Wildcard requirements -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "*" -- """, -- ["crate(hello) = 0.0.0"], -- ["crate(libc)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "1.*" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "1.2.*" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.0)"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "1.*.*" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), -- -- # Inequality requirements -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = ">= 1.2.0" -- """, -- ["crate(hello) = 0.0.0"], -- ["crate(libc) >= 1.2.0"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "> 1" -- """, -- ["crate(hello) = 0.0.0"], -- ["crate(libc) > 1.0.0"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "< 2" -- """, -- ["crate(hello) = 0.0.0"], -- ["crate(libc) < 2.0.0"]), -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = "= 1.2.3" -- """, -- ["crate(hello) = 0.0.0"], -- ["crate(libc) = 1.2.3"]), -- -- # Multiple requirements -- (""" -- [package] -- name = "hello" -- version = "0.0.0" -- -- [dependencies] -- libc = ">= 1.2, < 1.5" -- """, -- ["crate(hello) = 0.0.0"], -- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.5.0)"]), -- -- # Pre-release requirements -- (""" -- [package] -- name = "hello" -- version = "0.0.0-alpha" -- -- [dependencies] -- foo-bar = "1.2.3-beta" -- """, -- ["crate(hello) = 0.0.0~alpha"], -- ["(crate(foo-bar) >= 1.2.3~beta with crate(foo-bar) < 1.2.3)"]), -- --]) --def test_depgen(toml, provides, requires, cargo_toml): -- md = rust2rpm.Metadata.from_file(cargo_toml(toml)) -- assert [str(x) for x in md.provides] == provides -- assert [str(x) for x in md.requires] == requires --- -2.21.0 - diff --git a/0008-add-support-for-dependencies-with-same-name.patch b/0008-add-support-for-dependencies-with-same-name.patch deleted file mode 100644 index 5412d76..0000000 --- a/0008-add-support-for-dependencies-with-same-name.patch +++ /dev/null @@ -1,74 +0,0 @@ -From a1d3a84645aa7bbe5ca07b60bead1ddf90a21cc1 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Tue, 30 Oct 2018 20:37:38 +0100 -Subject: [PATCH 08/19] add support for dependencies with same name - -Reported-by: Josh Stone -References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728 -Signed-off-by: Igor Gnatenko ---- - rust2rpm/metadata.py | 32 ++++++++++++++++++++------------ - 1 file changed, 20 insertions(+), 12 deletions(-) - -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 4929cdd..328b67a 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -1,5 +1,6 @@ - __all__ = ["Dependency", "Metadata"] - -+import collections - import copy - import json - import subprocess -@@ -126,9 +127,11 @@ class Metadata: - self.description = md.get("description") - - # dependencies + build-dependencies → runtime -- deps_by_name = {dep["name"]: Dependency.from_json(dep) -- for dep in md["dependencies"] -- if dep["kind"] != "dev"} -+ deps_by_name = collections.defaultdict(list) -+ for dep in md["dependencies"]: -+ if dep["kind"] == "dev": -+ continue -+ deps_by_name[dep["name"]].append(Dependency.from_json(dep)) - - deps_by_feature = {} - for feature, f_deps in md["features"].items(): -@@ -139,18 +142,23 @@ class Metadata: - features.add(dep) - else: - pkg, _, f = dep.partition("/") -- dep = copy.deepcopy(deps_by_name[pkg]) -- if f: -- dep.features = {f} -- deps.add(dep) -+ for dep in deps_by_name[pkg]: -+ dep = copy.deepcopy(dep) -+ if f: -+ dep.features = {f} -+ deps.add(dep) - deps_by_feature[feature] = (features, deps) - - mandatory_deps = set() -- for dep in deps_by_name.values(): -- if dep.optional: -- deps_by_feature[dep.name] = ({None}, {copy.deepcopy(dep)}) -- else: -- mandatory_deps.add(copy.deepcopy(dep)) -+ for name, deps in deps_by_name.items(): -+ fdeps = set() -+ for dep in deps: -+ if dep.optional: -+ fdeps.add(copy.deepcopy(dep)) -+ else: -+ mandatory_deps.add(copy.deepcopy(dep)) -+ if fdeps: -+ deps_by_feature[name] = ({None}, fdeps) - deps_by_feature[None] = (set(), mandatory_deps) - - if "default" not in deps_by_feature: --- -2.21.0 - diff --git a/0009-add-support-for-feeding-user-configuration.patch b/0009-add-support-for-feeding-user-configuration.patch deleted file mode 100644 index 8985513..0000000 --- a/0009-add-support-for-feeding-user-configuration.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 197150ee2e862edcd46f7ab02c9e4d17e49ca75d Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 31 Oct 2018 18:03:21 +0100 -Subject: [PATCH 09/19] add support for feeding user configuration - -Signed-off-by: Igor Gnatenko ---- - README.md | 26 ++++++++++++++++++++++++++ - README.rst | 5 ----- - rust2rpm/__main__.py | 13 +++++++++++++ - rust2rpm/templates/main.spec | 17 ++++++++++++++++- - 4 files changed, 55 insertions(+), 6 deletions(-) - create mode 100644 README.md - delete mode 100644 README.rst - -diff --git a/README.md b/README.md -new file mode 100644 -index 0000000..22b4b30 ---- /dev/null -+++ b/README.md -@@ -0,0 +1,26 @@ -+# rust2rpm -+ -+Convert Rust crates to RPM. -+ -+## `.rust2rpm.conf` -+ -+You can place configuration file which is used as source for additional -+information for spec generation. -+ -+Some simple example would be better than many words ;) -+ -+```ini -+[DEFAULT] -+buildrequires = -+ pkgconfig(foo) >= 1.2.3 -+lib.requires = -+ pkgconfig(foo) >= 1.2.3 -+ -+[fedora] -+bin.requires = -+ findutils -+buildrequires = -+lib.requires = -+lib+default.requires = -+ pkgconfig(bar) >= 2.0.0 -+``` -diff --git a/README.rst b/README.rst -deleted file mode 100644 -index 8866027..0000000 ---- a/README.rst -+++ /dev/null -@@ -1,5 +0,0 @@ --======== --rust2rpm --======== -- --Convert Rust crates to RPM. -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index d19cb47..c691274 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -199,6 +199,11 @@ def make_diff_metadata(crate, version, patch=False, store=False): - shutil.copy2(cratef, os.path.join(os.getcwd(), f"{metadata.name}-{version}.crate")) - return crate, diff, metadata - -+def to_list(s): -+ if not s: -+ return [] -+ return list(filter(None, (l.strip() for l in s.splitlines()))) -+ - def main(): - parser = argparse.ArgumentParser("rust2rpm", - formatter_class=argparse.RawTextHelpFormatter) -@@ -232,6 +237,7 @@ def main(): - store=args.store_crate) - - JINJA_ENV.globals["normalize_deps"] = normalize_deps -+ JINJA_ENV.globals["to_list"] = to_list - template = JINJA_ENV.get_template("main.spec") - - if args.patch and len(diff) > 0: -@@ -287,6 +293,13 @@ def main(): - kwargs["license"] = license - kwargs["license_comments"] = comments - -+ conf = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation()) -+ conf.read(".rust2rpm.conf") -+ if args.target not in conf: -+ conf.add_section(args.target) -+ -+ kwargs["distconf"] = conf[args.target] -+ - spec_file = f"rust-{metadata.name}.spec" - spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) - if args.stdout: -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 0d9a80b..d901e6d 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -65,6 +65,9 @@ BuildRequires: {{ req }} - {% endfor %} - %endif - {% endif %} -+{% for req in to_list(distconf.get("buildrequires"))|sort %} -+BuildRequires: {{ req }} -+{% endfor %} - - %global _description \ - {% if md.description is none %} -@@ -81,6 +84,9 @@ Summary: %{summary} - {% if rust_group is defined %} - Group: # FIXME - {% endif %} -+ {% for req in to_list(distconf.get("bin.requires"))|sort %} -+Requires: {{ req }} -+ {% endfor %} - - %description -n %{crate} - %{summary}. -@@ -106,7 +112,13 @@ Group: # FIXME - {% do features.insert(0, None) %} - {% do features.insert(1, "default") %} - {% for feature in features %} -- {% set pkg = "-n %%{name}+%s-devel"|format(feature) if feature is not none else " devel" %} -+ {% if feature is none %} -+ {% set pkg = " devel" %} -+ {% set conf_prefix = "lib" %} -+ {% else %} -+ {% set pkg = "-n %%{name}+%s-devel"|format(feature) %} -+ {% set conf_prefix = "lib+%s"|format(feature) %} -+ {% endif %} - %package {{ pkg }} - Summary: %{summary} - {% if rust_group is defined %} -@@ -122,6 +134,9 @@ Requires: cargo - Requires: {{ req }} - {% endfor %} - {% endif %} -+ {% for req in to_list(distconf.get("%s.requires"|format(conf_prefix)))|sort %} -+Requires: {{ req }} -+ {% endfor %} - - %description {{ pkg }} %{_description} - --- -2.21.0 - diff --git a/0010-trivial-use-f-strings-everywhere.patch b/0010-trivial-use-f-strings-everywhere.patch deleted file mode 100644 index c98be77..0000000 --- a/0010-trivial-use-f-strings-everywhere.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 83ea3796cd28ec7689b39e7dc7a70bd11af1abf1 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 31 Oct 2018 17:00:58 +0100 -Subject: [PATCH 10/19] trivial: use f-strings everywhere - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/__main__.py | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index c691274..b60e6c4 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -79,7 +79,7 @@ def detect_packager(): - if git is not None: - name = subprocess.check_output([git, "config", "user.name"], universal_newlines=True).strip() - email = subprocess.check_output([git, "config", "user.email"], universal_newlines=True).strip() -- return "{} <{}>".format(name, email) -+ return f"{name} <{email}>" - - return None - -@@ -108,23 +108,23 @@ def local_crate(crate, version): - def download(crate, version): - if version is None: - # Now we need to get latest version -- url = requests.compat.urljoin(API_URL, "crates/{}/versions".format(crate)) -+ url = requests.compat.urljoin(API_URL, f"crates/{crate}/versions") - req = requests.get(url) - req.raise_for_status() - versions = req.json()["versions"] - version = next(version["num"] for version in versions if not version["yanked"]) - - os.makedirs(CACHEDIR, exist_ok=True) -- cratef_base = "{}-{}.crate".format(crate, version) -+ cratef_base = f"{crate}-{version}.crate" - cratef = os.path.join(CACHEDIR, cratef_base) - if not os.path.isfile(cratef): -- url = requests.compat.urljoin(API_URL, "crates/{}/{}/download#".format(crate, version)) -+ url = requests.compat.urljoin(API_URL, f"crates/{crate}/{version}/download#") - req = requests.get(url, stream=True) - req.raise_for_status() - total = int(req.headers["Content-Length"]) - with remove_on_error(cratef), \ - open(cratef, "wb") as f: -- for chunk in tqdm.tqdm(req.iter_content(), "Downloading {}".format(cratef_base), -+ for chunk in tqdm.tqdm(req.iter_content(), f"Downloading {cratef_base}".format(cratef_base), - total=total, unit="B", unit_scale=True): - f.write(chunk) - return cratef, crate, version -@@ -132,14 +132,14 @@ def download(crate, version): - @contextlib.contextmanager - def toml_from_crate(cratef, crate, version): - with tempfile.TemporaryDirectory() as tmpdir: -- target_dir = "{}/".format(tmpdir) -+ target_dir = f"{tmpdir}/" - with tarfile.open(cratef, "r") as archive: - for n in archive.getnames(): - if not os.path.abspath(os.path.join(target_dir, n)).startswith(target_dir): - raise Exception("Unsafe filenames!") - archive.extractall(target_dir) -- toml_relpath = "{}-{}/Cargo.toml".format(crate, version) -- toml = "{}/{}".format(tmpdir, toml_relpath) -+ toml_relpath = f"{crate}-{version}/Cargo.toml" -+ toml = f"{tmpdir}/{toml_relpath}" - if not os.path.isfile(toml): - raise IOError("crate does not contain Cargo.toml file") - yield toml -@@ -270,7 +270,7 @@ def main(): - kwargs["include_provides"] = True - kwargs["include_requires"] = True - else: -- assert False, "Unknown target {!r}".format(args.target) -+ assert False, f"Unknown target {args.target!r}" - - if args.target == "mageia": - kwargs["pkg_release"] = "%mkrel 1" -@@ -303,10 +303,10 @@ def main(): - spec_file = f"rust-{metadata.name}.spec" - spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) - if args.stdout: -- print("# {}".format(spec_file)) -+ print(f"# {spec_file}") - print(spec_contents) - if patch_file is not None: -- print("# {}".format(patch_file)) -+ print(f"# {patch_file}") - print("".join(diff), end="") - else: - with open(spec_file, "w") as fobj: --- -2.21.0 - diff --git a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch b/0011-Add-option-to-not-generate-a-default-changelog-entry.patch deleted file mode 100644 index 8457b4a..0000000 --- a/0011-Add-option-to-not-generate-a-default-changelog-entry.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 294c6f571c0f4f7ed5a4fcb34142b0d332c55f29 Mon Sep 17 00:00:00 2001 -From: Neal Gompa -Date: Sun, 11 Nov 2018 11:06:27 -0500 -Subject: [PATCH 11/19] Add option to not generate a default changelog entry - -For Rust packages created through the OBS source service, the -changelog is managed by an external .changes file that is -transformed into an RPM changelog and appended to the spec file -automatically by the Open Build Service. - -Having a default entry means that the changelog handling will not -always work correctly and package builds may fail due to changelog -entries not being in reverse chronological order. - -This also is a future enabler for other workflows for external -changelog management in automated package builds. - -Signed-off-by: Neal Gompa ---- - rust2rpm/__main__.py | 7 +++++++ - rust2rpm/templates/main.spec | 4 +++- - 2 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index b60e6c4..747328e 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -209,6 +209,8 @@ def main(): - formatter_class=argparse.RawTextHelpFormatter) - parser.add_argument("--show-license-map", action="store_true", - help="Print license mappings and exit") -+ parser.add_argument("--no-auto-changelog-entry", action="store_true", -+ help="Do not generate a changelog entry") - parser.add_argument("-", "--stdout", action="store_true", - help="Print spec and patches into stdout") - parser.add_argument("-t", "--target", action="store", -@@ -261,6 +263,11 @@ def main(): - raise ValueError("No bins and no libs") - kwargs["include_devel"] = is_lib - -+ if args.no_auto_changelog_entry: -+ kwargs["auto_changelog_entry"] = False -+ else: -+ kwargs["auto_changelog_entry"] = True -+ - if args.target in ("fedora", "mageia", "opensuse"): - kwargs["include_build_requires"] = True - kwargs["include_provides"] = False -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index d901e6d..84bd97d 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -179,4 +179,6 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c - %endif - - %changelog --{% include target ~ "-changelog.spec.inc" %} -+{% if auto_changelog_entry %} -+ {% include target ~ "-changelog.spec.inc" %} -+{% endif %} --- -2.21.0 - diff --git a/0012-Set-CARGO_HOME-to-the-local-.config.patch b/0012-Set-CARGO_HOME-to-the-local-.config.patch deleted file mode 100644 index e9e37de..0000000 --- a/0012-Set-CARGO_HOME-to-the-local-.config.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b4e25038296cd57eba639a059e8baaf139a5d287 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 7 Dec 2018 13:58:41 -0800 -Subject: [PATCH 12/19] Set CARGO_HOME to the local .config - ---- - data/macros.cargo | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 7fb025b..e760721 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -1,4 +1,8 @@ --%__cargo %{_bindir}/cargo -+# Since cargo 1.31, install only uses $CARGO_HOME/config, ignoring $PWD. -+# https://github.com/rust-lang/cargo/issues/6397 -+# But we can set CARGO_HOME locally, which is a good idea anyway to make sure -+# it never writes to ~/.cargo during rpmbuild. -+%__cargo %{_bindir}/env CARGO_HOME=.cargo %{_bindir}/cargo - %__cargo_common_opts %{?_smp_mflags} - %__cargo_inspector %{_bindir}/cargo-inspector - --- -2.21.0 - diff --git a/0013-Set-the-install-root-in-.cargo-config.patch b/0013-Set-the-install-root-in-.cargo-config.patch deleted file mode 100644 index 0b97943..0000000 --- a/0013-Set-the-install-root-in-.cargo-config.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a04e95bc4f807139bd3c4b75f46fd9a60ec1db8f Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 7 Dec 2018 13:59:03 -0800 -Subject: [PATCH 13/19] Set the install root in .cargo/config - ---- - data/macros.cargo | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index e760721..9a9ce6a 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -20,6 +20,9 @@ rustc = "%{__rustc}"\ - rustdoc = "%{__rustdoc}"\ - rustflags = %{__global_rustflags_toml}\ - \ -+[install]\ -+root = "%{buildroot}%{_prefix}"\ -+\ - [term]\ - verbose = true\ - \ -@@ -81,7 +84,6 @@ if %__cargo_is_bin; then \ - %{shrink:%{__cargo} install \ - %{__cargo_common_opts} \ - --path . \ -- --root %{buildroot}%{_prefix} \ - %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ - %* \ - }\ --- -2.21.0 - diff --git a/0014-licensing-fix-zlib-license-translation.patch b/0014-licensing-fix-zlib-license-translation.patch deleted file mode 100644 index a04f0db..0000000 --- a/0014-licensing-fix-zlib-license-translation.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 7c00b0f29085166b1a89aec766945b10dc7aca23 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Sat, 1 Dec 2018 15:40:08 +0100 -Subject: [PATCH 14/19] licensing: fix zlib license translation - -The file was mangled, and something about "teeworlds" was inserted -into the line for zlib. The spdx database doesn't list "teeworlds -license", so let's just remove that part. -Both [1] and [2] agree that "zlib" and "zlib license" are the same thing. - -[1] https://spdx.org/licenses/Zlib -[2] https://fedoraproject.org/wiki/Licensing:Main#Good_Licenses - -Fixes #61. ---- - rust2rpm/spdx_to_fedora.csv | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv -index 829571a..1ca5a7e 100644 ---- a/rust2rpm/spdx_to_fedora.csv -+++ b/rust2rpm/spdx_to_fedora.csv -@@ -306,8 +306,7 @@ Zed License,Zed,Zed,,, - Zend License v2.0,Zend-2.0,Zend,,, - Zimbra Public License v1.3,Zimbra-1.3,,,Fedora bad list, - Zimbra Public License v1.4,Zimbra-1.4,,,not on Fedora list, --zlib License,Zlib,"zlib --Teeworlds",,,Teeworlds License -+zlib License,Zlib,zlib,,, - zlib/libpng License with Acknowledgement,zlib-acknowledgement,zlib with acknowledgement,,, - Zope Public License 1.1,ZPL-1.1,,,This specific version not on Fedora list, - Zope Public License 2.0,ZPL-2.0,ZPLv2.0,,, --- -2.21.0 - diff --git a/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch b/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch deleted file mode 100644 index ffe83aa..0000000 --- a/0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch +++ /dev/null @@ -1,31 +0,0 @@ -From b0d2756917b380a5d66d2407dbeb8891c51875e8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Sat, 1 Dec 2018 15:46:08 +0100 -Subject: [PATCH 15/19] licensing: rename EPL to EPL-1.0 and add EPL-2.0 - -According to https://fedoraproject.org/wiki/Licensing:Main#Software_License_List -EPL-1.0 and EPL-2.0 are the short tags that should be used now. -(C.f. https://spdx.org/licenses/EPL-2.0.html.) - -Fixes #64. ---- - rust2rpm/spdx_to_fedora.csv | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv -index 1ca5a7e..c42e66e 100644 ---- a/rust2rpm/spdx_to_fedora.csv -+++ b/rust2rpm/spdx_to_fedora.csv -@@ -112,7 +112,8 @@ DOC License,DOC,DOC,,, - Dotseqn License,Dotseqn,Dotseqn,,, - DSDP License,DSDP,DSDP,,, - dvipdfm License,dvipdfm,dvipdfm,,, --Eclipse Public License 1.0,EPL-1.0,EPL,,, -+Eclipse Public License 1.0,EPL-1.0,EPL-1.0,,, -+Eclipse Public License 2.0,EPL-2.0,EPL-2.0,,, - Educational Community License v1.0,ECL-1.0,ECL 1.0,,, - Educational Community License v2.0,ECL-2.0,ECL 2.0,,, - eGenix.com Public License 1.1.0,eGenix,eGenix,,, --- -2.21.0 - diff --git a/0016-Add-support-for-prerelease-versions.patch b/0016-Add-support-for-prerelease-versions.patch deleted file mode 100644 index cbffd10..0000000 --- a/0016-Add-support-for-prerelease-versions.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 00c0c5cec90d5d6abbfd4acb2f5d65439b4bfd27 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sat, 26 Jan 2019 08:33:37 +0100 -Subject: [PATCH 16/19] Add support for prerelease versions - -Signed-off-by: Igor Gnatenko ---- - data/macros.rust-srpm | 38 ++++++++++++++++++++++++++++++++++++ - rust2rpm/metadata.py | 18 +++++++++++------ - rust2rpm/templates/main.spec | 10 +++------- - test.py | 8 ++++++++ - 4 files changed, 61 insertions(+), 13 deletions(-) - -diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm -index f2bae9d..872b87f 100644 ---- a/data/macros.rust-srpm -+++ b/data/macros.rust-srpm -@@ -1 +1,39 @@ - %rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x -+%version_no_tilde() %{lua: -+ local sep = rpm.expand('%1') -+ local ver = rpm.expand('%2') -+\ -+ if sep == '%1' then -+ sep = '-' -+ end -+\ -+ if ver == '%2' then -+ ver = rpm.expand('%version') -+ end -+ ver = ver:gsub('~', sep) -+\ -+ print(ver) -+} -+%__crates_url https://crates.io/api/v1/crates/ -+%crates_source() %{lua: -+ local crate = rpm.expand('%1') -+ local version = rpm.expand('%2') -+ local url = rpm.expand('%__crates_url') -+\ -+ if crate == '%1' then -+ crate = rpm.expand('%real_crate') -+ end -+ if crate == '%real_crate' then -+ crate = rpm.expand('%crate') -+ end -+ if crate == '%crate' then -+ crate = rpm.expand('%name') -+ end -+\ -+ if version == '%2' then -+ version = rpm.expand('%version') -+ end -+ version = version:gsub('~', '-') -+\ -+ print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate') -+} -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 328b67a..f0718d5 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -45,11 +45,13 @@ class Dependency: - # Any means any - continue - ver = req.spec -- if ver.prerelease: -- raise NotImplementedError(f"Pre-release requirement is not supported: {ver}") - if req.kind in (req.KIND_NEQ, req.KIND_EMPTY): - raise NotImplementedError(f"'!=' and empty kinds are not supported: {req}") -- coerced = semver.Version.coerce(str(ver)) -+ coerced = str(semver.Version.coerce(str(ver))) -+ if ver.prerelease: -+ coerced = coerced.replace("-", "~") -+ # This will advance us to closest stable version (2.0.0-beta.6 → 2.0.0) -+ ver = ver.next_patch() - if req.kind == req.KIND_EQUAL: - req.kind = req.KIND_SHORTEQ - if req.kind in (req.KIND_CARET, req.KIND_COMPATIBLE): -@@ -107,7 +109,11 @@ class Dependency: - class Metadata: - def __init__(self, name, version): - self.name = name -- self.version = version -+ self._version = version -+ version_normalized = Dependency._normalize_req(f"={self._version}") -+ if len(version_normalized) != 1: -+ raise Exception(f"Incorrect version: {self._version}") -+ self.version = version_normalized[0][1] - self.license = None - self.license_file = None - self.readme = None -@@ -187,7 +193,7 @@ class Metadata: - def provides(self, feature=None): - if feature not in self.dependencies: - raise KeyError(f"Feature {feature!r} doesn't exist") -- return Dependency(self.name, f"={self.version}", features={feature}) -+ return Dependency(self.name, f"={self._version}", features={feature}) - - @classmethod - def _resolve(cls, deps_by_feature, feature): -@@ -207,7 +213,7 @@ class Metadata: - return self._resolve(self.dependencies, feature)[1] - else: - features, deps = self.dependencies[feature] -- fdeps = set(Dependency(self.name, f"={self.version}", features={feature}) -+ fdeps = set(Dependency(self.name, f"={self._version}", features={feature}) - for feature in features) - return fdeps | deps - -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 84bd97d..1ebef7b 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -31,11 +31,7 @@ License: {{ license|default("# FIXME") }} - {{ license_comments }} - {% endif %} - URL: https://crates.io/crates/{{ crate }} --{% if md.name != crate %} --Source0: https://crates.io/api/v1/crates/%{real_crate}/%{version}/download#/%{crate}-%{version}.crate --{% else %} --Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate --{% endif %} -+Source: %{crates_source} - {% if patch_file is not none %} - {% if target == "opensuse" %} - # PATCH-FIX-OPENSUSE {{ patch_file }} -- Initial patched metadata -@@ -161,9 +157,9 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c - - %prep - {% if md.name != crate %} --%autosetup -n %{real_crate}-%{version} -p1 -+%autosetup -n %{real_crate}-%{version_no_tilde} -p1 - {% else %} --%autosetup -n %{crate}-%{version} -p1 -+%autosetup -n %{crate}-%{version_no_tilde} -p1 - {% endif %} - %cargo_prep - -diff --git a/test.py b/test.py -index 30263b4..035df79 100644 ---- a/test.py -+++ b/test.py -@@ -37,6 +37,14 @@ import rust2rpm - "crate(test) = 1.2.3"), - (">= 1.2, < 1.5", - "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"), -+ ("^2.0.0-alpha.6", -+ "(crate(test) >= 2.0.0~alpha.6 with crate(test) < 3.0.0)"), -+ ("^0.1.0-alpha.6", -+ "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0)"), -+ ("^0.0.1-alpha.6", -+ "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2)"), -+ ("^0.0.0-alpha.6", -+ "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1)"), - ]) - def test_dependency(req, rpmdep): - dep = rust2rpm.Dependency("test", req) --- -2.21.0 - diff --git a/0017-data-Cargo-doesn-t-escape-paths-with-space.patch b/0017-data-Cargo-doesn-t-escape-paths-with-space.patch deleted file mode 100644 index 0d031b0..0000000 --- a/0017-data-Cargo-doesn-t-escape-paths-with-space.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 84a73bfa24ce11602a1f19554dc495125be4d0aa Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sun, 17 Feb 2019 17:19:25 +0100 -Subject: [PATCH 17/19] data: Cargo doesn't escape paths with space - -When building matrixmultiply v0.2.2: - -BUILDSTDERR: /usr/bin/cp: cannot stat 'spare': No such file or directory -BUILDSTDERR: /usr/bin/cp: failed to get attributes of 'kernels': No such file or directory - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 9a9ce6a..9a375d0 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -74,7 +74,7 @@ if %__cargo_is_lib; then \ - CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ - REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ - %{__mkdir} -p $REG_DIR \ -- %{__cargo} package -l | xargs %{__cp} --parents -a -t $REG_DIR \ -+ %{__cargo} package -l | xargs -d '\n' %{__cp} --parents -a -t $REG_DIR \ - %if ! %{with check} \ - %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ - %endif \ --- -2.21.0 - diff --git a/0018-data-Escape-n-properly.patch b/0018-data-Escape-n-properly.patch deleted file mode 100644 index c9bffdf..0000000 --- a/0018-data-Escape-n-properly.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 7f0a499ff3fca046869ab754151ae068903c4ab9 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sun, 10 Mar 2019 10:14:28 +0100 -Subject: [PATCH 18/19] data: Escape `\n` properly - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 9a375d0..96dc354 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -74,7 +74,7 @@ if %__cargo_is_lib; then \ - CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ - REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ - %{__mkdir} -p $REG_DIR \ -- %{__cargo} package -l | xargs -d '\n' %{__cp} --parents -a -t $REG_DIR \ -+ %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ - %if ! %{with check} \ - %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ - %endif \ --- -2.21.0 - diff --git a/0019-Do-not-pull-optional-dependencies.patch b/0019-Do-not-pull-optional-dependencies.patch deleted file mode 100644 index 814c920..0000000 --- a/0019-Do-not-pull-optional-dependencies.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 604938a8bab778c58333643c3e069533327699e2 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sat, 9 Mar 2019 22:04:49 +0100 -Subject: [PATCH 19/19] Do not pull optional dependencies - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 20 +++++++++++--------- - rust2rpm/templates/main.spec | 5 ----- - 2 files changed, 11 insertions(+), 14 deletions(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 96dc354..999d787 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -2,8 +2,10 @@ - # https://github.com/rust-lang/cargo/issues/6397 - # But we can set CARGO_HOME locally, which is a good idea anyway to make sure - # it never writes to ~/.cargo during rpmbuild. --%__cargo %{_bindir}/env CARGO_HOME=.cargo %{_bindir}/cargo --%__cargo_common_opts %{?_smp_mflags} -+# We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps -+# until it gets stabilized: https://github.com/rust-lang/cargo/issues/5133 -+%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo -+%__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps - %__cargo_inspector %{_bindir}/cargo-inspector - - %cargo_registry %{_datadir}/cargo/registry -@@ -36,10 +38,6 @@ registry = "https://crates.io"\ - replace-with = "local-registry"\ - EOF\ - %{__rm} -f Cargo.lock \ --%if ! %{with check} \ --# https://github.com/rust-lang/cargo/issues/3732 \ --%{__awk} -i inplace -v INPLACE_SUFFIX=.orig '/^\\\[dev-dependencies/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ --%endif \ - ) - - %__cargo_parse_opts(naf:) %{shrink:\ -@@ -74,10 +72,14 @@ if %__cargo_is_lib; then \ - CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \ - REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \ - %{__mkdir} -p $REG_DIR \ -+# Drop all dependency/features information \ -+# so that cargo doesn't fail resolving dependencies: \ -+# https://github.com/rust-lang/cargo/pull/6729 \ -+ %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ - %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ --%if ! %{with check} \ -- %{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \ --%endif \ -+ %{__mv} Cargo.toml{.deps,} \ -+ %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \ -+ %{__rm} -f $REG_DIR/Cargo.toml.orig \ - echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ - fi \ - if %__cargo_is_bin; then \ -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 1ebef7b..f0c5445 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -44,12 +44,7 @@ Patch0: {{ patch_file }} - ExclusiveArch: %{rust_arches} - - BuildRequires: rust-packaging --{# We will put all non-optional and optional dependencies until -- https://github.com/rust-lang/cargo/issues/5133 -- is solved - {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} --#} --{% set buildrequires = normalize_deps(md.all_dependencies)|sort %} - {% for req in buildrequires %} - BuildRequires: {{ req }} - {% endfor %} --- -2.21.0 - diff --git a/rust-packaging.spec b/rust-packaging.spec index 7412fdf..f9db08f 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,33 +4,13 @@ %global debug_package %{nil} Name: rust-packaging -Version: 6 -Release: 28%{?dist} +Version: 7 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -Patch0001: 0001-name-spec-patch_file-by-real-crate-name.patch -Patch0002: 0002-generate-doc-statements.patch -Patch0003: 0003-do-better-for-renamed-crates.patch -Patch0004: 0004-remove-pre-3.6-leftovers.patch -Patch0005: 0005-Remove-half-downloaded-crate-on-C.patch -Patch0006: 0006-Throw-an-error-if-s-is-used-without-a-crate.patch -Patch0007: 0007-split-features-into-subpackages.patch -Patch0008: 0008-add-support-for-dependencies-with-same-name.patch -Patch0009: 0009-add-support-for-feeding-user-configuration.patch -Patch0010: 0010-trivial-use-f-strings-everywhere.patch -Patch0011: 0011-Add-option-to-not-generate-a-default-changelog-entry.patch -Patch0012: 0012-Set-CARGO_HOME-to-the-local-.config.patch -Patch0013: 0013-Set-the-install-root-in-.cargo-config.patch -Patch0014: 0014-licensing-fix-zlib-license-translation.patch -Patch0015: 0015-licensing-rename-EPL-to-EPL-1.0-and-add-EPL-2.0.patch -Patch0016: 0016-Add-support-for-prerelease-versions.patch -Patch0017: 0017-data-Cargo-doesn-t-escape-paths-with-space.patch -Patch0018: 0018-data-Escape-n-properly.patch -# https://pagure.io/fedora-rust/rust2rpm/pull-request/68 -Patch0019: 0019-Do-not-pull-optional-dependencies.patch ExclusiveArch: %{rust_arches} @@ -53,7 +33,6 @@ BuildRequires: python3-setuptools BuildRequires: python3-pytest BuildRequires: cargo BuildRequires: python3dist(semantic-version) -BuildRequires: python3dist(rustcfg) %endif Requires: cargo Provides: rust2rpm = %{version}-%{release} @@ -91,6 +70,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index 9f6fa6f..bd3fb1f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-6.tar.xz) = 408988351156d858f7429d990d7330f216b54add671c6e90e54917e717ad6f2b3b99e414289c252e6a2b5dfad73ce430ac73f03265f6e174ef53edcee34d0fe2 +SHA512 (rust2rpm-7.tar.xz) = 8ef6d882cdb44673a60fac51e43d3ed6913e1df70e5e5596c4b4464c5361bf16cad66b9380eea2cf95ddcacfb1ca0291a20e0fac757756ddcd63bb9dd7dc9e93 From d833ac8b68a7986b43fa47d63ddef32a902f7a8f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 23 Apr 2019 21:18:43 +0200 Subject: [PATCH 46/96] Update to 8 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + rust-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index aa71c2c..4caa509 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /rust2rpm-5.tar.xz /rust2rpm-6.tar.xz /rust2rpm-7.tar.xz +/rust2rpm-8.tar.xz diff --git a/rust-packaging.spec b/rust-packaging.spec index f9db08f..df5cab2 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ %global debug_package %{nil} Name: rust-packaging -Version: 7 +Version: 8 Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures @@ -70,6 +70,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index bd3fb1f..673e133 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-7.tar.xz) = 8ef6d882cdb44673a60fac51e43d3ed6913e1df70e5e5596c4b4464c5361bf16cad66b9380eea2cf95ddcacfb1ca0291a20e0fac757756ddcd63bb9dd7dc9e93 +SHA512 (rust2rpm-8.tar.xz) = 43b6bc664e456861557bd075e26855d5bf328c6adc2e20a55a378d40208f4e2b6c9ede02f55833f9bd7e67d0b354432cfb24b503d5ca84e73e9c7a41c048949c From 86b1326176be07f628a303eb54f10da6912f77f3 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 5 May 2019 09:19:39 +0200 Subject: [PATCH 47/96] Update to 9 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + rust-packaging.spec | 7 ++++++- sources | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4caa509..b86ab64 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /rust2rpm-6.tar.xz /rust2rpm-7.tar.xz /rust2rpm-8.tar.xz +/rust2rpm-9.tar.xz diff --git a/rust-packaging.spec b/rust-packaging.spec index df5cab2..8019a55 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ %global debug_package %{nil} Name: rust-packaging -Version: 8 +Version: 9 Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures @@ -43,6 +43,7 @@ Provides: rust2rpm = %{version}-%{release} %prep %autosetup -n rust2rpm-%{version} -p1 +sed -i -e '/# Generated by/s/$/-%{version}-%{release}/' rust2rpm/templates/main.spec %build %py3_build @@ -58,6 +59,7 @@ py.test-%{python3_version} -vv test.py %endif %files +%license LICENSE %{_rpmmacrodir}/macros.rust %{_rpmmacrodir}/macros.cargo %{_fileattrsdir}/cargo.attr @@ -70,6 +72,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index 673e133..4561ec6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-8.tar.xz) = 43b6bc664e456861557bd075e26855d5bf328c6adc2e20a55a378d40208f4e2b6c9ede02f55833f9bd7e67d0b354432cfb24b503d5ca84e73e9c7a41c048949c +SHA512 (rust2rpm-9.tar.xz) = 64ba9f22aa7a205c4e418783689cb3d380d32d7358c2a5162713a6425cc6ea7fb0b0c82698b89934368b3b7961589e6b332655bda5c9b64fc2dc5488cf8b0c5e From e5f9309d3e54e74cc1f2c1fe7af54a7976750251 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 8 Jun 2019 20:23:25 +0200 Subject: [PATCH 48/96] Backport patches from upstream Signed-off-by: Igor Gnatenko --- ...o-not-put-empty-line-after-changelog.patch | 26 +++ 0002-licensing-translate-GPL-123.patch | 43 ++++ ...d-or-later-variants-for-GPL-licenses.patch | 32 +++ ...ve-version-string-to-the-python-code.patch | 48 +++++ ...-release-in-addition-to-etc-os-relea.patch | 31 +++ ...-version-info-in-the-generated-spec-.patch | 47 +++++ 0007-Bump-classifiers.patch | 34 ++++ 0008-Mangle-summary-automagically.patch | 85 ++++++++ 0009-Use-expand-for-description.patch | 41 ++++ 0010-Remove-more-common-prefixes.patch | 25 +++ ...later-and-automatically-translate-su.patch | 73 +++++++ ...cense-to-translate-a-specific-licens.patch | 50 +++++ 0013-Implement-__cargo_skip_build.patch | 189 ++++++++++++++++++ ...dArch-noarch-with-__cargo_skip_build.patch | 30 +++ rust-packaging.spec | 20 +- 15 files changed, 772 insertions(+), 2 deletions(-) create mode 100644 0001-templates-Do-not-put-empty-line-after-changelog.patch create mode 100644 0002-licensing-translate-GPL-123.patch create mode 100644 0003-licensing-add-or-later-variants-for-GPL-licenses.patch create mode 100644 0004-Move-version-string-to-the-python-code.patch create mode 100644 0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch create mode 100644 0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch create mode 100644 0007-Bump-classifiers.patch create mode 100644 0008-Mangle-summary-automagically.patch create mode 100644 0009-Use-expand-for-description.patch create mode 100644 0010-Remove-more-common-prefixes.patch create mode 100644 0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch create mode 100644 0012-Add-translate-license-to-translate-a-specific-licens.patch create mode 100644 0013-Implement-__cargo_skip_build.patch create mode 100644 0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch diff --git a/0001-templates-Do-not-put-empty-line-after-changelog.patch b/0001-templates-Do-not-put-empty-line-after-changelog.patch new file mode 100644 index 0000000..00bd68f --- /dev/null +++ b/0001-templates-Do-not-put-empty-line-after-changelog.patch @@ -0,0 +1,26 @@ +From b1df4d587fb03dcaedd7e8f29fbe5b7265ea5638 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 6 May 2019 10:43:05 +0200 +Subject: [PATCH 01/14] templates: Do not put empty line after %changelog + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/templates/main.spec | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index dcd24ca..0c84325 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -183,6 +183,7 @@ echo {{ "%r"|format(req) }} + %endif + + %changelog +-{% if auto_changelog_entry %} ++{%- if auto_changelog_entry %} ++ + {% include target ~ "-changelog.spec.inc" %} + {% endif %} +-- +2.22.0.rc3 + diff --git a/0002-licensing-translate-GPL-123.patch b/0002-licensing-translate-GPL-123.patch new file mode 100644 index 0000000..559941f --- /dev/null +++ b/0002-licensing-translate-GPL-123.patch @@ -0,0 +1,43 @@ +From 1f64bd9564c0cc27d23f5dc5e523f0db46496644 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 6 May 2019 22:08:07 +0200 +Subject: [PATCH 02/14] licensing: translate GPL[123]+ + +The "+" variants were described in the comment, but not explicitly +listed in the table. Let's just replace the comment with +machine-readable lines. + +Fixes #79. +--- + rust2rpm/spdx_to_fedora.csv | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv +index c42e66e..4fc3321 100644 +--- a/rust2rpm/spdx_to_fedora.csv ++++ b/rust2rpm/spdx_to_fedora.csv +@@ -141,15 +141,12 @@ GNU Affero General Public License v3.0,AGPL-3.0,AGPLv3,Affero General Public Lic + GNU Free Documentation License v1.1,GFDL-1.1,,,This specific version not on Fedora list, + GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedora list, + GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,, +-GNU General Public License v1.0 only,GPL-1.0,GPLv1,,"For “or later” add + to SPDX or Fedora short identifier: +-SPDX: GPL-1.0+ +-Fedora: GPLv1+ or GPL+", +-GNU General Public License v2.0 only,GPL-2.0,GPLv2,,"For “or later” add + to SPDX or Fedora short identifier: +-SPDX: GPL-2.0+ +-Fedora: GPLv2+", +-GNU General Public License v3.0 only,GPL-3.0,GPLv3,,"For “or later” add + to SPDX or Fedora short identifier: +-SPDX: GPL-3.0+ +-Fedora: GPLv3+", ++GNU General Public License v1.0 only,GPL-1.0,GPLv1,,, ++GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,, ++GNU General Public License v2.0 only,GPL-2.0,GPLv2,,, ++GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,, ++GNU General Public License v3.0 only,GPL-3.0,GPLv3,,, ++GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,, + GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, + GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,, + GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,, +-- +2.22.0.rc3 + diff --git a/0003-licensing-add-or-later-variants-for-GPL-licenses.patch b/0003-licensing-add-or-later-variants-for-GPL-licenses.patch new file mode 100644 index 0000000..6ac4be3 --- /dev/null +++ b/0003-licensing-add-or-later-variants-for-GPL-licenses.patch @@ -0,0 +1,32 @@ +From 8d21ef1ee4152294c3e9df451404db7c732fb415 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 7 May 2019 08:32:25 +0200 +Subject: [PATCH 03/14] licensing: add "-or-later" variants for GPL licenses + +SPDX actually deprecated the variants with "+" and "-or-later" is now +recommneded. They both map to the same identiefiers on Fedora side. +--- + rust2rpm/spdx_to_fedora.csv | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv +index 4fc3321..a3f9604 100644 +--- a/rust2rpm/spdx_to_fedora.csv ++++ b/rust2rpm/spdx_to_fedora.csv +@@ -143,10 +143,13 @@ GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedo + GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,, + GNU General Public License v1.0 only,GPL-1.0,GPLv1,,, + GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,, ++GNU General Public License v1.0 or later,GPL-1.0-or-later,GPLv1+,,, + GNU General Public License v2.0 only,GPL-2.0,GPLv2,,, + GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,, ++GNU General Public License v2.0 or later,GPL-2.0-or-later,GPLv2+,,, + GNU General Public License v3.0 only,GPL-3.0,GPLv3,,, + GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,, ++GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,, + GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, + GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,, + GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,, +-- +2.22.0.rc3 + diff --git a/0004-Move-version-string-to-the-python-code.patch b/0004-Move-version-string-to-the-python-code.patch new file mode 100644 index 0000000..9f04d6c --- /dev/null +++ b/0004-Move-version-string-to-the-python-code.patch @@ -0,0 +1,48 @@ +From aa9fc8646a4bcf43bba544d37c2f6e6e59b1bebb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 6 May 2019 22:34:02 +0200 +Subject: [PATCH 04/14] Move version string to the python code + +This way the python module "knows" its own version. To avoid duplication, +read the value back from setup.py. The reader function only needs to +support the specific format used in the code, so it can be very simplistic. +--- + rust2rpm/__init__.py | 2 ++ + setup.py | 11 ++++++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/rust2rpm/__init__.py b/rust2rpm/__init__.py +index 6aba575..4a0db7b 100644 +--- a/rust2rpm/__init__.py ++++ b/rust2rpm/__init__.py +@@ -1,2 +1,4 @@ + from .metadata import * + from . import licensing ++ ++__version__ = '9' +diff --git a/setup.py b/setup.py +index 3eb2a77..79367da 100644 +--- a/setup.py ++++ b/setup.py +@@ -1,8 +1,17 @@ + from setuptools import setup + ++def read_version(path): ++ with open(path, 'rt') as f: ++ for line in f: ++ if line.startswith('__version__'): ++ return line.split("'")[1] ++ raise IOError ++ ++version = read_version('rust2rpm/__init__.py') ++ + ARGS = dict( + name="rust2rpm", +- version="9", ++ version=version, + description="Convert Rust crates to RPM", + license="MIT", + keywords="rust cargo rpm", +-- +2.22.0.rc3 + diff --git a/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch b/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch new file mode 100644 index 0000000..ed5472f --- /dev/null +++ b/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch @@ -0,0 +1,31 @@ +From 253d1f6021765051c26d4427967786040d215853 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 6 May 2019 22:36:43 +0200 +Subject: [PATCH 05/14] Check /usr/lib/os-release in addition to + /etc/os-release + +--- + rust2rpm/__main__.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index b307505..b8d3772 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -34,8 +34,11 @@ JINJA_ENV = jinja2.Environment( + lstrip_blocks=True) + + def get_default_target(): +- # TODO: add fallback for /usr/lib/os-release +- with open("/etc/os-release") as os_release_file: ++ try: ++ os_release_file = open('/etc/os-release') ++ except FileNotFoundError: ++ os_release_file = open('/usr/lib/os-release') ++ with os_release_file: + conf = configparser.ConfigParser() + conf.read_file(itertools.chain(["[os-release]"], os_release_file)) + os_release = conf["os-release"] +-- +2.22.0.rc3 + diff --git a/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch b/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch new file mode 100644 index 0000000..7f332f9 --- /dev/null +++ b/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch @@ -0,0 +1,47 @@ +From 6de75b87af4bd86d87dfee038f5b6cdf99437a7c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 6 May 2019 22:44:55 +0200 +Subject: [PATCH 06/14] Include rust2rpm version info in the generated spec + file + +Fixes #77. +--- + rust2rpm/__main__.py | 3 ++- + rust2rpm/templates/main.spec | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index b8d3772..a7674fd 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -17,7 +17,7 @@ import jinja2 + import requests + import tqdm + +-from . import Metadata, licensing ++from . import Metadata, licensing, __version__ + from .metadata import normalize_deps + + DEFAULT_EDITOR = "vi" +@@ -265,6 +265,7 @@ def main(): + patch_file = None + + kwargs = {} ++ kwargs["generator_version"] = __version__ + kwargs["crate"] = crate + kwargs["target"] = args.target + kwargs["all_features"] = args.all_features +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 0c84325..0ef0b10 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -1,5 +1,5 @@ + {% include target ~ "-header.spec.inc" ignore missing %} +-# Generated by rust2rpm ++# Generated by rust2rpm {{ generator_version }} + %bcond_without check + {% if not include_main %} + %global debug_package %{nil} +-- +2.22.0.rc3 + diff --git a/0007-Bump-classifiers.patch b/0007-Bump-classifiers.patch new file mode 100644 index 0000000..6967f8d --- /dev/null +++ b/0007-Bump-classifiers.patch @@ -0,0 +1,34 @@ +From 36663449594b33ec4b0c0ae9ea568cad819bb920 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 6 May 2019 22:47:06 +0200 +Subject: [PATCH 07/14] Bump classifiers + +This software is used, so let's at least it's beta. +Seems to work fine with python3.8, let's say that. +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 79367da..b5b1157 100644 +--- a/setup.py ++++ b/setup.py +@@ -44,13 +44,14 @@ ARGS = dict( + author_email="ignatenkobrain@fedoraproject.org", + url="https://pagure.io/fedora-rust/rust2rpm", + classifiers=[ +- "Development Status :: 3 - Alpha", ++ "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", ++ "Programming Language :: Python :: 3.8", + "Topic :: Software Development :: Build Tools", + "Topic :: System :: Software Distribution", + "Topic :: Utilities", +-- +2.22.0.rc3 + diff --git a/0008-Mangle-summary-automagically.patch b/0008-Mangle-summary-automagically.patch new file mode 100644 index 0000000..9f6fbcc --- /dev/null +++ b/0008-Mangle-summary-automagically.patch @@ -0,0 +1,85 @@ +From 216de8e4271f9dbca1f009e8c0e046a7f5a198fd Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 15 May 2019 08:01:46 +0200 +Subject: [PATCH 08/14] Mangle summary automagically + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/metadata.py | 35 ++++++++++++++++++++++++++++++++++- + rust2rpm/templates/main.spec | 3 +-- + 2 files changed, 35 insertions(+), 3 deletions(-) + +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index 77c2932..e41902d 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -3,6 +3,7 @@ __all__ = ["Dependency", "Metadata"] + import collections + import copy + import json ++import re + import subprocess + + import semantic_version as semver +@@ -116,11 +117,43 @@ class Metadata: + self.license = None + self.license_file = None + self.readme = None +- self.description = None ++ self._description = None ++ self._summary = None + self.targets = set() + self.dependencies = {} + self.dev_dependencies = set() + ++ @property ++ def description(self): ++ return self._description ++ ++ @property ++ def summary(self): ++ return self._summary ++ ++ @description.setter ++ def description(self, description): ++ # https://salsa.debian.org/rust-team/debcargo/blob/master/src/crates.rs ++ # get_summary_description() ++ if description is None: ++ self._description = self._summary = None ++ return ++ description = description.replace('\n\n', '\r').replace('\n', ' ').replace('\r', '\n').strip() ++ description = re.sub(r'^(?:a|an|the)\s+', '', description, flags=re.I) ++ description = f'{description[0].upper()}{description[1:]}' ++ if description[-1] != '.': ++ description = f'{description}.' ++ ++ p1 = description.find('.') ++ p2 = description.find('\n') ++ if p2 != -1: ++ p = min(p1, p2) ++ else: ++ p = p1 ++ ++ self._description = description ++ self._summary = description[:p] ++ + @classmethod + def from_json(cls, metadata): + md = metadata +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 0ef0b10..803b74e 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -16,8 +16,7 @@ Release: {{ pkg_release }} + {% if md.description is none %} + Summary: # FIXME + {% else %} +-{% set description_lines = md.description.split("\n") %} +-Summary: {{ description_lines|join(" ")|trim }} ++Summary: {{ md.summary }} + {% endif %} + {% if rust_group is defined %} + Group: {{ rust_group }} +-- +2.22.0.rc3 + diff --git a/0009-Use-expand-for-description.patch b/0009-Use-expand-for-description.patch new file mode 100644 index 0000000..c2ecfdf --- /dev/null +++ b/0009-Use-expand-for-description.patch @@ -0,0 +1,41 @@ +From 16085843c800827526ab78354bacdd6bd388993f Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 15 May 2019 08:07:18 +0200 +Subject: [PATCH 09/14] =?UTF-8?q?Use=20%{expand:=E2=80=A6}=20for=20descrip?= + =?UTF-8?q?tion?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So that we stop playing with escaping. + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/templates/main.spec | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 803b74e..660bb60 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -64,12 +64,13 @@ BuildRequires: {{ req }} + {% endfor %} + {% endif %} + +-%global _description \ ++%global _description %{expand: + {% if md.description is none %} + %{summary}. +-{% else %} +-{{ md.description|wordwrap(wrapstring="\\\n")|trim }} +-{% endif %} ++{%- else %} ++{{ md.description|wordwrap }} ++{%- endif %} ++} + + %description %{_description} + +-- +2.22.0.rc3 + diff --git a/0010-Remove-more-common-prefixes.patch b/0010-Remove-more-common-prefixes.patch new file mode 100644 index 0000000..c22444a --- /dev/null +++ b/0010-Remove-more-common-prefixes.patch @@ -0,0 +1,25 @@ +From e1cfff321693432f19a9a1303431b2ce4ec4edc9 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 15 May 2019 20:00:59 +0200 +Subject: [PATCH 10/14] Remove more common prefixes + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/metadata.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index e41902d..1b4faad 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -139,6 +139,7 @@ class Metadata: + self._description = self._summary = None + return + description = description.replace('\n\n', '\r').replace('\n', ' ').replace('\r', '\n').strip() ++ description = re.sub(rf'^(?:{self.name}|This(?:\s+\w+)?)(?:\s*,|\s+is|\s+provides)\s+', '', description, flags=re.I) + description = re.sub(r'^(?:a|an|the)\s+', '', description, flags=re.I) + description = f'{description[0].upper()}{description[1:]}' + if description[-1] != '.': +-- +2.22.0.rc3 + diff --git a/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch b/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch new file mode 100644 index 0000000..6679e3a --- /dev/null +++ b/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch @@ -0,0 +1,73 @@ +From 04f63e0f20d6b517119053c6bc00aa8be3c3a19f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sun, 2 Jun 2019 15:48:45 +0200 +Subject: [PATCH 11/14] Add AGPL-3.0-or-later and automatically translate "+" + suffix into "-or-later" + +This way we don't need to add all the deprecated variants with "+" suffix. + +Fixes #84. +--- + rust2rpm/licensing.py | 14 ++++++++++---- + rust2rpm/spdx_to_fedora.csv | 4 +--- + 2 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/rust2rpm/licensing.py b/rust2rpm/licensing.py +index 233903e..6ca4e45 100644 +--- a/rust2rpm/licensing.py ++++ b/rust2rpm/licensing.py +@@ -35,18 +35,24 @@ def translate_license_fedora(license): + elif tag.upper() == 'AND': + final.append('and') + else: +- mapped = spdx_to_fedora_map().get(tag, None) ++ if tag.endswith('+'): ++ key = tag[:-1] + '-or-later' ++ fulltag = f'{tag} ({key})' ++ else: ++ key = fulltag = tag ++ ++ mapped = spdx_to_fedora_map().get(key, None) + if mapped is None: +- comments += f'# FIXME: Upstream uses unknown SPDX tag {tag}!' ++ comments += f'# FIXME: Upstream uses unknown SPDX tag {fulltag}!' + final.append(tag) + elif mapped == '': +- comments += f"# FIXME: Upstream SPDX tag {tag} not listed in Fedora's good licenses list.\n" ++ comments += f"# FIXME: Upstream SPDX tag {fulltag} not listed in Fedora's good licenses list.\n" + comments += "# FIXME: This package might not be allowed in Fedora!\n" + final.append(tag) + else: + final.append(mapped) + if mapped != tag: +- print(f'Upstream license tag {tag} translated to {mapped}', ++ print(f'Upstream license tag {fulltag} translated to {mapped}', + file=_sys.stderr) + return (' '.join(final), comments or None) + +diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv +index a3f9604..006d80c 100644 +--- a/rust2rpm/spdx_to_fedora.csv ++++ b/rust2rpm/spdx_to_fedora.csv +@@ -138,17 +138,15 @@ Giftware License,Giftware,Giftware,,, + GL2PS License,GL2PS,GL2PS,,, + Glulxe License,Glulxe,Glulxe,,, + GNU Affero General Public License v3.0,AGPL-3.0,AGPLv3,Affero General Public License 3.0,, ++GNU Affero General Public License v3.0 or later,AGPL-3.0-or-later,AGPLv3+,Affero General Public License 3.0 or later,, + GNU Free Documentation License v1.1,GFDL-1.1,,,This specific version not on Fedora list, + GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedora list, + GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,, + GNU General Public License v1.0 only,GPL-1.0,GPLv1,,, +-GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,, + GNU General Public License v1.0 or later,GPL-1.0-or-later,GPLv1+,,, + GNU General Public License v2.0 only,GPL-2.0,GPLv2,,, +-GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,, + GNU General Public License v2.0 or later,GPL-2.0-or-later,GPLv2+,,, + GNU General Public License v3.0 only,GPL-3.0,GPLv3,,, +-GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,, + GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,, + GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, + GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,, +-- +2.22.0.rc3 + diff --git a/0012-Add-translate-license-to-translate-a-specific-licens.patch b/0012-Add-translate-license-to-translate-a-specific-licens.patch new file mode 100644 index 0000000..18e32a2 --- /dev/null +++ b/0012-Add-translate-license-to-translate-a-specific-licens.patch @@ -0,0 +1,50 @@ +From d9b2cef72e129963ac082ec3737a877785232123 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sun, 2 Jun 2019 15:45:13 +0200 +Subject: [PATCH 12/14] Add --translate-license to translate a specific license + +Before, all known licenses would be listed by --show-license-map, so +grepping the list was enough to find a license. But now we support +alternative syntaxes, so this is not enough. Add a call to translate a +specific license: + +$ python3 -m rust2rpm --translate-license GPL-3.0+ +Upstream license tag GPL-3.0+ (GPL-3.0-or-later) translated to GPLv3+ +GPLv3+ + +$ python3 -m rust2rpm --show-license-map | grep -F GPL-3.0+ +(nada) +--- + rust2rpm/__main__.py | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index a7674fd..c55dacc 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -222,6 +222,8 @@ def main(): + formatter_class=argparse.RawTextHelpFormatter) + parser.add_argument("--show-license-map", action="store_true", + help="Print license mappings and exit") ++ parser.add_argument("--translate-license", action="store_true", ++ help="Print mapping for specified license and exit") + parser.add_argument("--no-auto-changelog-entry", action="store_true", + help="Do not generate a changelog entry") + parser.add_argument("-", "--stdout", action="store_true", +@@ -248,6 +250,13 @@ def main(): + licensing.dump_sdpx_to_fedora_map(sys.stdout) + return + ++ if args.translate_license: ++ license, comments = licensing.translate_license(args.target, args.crate) ++ if comments: ++ print(comments) ++ print(license) ++ return ++ + if args.crate is None: + parser.error("required crate/path argument missing") + +-- +2.22.0.rc3 + diff --git a/0013-Implement-__cargo_skip_build.patch b/0013-Implement-__cargo_skip_build.patch new file mode 100644 index 0000000..b4942f3 --- /dev/null +++ b/0013-Implement-__cargo_skip_build.patch @@ -0,0 +1,189 @@ +From 7b06496a5c1ded5e3cf59d6af0e757974c6ff704 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 8 Jun 2019 19:35:38 +0200 +Subject: [PATCH 13/14] Implement %__cargo_skip_build + +We need to have an easy way how to skip doing 'cargo build' to speedup a +module builds. + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 80 ++++++++++++++++++++++++------------ + rust2rpm/templates/main.spec | 34 ++++++++------- + 2 files changed, 72 insertions(+), 42 deletions(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index a60289a..961732d 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -10,6 +10,21 @@ + + %cargo_registry %{_datadir}/cargo/registry + ++# If crate not in _build_crates and _module_build is set, we should skip the build ++%__cargo_skip_build %{lua: ++local crate = rpm.expand('%{crate}') ++local build_crate = false ++for w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do ++ if w == crate then ++ build_crate = true ++ break ++ end ++end ++if (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then ++ print(1) ++else ++ print(0) ++end} + %__cargo_is_lib() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x "$(printf 'lib\\\nrlib\\\nproc-macro')" + %__cargo_is_bin() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x bin + +@@ -49,27 +64,35 @@ EOF\ + } + + %cargo_generate_buildrequires(af:) \ +-%{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \ +-%if %{with check} \ +-%{__cargo_inspector} -TR Cargo.toml \ ++%if ! 0%{?__cargo_skip_build} \ ++ %{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \ ++ %if %{with check} \ ++ %{__cargo_inspector} -TR Cargo.toml \ ++ %endif \ + %endif + +-%cargo_build(naf:) %{shrink:\ +-%{__cargo} build \ +- %{__cargo_common_opts} \ +- --release \ +- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ +- %* \ +-} ++%cargo_build(naf:) \ ++%if ! 0%{?__cargo_skip_build} \ ++ %{shrink:\ ++ %{__cargo} build \ ++ %{__cargo_common_opts} \ ++ --release \ ++ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ ++ } \ ++%endif + +-%cargo_test(naf:) %{shrink:\ +-%{__cargo} test \ +- %{__cargo_common_opts} \ +- --release \ +- --no-fail-fast \ +- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ +- %* \ +-} ++%cargo_test(naf:) \ ++%if ! 0%{?__cargo_skip_build} \ ++ %{shrink:\ ++ %{__cargo} test \ ++ %{__cargo_common_opts} \ ++ --release \ ++ --no-fail-fast \ ++ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ ++ } \ ++%endif + + %cargo_install(t:naf:) (\ + set -eu \ +@@ -88,15 +111,18 @@ if %__cargo_is_lib; then \ + %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \ + echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ + fi \ +-if %__cargo_is_bin; then \ +- %{shrink:%{__cargo} install \ +- %{__cargo_common_opts} \ +- --path . \ +- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ +- %* \ +- }\ +- %{__rm} %{buildroot}%{_prefix}/.crates.toml \ +-fi \ ++%if ! %__cargo_skip_build \ ++ if %__cargo_is_bin; then \ ++ %{shrink:\ ++ %{__cargo} install \ ++ %{__cargo_common_opts} \ ++ --path . \ ++ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ ++ %* \ ++ } \ ++ %{__rm} %{buildroot}%{_prefix}/.crates.toml \ ++ fi \ ++%endif \ + ) + + %__cargo_feature_from_name(n:) %{lua: +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 660bb60..69d23d7 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -42,26 +42,28 @@ ExclusiveArch: %{rust_arches} + + BuildRequires: rust-packaging + {% if not generate_buildrequires %} +-{% if not all_features %} +-{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} +-{% else %} +-{% set buildrequires = normalize_deps(md.all_dependencies)|sort %} +-{% set cargo_args = " -a" %} +-{% endif %} +-{% for req in buildrequires %} ++%if ! %{__cargo_skip_build} ++ {% if not all_features %} ++ {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} ++ {% else %} ++ {% set buildrequires = normalize_deps(md.all_dependencies)|sort %} ++ {% set cargo_args = " -a" %} ++ {% endif %} ++ {% for req in buildrequires %} + BuildRequires: {{ req }} +-{% endfor %} +-{% set testrequires = normalize_deps(md.dev_dependencies)|sort %} +-{% if testrequires|length > 0 %} ++ {% endfor %} ++ {% set testrequires = normalize_deps(md.dev_dependencies)|sort %} ++ {% if testrequires|length > 0 %} + %if %{with check} +- {% for req in testrequires %} ++ {% for req in testrequires %} + BuildRequires: {{ req }} +- {% endfor %} ++ {% endfor %} + %endif +-{% endif %} +-{% for req in to_list(distconf.get("buildrequires"))|sort %} ++ {% endif %} ++ {% for req in to_list(distconf.get("buildrequires"))|sort %} + BuildRequires: {{ req }} +-{% endfor %} ++ {% endfor %} ++%endif + {% endif %} + + %global _description %{expand: +@@ -75,6 +77,7 @@ BuildRequires: {{ req }} + %description %{_description} + + {% if include_main %} ++%if ! %{__cargo_skip_build} + %package -n %{crate} + Summary: %{summary} + {% if rust_group is defined %} +@@ -96,6 +99,7 @@ Requires: {{ req }} + {% for bin in bins %} + %{_bindir}/{{ bin.name }} + {% endfor %} ++%endif + + {% endif -%} + +-- +2.22.0.rc3 + diff --git a/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch b/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch new file mode 100644 index 0000000..63a2895 --- /dev/null +++ b/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch @@ -0,0 +1,30 @@ +From b345d23e7a11357d828751e4db47a0685cfe207b Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 8 Jun 2019 20:01:12 +0200 +Subject: [PATCH 14/14] Set BuildArch: noarch with %__cargo_skip_build + +We do not need to spawn 7 tasks for each architecture to copy same files +over and over. + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/templates/main.spec | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 69d23d7..b4734b7 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -39,6 +39,9 @@ Patch0: {{ patch_file }} + {% endif %} + + ExclusiveArch: %{rust_arches} ++%if ! %{__cargo_skip_build} ++BuildArch: noarch ++%endif + + BuildRequires: rust-packaging + {% if not generate_buildrequires %} +-- +2.22.0.rc3 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 8019a55..1dd8d19 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,12 +5,26 @@ Name: rust-packaging Version: 9 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz +Patch0001: 0001-templates-Do-not-put-empty-line-after-changelog.patch +Patch0002: 0002-licensing-translate-GPL-123.patch +Patch0003: 0003-licensing-add-or-later-variants-for-GPL-licenses.patch +Patch0004: 0004-Move-version-string-to-the-python-code.patch +Patch0005: 0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch +Patch0006: 0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch +Patch0007: 0007-Bump-classifiers.patch +Patch0008: 0008-Mangle-summary-automagically.patch +Patch0009: 0009-Use-expand-for-description.patch +Patch0010: 0010-Remove-more-common-prefixes.patch +Patch0011: 0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch +Patch0012: 0012-Add-translate-license-to-translate-a-specific-licens.patch +Patch0013: 0013-Implement-__cargo_skip_build.patch +Patch0014: 0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch ExclusiveArch: %{rust_arches} @@ -43,7 +57,6 @@ Provides: rust2rpm = %{version}-%{release} %prep %autosetup -n rust2rpm-%{version} -p1 -sed -i -e '/# Generated by/s/$/-%{version}-%{release}/' rust2rpm/templates/main.spec %build %py3_build @@ -72,6 +85,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From f89e4b4d98733ee042ccc889f9f31606991cf094 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 8 Jun 2019 23:08:45 +0200 Subject: [PATCH 49/96] Regenerate patches Signed-off-by: Igor Gnatenko --- 0013-Implement-__cargo_skip_build.patch | 61 ++++++++++--------- ...dArch-noarch-with-__cargo_skip_build.patch | 6 +- rust-packaging.spec | 5 +- 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/0013-Implement-__cargo_skip_build.patch b/0013-Implement-__cargo_skip_build.patch index b4942f3..02df663 100644 --- a/0013-Implement-__cargo_skip_build.patch +++ b/0013-Implement-__cargo_skip_build.patch @@ -1,4 +1,4 @@ -From 7b06496a5c1ded5e3cf59d6af0e757974c6ff704 Mon Sep 17 00:00:00 2001 +From 37cf4d78df2f3805f1f230252e1c0030a2f08877 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 8 Jun 2019 19:35:38 +0200 Subject: [PATCH 13/14] Implement %__cargo_skip_build @@ -8,37 +8,16 @@ module builds. Signed-off-by: Igor Gnatenko --- - data/macros.cargo | 80 ++++++++++++++++++++++++------------ - rust2rpm/templates/main.spec | 34 ++++++++------- - 2 files changed, 72 insertions(+), 42 deletions(-) + data/macros.cargo | 65 +++++++++++++++++++++--------------- + data/macros.rust-srpm | 16 +++++++++ + rust2rpm/templates/main.spec | 34 ++++++++++--------- + 3 files changed, 73 insertions(+), 42 deletions(-) diff --git a/data/macros.cargo b/data/macros.cargo -index a60289a..961732d 100644 +index a60289a..1182850 100644 --- a/data/macros.cargo +++ b/data/macros.cargo -@@ -10,6 +10,21 @@ - - %cargo_registry %{_datadir}/cargo/registry - -+# If crate not in _build_crates and _module_build is set, we should skip the build -+%__cargo_skip_build %{lua: -+local crate = rpm.expand('%{crate}') -+local build_crate = false -+for w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do -+ if w == crate then -+ build_crate = true -+ break -+ end -+end -+if (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then -+ print(1) -+else -+ print(0) -+end} - %__cargo_is_lib() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x "$(printf 'lib\\\nrlib\\\nproc-macro')" - %__cargo_is_bin() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x bin - -@@ -49,27 +64,35 @@ EOF\ +@@ -49,27 +49,35 @@ EOF\ } %cargo_generate_buildrequires(af:) \ @@ -92,7 +71,7 @@ index a60289a..961732d 100644 %cargo_install(t:naf:) (\ set -eu \ -@@ -88,15 +111,18 @@ if %__cargo_is_lib; then \ +@@ -88,15 +96,18 @@ if %__cargo_is_lib; then \ %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \ echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ fi \ @@ -120,6 +99,30 @@ index a60289a..961732d 100644 ) %__cargo_feature_from_name(n:) %{lua: +diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm +index 872b87f..88d5a0f 100644 +--- a/data/macros.rust-srpm ++++ b/data/macros.rust-srpm +@@ -37,3 +37,19 @@ + \ + print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate') + } ++ ++# If crate not in _build_crates and _module_build is set, we should skip the build ++%__cargo_skip_build %{lua: ++local crate = rpm.expand('%{crate}') ++local build_crate = false ++for w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do ++ if w == crate then ++ build_crate = true ++ break ++ end ++end ++if (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then ++ print(1) ++else ++ print(0) ++end} diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec index 660bb60..69d23d7 100644 --- a/rust2rpm/templates/main.spec diff --git a/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch b/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch index 63a2895..8094aad 100644 --- a/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch +++ b/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch @@ -1,4 +1,4 @@ -From b345d23e7a11357d828751e4db47a0685cfe207b Mon Sep 17 00:00:00 2001 +From cbd5313fb9d5ca1aa59ffa3dffaa8d1ad9e68d69 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 8 Jun 2019 20:01:12 +0200 Subject: [PATCH 14/14] Set BuildArch: noarch with %__cargo_skip_build @@ -12,14 +12,14 @@ Signed-off-by: Igor Gnatenko 1 file changed, 3 insertions(+) diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 69d23d7..b4734b7 100644 +index 69d23d7..a3e3c2e 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -39,6 +39,9 @@ Patch0: {{ patch_file }} {% endif %} ExclusiveArch: %{rust_arches} -+%if ! %{__cargo_skip_build} ++%if %{__cargo_skip_build} +BuildArch: noarch +%endif diff --git a/rust-packaging.spec b/rust-packaging.spec index 1dd8d19..0357a8e 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 9 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -85,6 +85,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Sat Jun 08 2019 Igor Gnatenko - 9-3 +- Update patches + * Sat Jun 08 2019 Igor Gnatenko - 9-2 - Backport patches from upstream From a71632f5f74348736c720b5334d8012ce660097f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 16 Jun 2019 17:18:14 +0200 Subject: [PATCH 50/96] Update to 10 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + ...o-not-put-empty-line-after-changelog.patch | 26 --- 0002-licensing-translate-GPL-123.patch | 43 ---- ...d-or-later-variants-for-GPL-licenses.patch | 32 --- ...ve-version-string-to-the-python-code.patch | 48 ----- ...-release-in-addition-to-etc-os-relea.patch | 31 --- ...-version-info-in-the-generated-spec-.patch | 47 ----- 0007-Bump-classifiers.patch | 34 ---- 0008-Mangle-summary-automagically.patch | 85 -------- 0009-Use-expand-for-description.patch | 41 ---- 0010-Remove-more-common-prefixes.patch | 25 --- ...later-and-automatically-translate-su.patch | 73 ------- ...cense-to-translate-a-specific-licens.patch | 50 ----- 0013-Implement-__cargo_skip_build.patch | 192 ------------------ ...dArch-noarch-with-__cargo_skip_build.patch | 30 --- rust-packaging.spec | 23 +-- sources | 2 +- 17 files changed, 8 insertions(+), 775 deletions(-) delete mode 100644 0001-templates-Do-not-put-empty-line-after-changelog.patch delete mode 100644 0002-licensing-translate-GPL-123.patch delete mode 100644 0003-licensing-add-or-later-variants-for-GPL-licenses.patch delete mode 100644 0004-Move-version-string-to-the-python-code.patch delete mode 100644 0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch delete mode 100644 0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch delete mode 100644 0007-Bump-classifiers.patch delete mode 100644 0008-Mangle-summary-automagically.patch delete mode 100644 0009-Use-expand-for-description.patch delete mode 100644 0010-Remove-more-common-prefixes.patch delete mode 100644 0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch delete mode 100644 0012-Add-translate-license-to-translate-a-specific-licens.patch delete mode 100644 0013-Implement-__cargo_skip_build.patch delete mode 100644 0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch diff --git a/.gitignore b/.gitignore index b86ab64..deb76e9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /rust2rpm-7.tar.xz /rust2rpm-8.tar.xz /rust2rpm-9.tar.xz +/rust2rpm-10.tar.xz diff --git a/0001-templates-Do-not-put-empty-line-after-changelog.patch b/0001-templates-Do-not-put-empty-line-after-changelog.patch deleted file mode 100644 index 00bd68f..0000000 --- a/0001-templates-Do-not-put-empty-line-after-changelog.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b1df4d587fb03dcaedd7e8f29fbe5b7265ea5638 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Mon, 6 May 2019 10:43:05 +0200 -Subject: [PATCH 01/14] templates: Do not put empty line after %changelog - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/templates/main.spec | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index dcd24ca..0c84325 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -183,6 +183,7 @@ echo {{ "%r"|format(req) }} - %endif - - %changelog --{% if auto_changelog_entry %} -+{%- if auto_changelog_entry %} -+ - {% include target ~ "-changelog.spec.inc" %} - {% endif %} --- -2.22.0.rc3 - diff --git a/0002-licensing-translate-GPL-123.patch b/0002-licensing-translate-GPL-123.patch deleted file mode 100644 index 559941f..0000000 --- a/0002-licensing-translate-GPL-123.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 1f64bd9564c0cc27d23f5dc5e523f0db46496644 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 6 May 2019 22:08:07 +0200 -Subject: [PATCH 02/14] licensing: translate GPL[123]+ - -The "+" variants were described in the comment, but not explicitly -listed in the table. Let's just replace the comment with -machine-readable lines. - -Fixes #79. ---- - rust2rpm/spdx_to_fedora.csv | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) - -diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv -index c42e66e..4fc3321 100644 ---- a/rust2rpm/spdx_to_fedora.csv -+++ b/rust2rpm/spdx_to_fedora.csv -@@ -141,15 +141,12 @@ GNU Affero General Public License v3.0,AGPL-3.0,AGPLv3,Affero General Public Lic - GNU Free Documentation License v1.1,GFDL-1.1,,,This specific version not on Fedora list, - GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedora list, - GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,, --GNU General Public License v1.0 only,GPL-1.0,GPLv1,,"For “or later” add + to SPDX or Fedora short identifier: --SPDX: GPL-1.0+ --Fedora: GPLv1+ or GPL+", --GNU General Public License v2.0 only,GPL-2.0,GPLv2,,"For “or later” add + to SPDX or Fedora short identifier: --SPDX: GPL-2.0+ --Fedora: GPLv2+", --GNU General Public License v3.0 only,GPL-3.0,GPLv3,,"For “or later” add + to SPDX or Fedora short identifier: --SPDX: GPL-3.0+ --Fedora: GPLv3+", -+GNU General Public License v1.0 only,GPL-1.0,GPLv1,,, -+GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,, -+GNU General Public License v2.0 only,GPL-2.0,GPLv2,,, -+GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,, -+GNU General Public License v3.0 only,GPL-3.0,GPLv3,,, -+GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,, - GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, - GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,, - GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,, --- -2.22.0.rc3 - diff --git a/0003-licensing-add-or-later-variants-for-GPL-licenses.patch b/0003-licensing-add-or-later-variants-for-GPL-licenses.patch deleted file mode 100644 index 6ac4be3..0000000 --- a/0003-licensing-add-or-later-variants-for-GPL-licenses.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 8d21ef1ee4152294c3e9df451404db7c732fb415 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Tue, 7 May 2019 08:32:25 +0200 -Subject: [PATCH 03/14] licensing: add "-or-later" variants for GPL licenses - -SPDX actually deprecated the variants with "+" and "-or-later" is now -recommneded. They both map to the same identiefiers on Fedora side. ---- - rust2rpm/spdx_to_fedora.csv | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv -index 4fc3321..a3f9604 100644 ---- a/rust2rpm/spdx_to_fedora.csv -+++ b/rust2rpm/spdx_to_fedora.csv -@@ -143,10 +143,13 @@ GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedo - GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,, - GNU General Public License v1.0 only,GPL-1.0,GPLv1,,, - GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,, -+GNU General Public License v1.0 or later,GPL-1.0-or-later,GPLv1+,,, - GNU General Public License v2.0 only,GPL-2.0,GPLv2,,, - GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,, -+GNU General Public License v2.0 or later,GPL-2.0-or-later,GPLv2+,,, - GNU General Public License v3.0 only,GPL-3.0,GPLv3,,, - GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,, -+GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,, - GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, - GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,, - GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,, --- -2.22.0.rc3 - diff --git a/0004-Move-version-string-to-the-python-code.patch b/0004-Move-version-string-to-the-python-code.patch deleted file mode 100644 index 9f04d6c..0000000 --- a/0004-Move-version-string-to-the-python-code.patch +++ /dev/null @@ -1,48 +0,0 @@ -From aa9fc8646a4bcf43bba544d37c2f6e6e59b1bebb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 6 May 2019 22:34:02 +0200 -Subject: [PATCH 04/14] Move version string to the python code - -This way the python module "knows" its own version. To avoid duplication, -read the value back from setup.py. The reader function only needs to -support the specific format used in the code, so it can be very simplistic. ---- - rust2rpm/__init__.py | 2 ++ - setup.py | 11 ++++++++++- - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/rust2rpm/__init__.py b/rust2rpm/__init__.py -index 6aba575..4a0db7b 100644 ---- a/rust2rpm/__init__.py -+++ b/rust2rpm/__init__.py -@@ -1,2 +1,4 @@ - from .metadata import * - from . import licensing -+ -+__version__ = '9' -diff --git a/setup.py b/setup.py -index 3eb2a77..79367da 100644 ---- a/setup.py -+++ b/setup.py -@@ -1,8 +1,17 @@ - from setuptools import setup - -+def read_version(path): -+ with open(path, 'rt') as f: -+ for line in f: -+ if line.startswith('__version__'): -+ return line.split("'")[1] -+ raise IOError -+ -+version = read_version('rust2rpm/__init__.py') -+ - ARGS = dict( - name="rust2rpm", -- version="9", -+ version=version, - description="Convert Rust crates to RPM", - license="MIT", - keywords="rust cargo rpm", --- -2.22.0.rc3 - diff --git a/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch b/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch deleted file mode 100644 index ed5472f..0000000 --- a/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 253d1f6021765051c26d4427967786040d215853 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 6 May 2019 22:36:43 +0200 -Subject: [PATCH 05/14] Check /usr/lib/os-release in addition to - /etc/os-release - ---- - rust2rpm/__main__.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index b307505..b8d3772 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -34,8 +34,11 @@ JINJA_ENV = jinja2.Environment( - lstrip_blocks=True) - - def get_default_target(): -- # TODO: add fallback for /usr/lib/os-release -- with open("/etc/os-release") as os_release_file: -+ try: -+ os_release_file = open('/etc/os-release') -+ except FileNotFoundError: -+ os_release_file = open('/usr/lib/os-release') -+ with os_release_file: - conf = configparser.ConfigParser() - conf.read_file(itertools.chain(["[os-release]"], os_release_file)) - os_release = conf["os-release"] --- -2.22.0.rc3 - diff --git a/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch b/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch deleted file mode 100644 index 7f332f9..0000000 --- a/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 6de75b87af4bd86d87dfee038f5b6cdf99437a7c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 6 May 2019 22:44:55 +0200 -Subject: [PATCH 06/14] Include rust2rpm version info in the generated spec - file - -Fixes #77. ---- - rust2rpm/__main__.py | 3 ++- - rust2rpm/templates/main.spec | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index b8d3772..a7674fd 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -17,7 +17,7 @@ import jinja2 - import requests - import tqdm - --from . import Metadata, licensing -+from . import Metadata, licensing, __version__ - from .metadata import normalize_deps - - DEFAULT_EDITOR = "vi" -@@ -265,6 +265,7 @@ def main(): - patch_file = None - - kwargs = {} -+ kwargs["generator_version"] = __version__ - kwargs["crate"] = crate - kwargs["target"] = args.target - kwargs["all_features"] = args.all_features -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 0c84325..0ef0b10 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -1,5 +1,5 @@ - {% include target ~ "-header.spec.inc" ignore missing %} --# Generated by rust2rpm -+# Generated by rust2rpm {{ generator_version }} - %bcond_without check - {% if not include_main %} - %global debug_package %{nil} --- -2.22.0.rc3 - diff --git a/0007-Bump-classifiers.patch b/0007-Bump-classifiers.patch deleted file mode 100644 index 6967f8d..0000000 --- a/0007-Bump-classifiers.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 36663449594b33ec4b0c0ae9ea568cad819bb920 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 6 May 2019 22:47:06 +0200 -Subject: [PATCH 07/14] Bump classifiers - -This software is used, so let's at least it's beta. -Seems to work fine with python3.8, let's say that. ---- - setup.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 79367da..b5b1157 100644 ---- a/setup.py -+++ b/setup.py -@@ -44,13 +44,14 @@ ARGS = dict( - author_email="ignatenkobrain@fedoraproject.org", - url="https://pagure.io/fedora-rust/rust2rpm", - classifiers=[ -- "Development Status :: 3 - Alpha", -+ "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: POSIX :: Linux", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", -+ "Programming Language :: Python :: 3.8", - "Topic :: Software Development :: Build Tools", - "Topic :: System :: Software Distribution", - "Topic :: Utilities", --- -2.22.0.rc3 - diff --git a/0008-Mangle-summary-automagically.patch b/0008-Mangle-summary-automagically.patch deleted file mode 100644 index 9f6fbcc..0000000 --- a/0008-Mangle-summary-automagically.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 216de8e4271f9dbca1f009e8c0e046a7f5a198fd Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 15 May 2019 08:01:46 +0200 -Subject: [PATCH 08/14] Mangle summary automagically - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/metadata.py | 35 ++++++++++++++++++++++++++++++++++- - rust2rpm/templates/main.spec | 3 +-- - 2 files changed, 35 insertions(+), 3 deletions(-) - -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index 77c2932..e41902d 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -3,6 +3,7 @@ __all__ = ["Dependency", "Metadata"] - import collections - import copy - import json -+import re - import subprocess - - import semantic_version as semver -@@ -116,11 +117,43 @@ class Metadata: - self.license = None - self.license_file = None - self.readme = None -- self.description = None -+ self._description = None -+ self._summary = None - self.targets = set() - self.dependencies = {} - self.dev_dependencies = set() - -+ @property -+ def description(self): -+ return self._description -+ -+ @property -+ def summary(self): -+ return self._summary -+ -+ @description.setter -+ def description(self, description): -+ # https://salsa.debian.org/rust-team/debcargo/blob/master/src/crates.rs -+ # get_summary_description() -+ if description is None: -+ self._description = self._summary = None -+ return -+ description = description.replace('\n\n', '\r').replace('\n', ' ').replace('\r', '\n').strip() -+ description = re.sub(r'^(?:a|an|the)\s+', '', description, flags=re.I) -+ description = f'{description[0].upper()}{description[1:]}' -+ if description[-1] != '.': -+ description = f'{description}.' -+ -+ p1 = description.find('.') -+ p2 = description.find('\n') -+ if p2 != -1: -+ p = min(p1, p2) -+ else: -+ p = p1 -+ -+ self._description = description -+ self._summary = description[:p] -+ - @classmethod - def from_json(cls, metadata): - md = metadata -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 0ef0b10..803b74e 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -16,8 +16,7 @@ Release: {{ pkg_release }} - {% if md.description is none %} - Summary: # FIXME - {% else %} --{% set description_lines = md.description.split("\n") %} --Summary: {{ description_lines|join(" ")|trim }} -+Summary: {{ md.summary }} - {% endif %} - {% if rust_group is defined %} - Group: {{ rust_group }} --- -2.22.0.rc3 - diff --git a/0009-Use-expand-for-description.patch b/0009-Use-expand-for-description.patch deleted file mode 100644 index c2ecfdf..0000000 --- a/0009-Use-expand-for-description.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 16085843c800827526ab78354bacdd6bd388993f Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 15 May 2019 08:07:18 +0200 -Subject: [PATCH 09/14] =?UTF-8?q?Use=20%{expand:=E2=80=A6}=20for=20descrip?= - =?UTF-8?q?tion?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -So that we stop playing with escaping. - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/templates/main.spec | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 803b74e..660bb60 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -64,12 +64,13 @@ BuildRequires: {{ req }} - {% endfor %} - {% endif %} - --%global _description \ -+%global _description %{expand: - {% if md.description is none %} - %{summary}. --{% else %} --{{ md.description|wordwrap(wrapstring="\\\n")|trim }} --{% endif %} -+{%- else %} -+{{ md.description|wordwrap }} -+{%- endif %} -+} - - %description %{_description} - --- -2.22.0.rc3 - diff --git a/0010-Remove-more-common-prefixes.patch b/0010-Remove-more-common-prefixes.patch deleted file mode 100644 index c22444a..0000000 --- a/0010-Remove-more-common-prefixes.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e1cfff321693432f19a9a1303431b2ce4ec4edc9 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 15 May 2019 20:00:59 +0200 -Subject: [PATCH 10/14] Remove more common prefixes - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/metadata.py | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index e41902d..1b4faad 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -139,6 +139,7 @@ class Metadata: - self._description = self._summary = None - return - description = description.replace('\n\n', '\r').replace('\n', ' ').replace('\r', '\n').strip() -+ description = re.sub(rf'^(?:{self.name}|This(?:\s+\w+)?)(?:\s*,|\s+is|\s+provides)\s+', '', description, flags=re.I) - description = re.sub(r'^(?:a|an|the)\s+', '', description, flags=re.I) - description = f'{description[0].upper()}{description[1:]}' - if description[-1] != '.': --- -2.22.0.rc3 - diff --git a/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch b/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch deleted file mode 100644 index 6679e3a..0000000 --- a/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 04f63e0f20d6b517119053c6bc00aa8be3c3a19f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Sun, 2 Jun 2019 15:48:45 +0200 -Subject: [PATCH 11/14] Add AGPL-3.0-or-later and automatically translate "+" - suffix into "-or-later" - -This way we don't need to add all the deprecated variants with "+" suffix. - -Fixes #84. ---- - rust2rpm/licensing.py | 14 ++++++++++---- - rust2rpm/spdx_to_fedora.csv | 4 +--- - 2 files changed, 11 insertions(+), 7 deletions(-) - -diff --git a/rust2rpm/licensing.py b/rust2rpm/licensing.py -index 233903e..6ca4e45 100644 ---- a/rust2rpm/licensing.py -+++ b/rust2rpm/licensing.py -@@ -35,18 +35,24 @@ def translate_license_fedora(license): - elif tag.upper() == 'AND': - final.append('and') - else: -- mapped = spdx_to_fedora_map().get(tag, None) -+ if tag.endswith('+'): -+ key = tag[:-1] + '-or-later' -+ fulltag = f'{tag} ({key})' -+ else: -+ key = fulltag = tag -+ -+ mapped = spdx_to_fedora_map().get(key, None) - if mapped is None: -- comments += f'# FIXME: Upstream uses unknown SPDX tag {tag}!' -+ comments += f'# FIXME: Upstream uses unknown SPDX tag {fulltag}!' - final.append(tag) - elif mapped == '': -- comments += f"# FIXME: Upstream SPDX tag {tag} not listed in Fedora's good licenses list.\n" -+ comments += f"# FIXME: Upstream SPDX tag {fulltag} not listed in Fedora's good licenses list.\n" - comments += "# FIXME: This package might not be allowed in Fedora!\n" - final.append(tag) - else: - final.append(mapped) - if mapped != tag: -- print(f'Upstream license tag {tag} translated to {mapped}', -+ print(f'Upstream license tag {fulltag} translated to {mapped}', - file=_sys.stderr) - return (' '.join(final), comments or None) - -diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv -index a3f9604..006d80c 100644 ---- a/rust2rpm/spdx_to_fedora.csv -+++ b/rust2rpm/spdx_to_fedora.csv -@@ -138,17 +138,15 @@ Giftware License,Giftware,Giftware,,, - GL2PS License,GL2PS,GL2PS,,, - Glulxe License,Glulxe,Glulxe,,, - GNU Affero General Public License v3.0,AGPL-3.0,AGPLv3,Affero General Public License 3.0,, -+GNU Affero General Public License v3.0 or later,AGPL-3.0-or-later,AGPLv3+,Affero General Public License 3.0 or later,, - GNU Free Documentation License v1.1,GFDL-1.1,,,This specific version not on Fedora list, - GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedora list, - GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,, - GNU General Public License v1.0 only,GPL-1.0,GPLv1,,, --GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,, - GNU General Public License v1.0 or later,GPL-1.0-or-later,GPLv1+,,, - GNU General Public License v2.0 only,GPL-2.0,GPLv2,,, --GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,, - GNU General Public License v2.0 or later,GPL-2.0-or-later,GPLv2+,,, - GNU General Public License v3.0 only,GPL-3.0,GPLv3,,, --GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,, - GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,, - GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, - GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,, --- -2.22.0.rc3 - diff --git a/0012-Add-translate-license-to-translate-a-specific-licens.patch b/0012-Add-translate-license-to-translate-a-specific-licens.patch deleted file mode 100644 index 18e32a2..0000000 --- a/0012-Add-translate-license-to-translate-a-specific-licens.patch +++ /dev/null @@ -1,50 +0,0 @@ -From d9b2cef72e129963ac082ec3737a877785232123 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Sun, 2 Jun 2019 15:45:13 +0200 -Subject: [PATCH 12/14] Add --translate-license to translate a specific license - -Before, all known licenses would be listed by --show-license-map, so -grepping the list was enough to find a license. But now we support -alternative syntaxes, so this is not enough. Add a call to translate a -specific license: - -$ python3 -m rust2rpm --translate-license GPL-3.0+ -Upstream license tag GPL-3.0+ (GPL-3.0-or-later) translated to GPLv3+ -GPLv3+ - -$ python3 -m rust2rpm --show-license-map | grep -F GPL-3.0+ -(nada) ---- - rust2rpm/__main__.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index a7674fd..c55dacc 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -222,6 +222,8 @@ def main(): - formatter_class=argparse.RawTextHelpFormatter) - parser.add_argument("--show-license-map", action="store_true", - help="Print license mappings and exit") -+ parser.add_argument("--translate-license", action="store_true", -+ help="Print mapping for specified license and exit") - parser.add_argument("--no-auto-changelog-entry", action="store_true", - help="Do not generate a changelog entry") - parser.add_argument("-", "--stdout", action="store_true", -@@ -248,6 +250,13 @@ def main(): - licensing.dump_sdpx_to_fedora_map(sys.stdout) - return - -+ if args.translate_license: -+ license, comments = licensing.translate_license(args.target, args.crate) -+ if comments: -+ print(comments) -+ print(license) -+ return -+ - if args.crate is None: - parser.error("required crate/path argument missing") - --- -2.22.0.rc3 - diff --git a/0013-Implement-__cargo_skip_build.patch b/0013-Implement-__cargo_skip_build.patch deleted file mode 100644 index 02df663..0000000 --- a/0013-Implement-__cargo_skip_build.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 37cf4d78df2f3805f1f230252e1c0030a2f08877 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sat, 8 Jun 2019 19:35:38 +0200 -Subject: [PATCH 13/14] Implement %__cargo_skip_build - -We need to have an easy way how to skip doing 'cargo build' to speedup a -module builds. - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 65 +++++++++++++++++++++--------------- - data/macros.rust-srpm | 16 +++++++++ - rust2rpm/templates/main.spec | 34 ++++++++++--------- - 3 files changed, 73 insertions(+), 42 deletions(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index a60289a..1182850 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -49,27 +49,35 @@ EOF\ - } - - %cargo_generate_buildrequires(af:) \ --%{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \ --%if %{with check} \ --%{__cargo_inspector} -TR Cargo.toml \ -+%if ! 0%{?__cargo_skip_build} \ -+ %{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \ -+ %if %{with check} \ -+ %{__cargo_inspector} -TR Cargo.toml \ -+ %endif \ - %endif - --%cargo_build(naf:) %{shrink:\ --%{__cargo} build \ -- %{__cargo_common_opts} \ -- --release \ -- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -- %* \ --} -+%cargo_build(naf:) \ -+%if ! 0%{?__cargo_skip_build} \ -+ %{shrink:\ -+ %{__cargo} build \ -+ %{__cargo_common_opts} \ -+ --release \ -+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ -+ } \ -+%endif - --%cargo_test(naf:) %{shrink:\ --%{__cargo} test \ -- %{__cargo_common_opts} \ -- --release \ -- --no-fail-fast \ -- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -- %* \ --} -+%cargo_test(naf:) \ -+%if ! 0%{?__cargo_skip_build} \ -+ %{shrink:\ -+ %{__cargo} test \ -+ %{__cargo_common_opts} \ -+ --release \ -+ --no-fail-fast \ -+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ -+ } \ -+%endif - - %cargo_install(t:naf:) (\ - set -eu \ -@@ -88,15 +96,18 @@ if %__cargo_is_lib; then \ - %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \ - echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \ - fi \ --if %__cargo_is_bin; then \ -- %{shrink:%{__cargo} install \ -- %{__cargo_common_opts} \ -- --path . \ -- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -- %* \ -- }\ -- %{__rm} %{buildroot}%{_prefix}/.crates.toml \ --fi \ -+%if ! %__cargo_skip_build \ -+ if %__cargo_is_bin; then \ -+ %{shrink:\ -+ %{__cargo} install \ -+ %{__cargo_common_opts} \ -+ --path . \ -+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ -+ %* \ -+ } \ -+ %{__rm} %{buildroot}%{_prefix}/.crates.toml \ -+ fi \ -+%endif \ - ) - - %__cargo_feature_from_name(n:) %{lua: -diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm -index 872b87f..88d5a0f 100644 ---- a/data/macros.rust-srpm -+++ b/data/macros.rust-srpm -@@ -37,3 +37,19 @@ - \ - print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate') - } -+ -+# If crate not in _build_crates and _module_build is set, we should skip the build -+%__cargo_skip_build %{lua: -+local crate = rpm.expand('%{crate}') -+local build_crate = false -+for w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do -+ if w == crate then -+ build_crate = true -+ break -+ end -+end -+if (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then -+ print(1) -+else -+ print(0) -+end} -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 660bb60..69d23d7 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -42,26 +42,28 @@ ExclusiveArch: %{rust_arches} - - BuildRequires: rust-packaging - {% if not generate_buildrequires %} --{% if not all_features %} --{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} --{% else %} --{% set buildrequires = normalize_deps(md.all_dependencies)|sort %} --{% set cargo_args = " -a" %} --{% endif %} --{% for req in buildrequires %} -+%if ! %{__cargo_skip_build} -+ {% if not all_features %} -+ {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} -+ {% else %} -+ {% set buildrequires = normalize_deps(md.all_dependencies)|sort %} -+ {% set cargo_args = " -a" %} -+ {% endif %} -+ {% for req in buildrequires %} - BuildRequires: {{ req }} --{% endfor %} --{% set testrequires = normalize_deps(md.dev_dependencies)|sort %} --{% if testrequires|length > 0 %} -+ {% endfor %} -+ {% set testrequires = normalize_deps(md.dev_dependencies)|sort %} -+ {% if testrequires|length > 0 %} - %if %{with check} -- {% for req in testrequires %} -+ {% for req in testrequires %} - BuildRequires: {{ req }} -- {% endfor %} -+ {% endfor %} - %endif --{% endif %} --{% for req in to_list(distconf.get("buildrequires"))|sort %} -+ {% endif %} -+ {% for req in to_list(distconf.get("buildrequires"))|sort %} - BuildRequires: {{ req }} --{% endfor %} -+ {% endfor %} -+%endif - {% endif %} - - %global _description %{expand: -@@ -75,6 +77,7 @@ BuildRequires: {{ req }} - %description %{_description} - - {% if include_main %} -+%if ! %{__cargo_skip_build} - %package -n %{crate} - Summary: %{summary} - {% if rust_group is defined %} -@@ -96,6 +99,7 @@ Requires: {{ req }} - {% for bin in bins %} - %{_bindir}/{{ bin.name }} - {% endfor %} -+%endif - - {% endif -%} - --- -2.22.0.rc3 - diff --git a/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch b/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch deleted file mode 100644 index 8094aad..0000000 --- a/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch +++ /dev/null @@ -1,30 +0,0 @@ -From cbd5313fb9d5ca1aa59ffa3dffaa8d1ad9e68d69 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sat, 8 Jun 2019 20:01:12 +0200 -Subject: [PATCH 14/14] Set BuildArch: noarch with %__cargo_skip_build - -We do not need to spawn 7 tasks for each architecture to copy same files -over and over. - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/templates/main.spec | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 69d23d7..a3e3c2e 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -39,6 +39,9 @@ Patch0: {{ patch_file }} - {% endif %} - - ExclusiveArch: %{rust_arches} -+%if %{__cargo_skip_build} -+BuildArch: noarch -+%endif - - BuildRequires: rust-packaging - {% if not generate_buildrequires %} --- -2.22.0.rc3 - diff --git a/rust-packaging.spec b/rust-packaging.spec index 0357a8e..56430c9 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,27 +4,13 @@ %global debug_package %{nil} Name: rust-packaging -Version: 9 -Release: 3%{?dist} +Version: 10 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm -Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -Patch0001: 0001-templates-Do-not-put-empty-line-after-changelog.patch -Patch0002: 0002-licensing-translate-GPL-123.patch -Patch0003: 0003-licensing-add-or-later-variants-for-GPL-licenses.patch -Patch0004: 0004-Move-version-string-to-the-python-code.patch -Patch0005: 0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch -Patch0006: 0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch -Patch0007: 0007-Bump-classifiers.patch -Patch0008: 0008-Mangle-summary-automagically.patch -Patch0009: 0009-Use-expand-for-description.patch -Patch0010: 0010-Remove-more-common-prefixes.patch -Patch0011: 0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch -Patch0012: 0012-Add-translate-license-to-translate-a-specific-licens.patch -Patch0013: 0013-Implement-__cargo_skip_build.patch -Patch0014: 0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch +Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz ExclusiveArch: %{rust_arches} @@ -85,6 +71,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Sun Jun 16 2019 Igor Gnatenko - 10-1 +- Update to 10 + * Sat Jun 08 2019 Igor Gnatenko - 9-3 - Update patches diff --git a/sources b/sources index 4561ec6..c2243ba 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-9.tar.xz) = 64ba9f22aa7a205c4e418783689cb3d380d32d7358c2a5162713a6425cc6ea7fb0b0c82698b89934368b3b7961589e6b332655bda5c9b64fc2dc5488cf8b0c5e +SHA512 (rust2rpm-10.tar.xz) = ce93363760faab392b8f46e1f7126de8f437ecdd35a90d5cfb144ec13dd1d29a559ab99d99ce9a8347c1b4649fe24705bd317cc15f97b055549c6843752a62c3 From 700f417672c1eb52ddab3bf702755e92d8094421 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 24 Jun 2019 20:36:04 +0200 Subject: [PATCH 51/96] Do not use awk's inplace feature Signed-off-by: Igor Gnatenko --- ...ros-Do-not-use-awk-s-inplace-feature.patch | 30 +++++++++++++++++++ rust-packaging.spec | 11 +++++-- 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 0001-macros-Do-not-use-awk-s-inplace-feature.patch diff --git a/0001-macros-Do-not-use-awk-s-inplace-feature.patch b/0001-macros-Do-not-use-awk-s-inplace-feature.patch new file mode 100644 index 0000000..dd83986 --- /dev/null +++ b/0001-macros-Do-not-use-awk-s-inplace-feature.patch @@ -0,0 +1,30 @@ +From fac21ad662a14a4f901b3365a25749b516918554 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 24 Jun 2019 20:27:20 +0200 +Subject: [PATCH] macros: Do not use awk's inplace feature + +gawk 5.x changed variable name to `inplace::suffix` but gawk 4.x does +not like that name so we can't set both. + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 1182850..5066587 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -89,7 +89,8 @@ if %__cargo_is_lib; then \ + # Drop all dependency/features information \ + # so that cargo doesn't fail resolving dependencies: \ + # https://github.com/rust-lang/cargo/pull/6729 \ +- %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ ++ mv Cargo.toml{,.deps} \ ++ awk '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml.deps > Cargo.toml \ + %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ + %{__mv} Cargo.toml{.deps,} \ + %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \ +-- +2.22.0 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 56430c9..28008e5 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,17 +5,19 @@ Name: rust-packaging Version: 10 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz +# TODO: See if we can manage to keep using inplace feature +Patch0001: 0001-macros-Do-not-use-awk-s-inplace-feature.patch ExclusiveArch: %{rust_arches} -# gawk is needed for stripping dev-deps in macro, 4.1.0 is needed for inplace feature -Requires: gawk >= 4.1.0 +# gawk is needed for stripping dev-deps in macro +Requires: gawk Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} Requires: rust-srpm-macros = %{version} Requires: rust @@ -71,6 +73,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From edfe1c3fea06b8044aac57b5e16a2f5bb5dd947a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 26 Jul 2019 21:39:36 +0000 Subject: [PATCH 52/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 28008e5..8456e7f 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -5,7 +5,7 @@ Name: rust-packaging Version: 10 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -73,6 +73,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 5abaccc6a8c01adf0b1d08674fdc7c671c882f7f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 18 Aug 2019 16:40:24 +0200 Subject: [PATCH 53/96] Ignore Cargo.lock Signed-off-by: Igor Gnatenko --- 0001-Ignore-Cargo.lock.patch | 26 ++++++++++++++++++++++++++ rust-packaging.spec | 8 ++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 0001-Ignore-Cargo.lock.patch diff --git a/0001-Ignore-Cargo.lock.patch b/0001-Ignore-Cargo.lock.patch new file mode 100644 index 0000000..3f719f5 --- /dev/null +++ b/0001-Ignore-Cargo.lock.patch @@ -0,0 +1,26 @@ +From 308b1b98e5a7724572325293bdc19ac167877544 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sun, 18 Aug 2019 16:39:13 +0200 +Subject: [PATCH] Ignore Cargo.lock + +Signed-off-by: Igor Gnatenko +--- + data/macros.cargo | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 1182850..5f60111 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -90,7 +90,7 @@ if %__cargo_is_lib; then \ + # so that cargo doesn't fail resolving dependencies: \ + # https://github.com/rust-lang/cargo/pull/6729 \ + %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ +- %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ ++ %{__cargo} package -l | grep -w -v Cargo.lock | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ + %{__mv} Cargo.toml{.deps,} \ + %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \ + %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \ +-- +2.23.0.rc2 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 8456e7f..6ce0682 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,11 +1,10 @@ %bcond_without check -%{?python_enable_dependency_generator} # https://pagure.io/koji/issue/659 %global debug_package %{nil} Name: rust-packaging Version: 10 -Release: 3%{?dist} +Release: 4%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -13,6 +12,8 @@ URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz # TODO: See if we can manage to keep using inplace feature Patch0001: 0001-macros-Do-not-use-awk-s-inplace-feature.patch +# https://pagure.io/fedora-rust/rust2rpm/issue/90 +Patch0002: 0001-Ignore-Cargo.lock.patch ExclusiveArch: %{rust_arches} @@ -73,6 +74,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 0422c80e244f296cfab691e8f8e73991564e3643 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 18 Aug 2019 16:42:09 +0200 Subject: [PATCH 54/96] Drop old awk patch Signed-off-by: Igor Gnatenko --- ...ros-Do-not-use-awk-s-inplace-feature.patch | 30 ------------------- rust-packaging.spec | 4 +-- 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 0001-macros-Do-not-use-awk-s-inplace-feature.patch diff --git a/0001-macros-Do-not-use-awk-s-inplace-feature.patch b/0001-macros-Do-not-use-awk-s-inplace-feature.patch deleted file mode 100644 index dd83986..0000000 --- a/0001-macros-Do-not-use-awk-s-inplace-feature.patch +++ /dev/null @@ -1,30 +0,0 @@ -From fac21ad662a14a4f901b3365a25749b516918554 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Mon, 24 Jun 2019 20:27:20 +0200 -Subject: [PATCH] macros: Do not use awk's inplace feature - -gawk 5.x changed variable name to `inplace::suffix` but gawk 4.x does -not like that name so we can't set both. - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 1182850..5066587 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -89,7 +89,8 @@ if %__cargo_is_lib; then \ - # Drop all dependency/features information \ - # so that cargo doesn't fail resolving dependencies: \ - # https://github.com/rust-lang/cargo/pull/6729 \ -- %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ -+ mv Cargo.toml{,.deps} \ -+ awk '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml.deps > Cargo.toml \ - %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ - %{__mv} Cargo.toml{.deps,} \ - %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \ --- -2.22.0 - diff --git a/rust-packaging.spec b/rust-packaging.spec index 6ce0682..5b9b7b9 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -10,10 +10,8 @@ Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -# TODO: See if we can manage to keep using inplace feature -Patch0001: 0001-macros-Do-not-use-awk-s-inplace-feature.patch # https://pagure.io/fedora-rust/rust2rpm/issue/90 -Patch0002: 0001-Ignore-Cargo.lock.patch +Patch0001: 0001-Ignore-Cargo.lock.patch ExclusiveArch: %{rust_arches} From 540bbf894b976415ac1fdb1231c9d61a19f5a507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 19 Aug 2019 11:05:18 +0200 Subject: [PATCH 55/96] Rebuilt for Python 3.8 --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 5b9b7b9..c2bc488 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 10 -Release: 4%{?dist} +Release: 5%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -72,6 +72,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 22f4c8d35f6ccef90bde00418b4bd6facced1322 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 7 Sep 2019 14:07:31 +0200 Subject: [PATCH 56/96] Depend on setuptools in runtime Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index c2bc488..fef7968 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 10 -Release: 5%{?dist} +Release: 6%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -36,6 +36,8 @@ BuildRequires: cargo BuildRequires: python3dist(semantic-version) %endif Requires: cargo +# pkg_resources due to entry_points +Requires: python3dist(setuptools) Provides: rust2rpm = %{version}-%{release} %{?python_provide:%python_provide python3-rust2rpm} @@ -72,6 +74,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From b67ece752356120938edf3065dcafdbdbed97889 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 7 Sep 2019 17:55:03 +0200 Subject: [PATCH 57/96] Enable dependency generator Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-packaging.spec b/rust-packaging.spec index fef7968..62c819e 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,4 +1,5 @@ %bcond_without check +%{?python_enable_dependency_generator} # https://pagure.io/koji/issue/659 %global debug_package %{nil} From 8603623ebc72daf9bf6c205ec7997917de6a1ab5 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 4 Dec 2019 08:09:47 +0100 Subject: [PATCH 58/96] Update to 11 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + rust-packaging.spec | 18 +++++++----------- sources | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index deb76e9..a8960ab 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /rust2rpm-8.tar.xz /rust2rpm-9.tar.xz /rust2rpm-10.tar.xz +/rust2rpm-11.tar.xz diff --git a/rust-packaging.spec b/rust-packaging.spec index 62c819e..fe7aad5 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,20 +1,16 @@ %bcond_without check -%{?python_enable_dependency_generator} -# https://pagure.io/koji/issue/659 -%global debug_package %{nil} Name: rust-packaging -Version: 10 -Release: 6%{?dist} +Version: 11 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -# https://pagure.io/fedora-rust/rust2rpm/issue/90 -Patch0001: 0001-Ignore-Cargo.lock.patch -ExclusiveArch: %{rust_arches} +BuildArch: noarch +ExclusiveArch: %{rust_arches} noarch # gawk is needed for stripping dev-deps in macro Requires: gawk @@ -34,11 +30,8 @@ BuildRequires: python3-setuptools %if %{with check} BuildRequires: python3-pytest BuildRequires: cargo -BuildRequires: python3dist(semantic-version) %endif Requires: cargo -# pkg_resources due to entry_points -Requires: python3dist(setuptools) Provides: rust2rpm = %{version}-%{release} %{?python_provide:%python_provide python3-rust2rpm} @@ -75,6 +68,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Wed Dec 04 2019 Igor Gnatenko - 11-1 +- Update to 11 + * Sat Sep 07 2019 Igor Gnatenko - 10-6 - Depend on setuptools in runtime diff --git a/sources b/sources index c2243ba..594c21f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-10.tar.xz) = ce93363760faab392b8f46e1f7126de8f437ecdd35a90d5cfb144ec13dd1d29a559ab99d99ce9a8347c1b4649fe24705bd317cc15f97b055549c6843752a62c3 +SHA512 (rust2rpm-11.tar.xz) = 5dc726269ed2399df0f8779c78ab09972eee6f7cdb0075eaf83501ddba16a0d0aac9176ba7e8c06fd051aae822d97906918e8f191f55315171613b14750c3fa0 From 16b28806efc475fa4de9bff14b0a1e685979a656 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 4 Dec 2019 10:13:13 +0100 Subject: [PATCH 59/96] Return arch hack back Signed-off-by: Igor Gnatenko --- rust-packaging.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index fe7aad5..8825f53 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,4 +1,6 @@ %bcond_without check +# https://pagure.io/koji/issue/659 +%global debug_package %{nil} Name: rust-packaging Version: 11 @@ -9,8 +11,7 @@ License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -BuildArch: noarch -ExclusiveArch: %{rust_arches} noarch +ExclusiveArch: %{rust_arches} # gawk is needed for stripping dev-deps in macro Requires: gawk From 225b735a83d932a7d1fac36a7526a267f91ca4dc Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 13 Dec 2019 21:45:14 +0100 Subject: [PATCH 60/96] Update to 12 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + rust-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a8960ab..1ca6bb3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /rust2rpm-9.tar.xz /rust2rpm-10.tar.xz /rust2rpm-11.tar.xz +/rust2rpm-12.tar.xz diff --git a/rust-packaging.spec b/rust-packaging.spec index 8825f53..9402140 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,7 +3,7 @@ %global debug_package %{nil} Name: rust-packaging -Version: 11 +Version: 12 Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures @@ -69,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Fri Dec 13 2019 Igor Gnatenko - 12-1 +- Update to 12 + * Wed Dec 04 2019 Igor Gnatenko - 11-1 - Update to 11 diff --git a/sources b/sources index 594c21f..a171058 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-11.tar.xz) = 5dc726269ed2399df0f8779c78ab09972eee6f7cdb0075eaf83501ddba16a0d0aac9176ba7e8c06fd051aae822d97906918e8f191f55315171613b14750c3fa0 +SHA512 (rust2rpm-12.tar.xz) = efef036c1457d194ce0b0379638419dc9aae017ed652d6a1ad51a345728f28d73389bbdcf41a56fae2201c199d04bbe95071abd639dcecb750ea7de8e9b8450c From d39ded298f8b3aba7238d77d8c101f9290a34943 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 13 Dec 2019 22:17:25 +0100 Subject: [PATCH 61/96] Fixup generation of files with no-tilde Signed-off-by: Igor Gnatenko --- 0001-Ignore-Cargo.lock.patch | 26 ----------------- ...s-Generate-files-entry-with-no-tilde.patch | 29 +++++++++++++++++++ rust-packaging.spec | 6 +++- 3 files changed, 34 insertions(+), 27 deletions(-) delete mode 100644 0001-Ignore-Cargo.lock.patch create mode 100644 0001-templates-Generate-files-entry-with-no-tilde.patch diff --git a/0001-Ignore-Cargo.lock.patch b/0001-Ignore-Cargo.lock.patch deleted file mode 100644 index 3f719f5..0000000 --- a/0001-Ignore-Cargo.lock.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 308b1b98e5a7724572325293bdc19ac167877544 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sun, 18 Aug 2019 16:39:13 +0200 -Subject: [PATCH] Ignore Cargo.lock - -Signed-off-by: Igor Gnatenko ---- - data/macros.cargo | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 1182850..5f60111 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -90,7 +90,7 @@ if %__cargo_is_lib; then \ - # so that cargo doesn't fail resolving dependencies: \ - # https://github.com/rust-lang/cargo/pull/6729 \ - %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \ -- %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ -+ %{__cargo} package -l | grep -w -v Cargo.lock | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \ - %{__mv} Cargo.toml{.deps,} \ - %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \ - %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \ --- -2.23.0.rc2 - diff --git a/0001-templates-Generate-files-entry-with-no-tilde.patch b/0001-templates-Generate-files-entry-with-no-tilde.patch new file mode 100644 index 0000000..30040e9 --- /dev/null +++ b/0001-templates-Generate-files-entry-with-no-tilde.patch @@ -0,0 +1,29 @@ +From 94e3528e8f142e09c476417e43bf2597e029590d Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 13 Dec 2019 22:05:04 +0100 +Subject: [PATCH] templates: Generate files entry with no-tilde + +Signed-off-by: Igor Gnatenko +--- + rust2rpm/templates/main.spec | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec +index 2fb1aff..c5686d3 100644 +--- a/rust2rpm/templates/main.spec ++++ b/rust2rpm/templates/main.spec +@@ -170,9 +170,9 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c + {% if md.readme is not none %} + %doc {{ md.readme }} + {% endif %} +-%{cargo_registry}/%{crate}-%{version}/ ++%{cargo_registry}/%{crate}-%{version_no_tilde}/ + {% else %} +-%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml ++%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + {% endif %} + + {% endfor %} +-- +2.24.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 9402140..c10be97 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,12 +4,13 @@ Name: rust-packaging Version: 12 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz +Patch0001: 0001-templates-Generate-files-entry-with-no-tilde.patch ExclusiveArch: %{rust_arches} @@ -69,6 +70,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From fa8406d63a74e86cf805cf1f06a75442f99b4ffd Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 20 Dec 2019 18:14:28 +0100 Subject: [PATCH 62/96] Update to 13 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + ...s-Generate-files-entry-with-no-tilde.patch | 29 ------------------- rust-packaging.spec | 8 +++-- sources | 2 +- 4 files changed, 7 insertions(+), 33 deletions(-) delete mode 100644 0001-templates-Generate-files-entry-with-no-tilde.patch diff --git a/.gitignore b/.gitignore index 1ca6bb3..1fa667d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /rust2rpm-10.tar.xz /rust2rpm-11.tar.xz /rust2rpm-12.tar.xz +/rust2rpm-13.tar.xz diff --git a/0001-templates-Generate-files-entry-with-no-tilde.patch b/0001-templates-Generate-files-entry-with-no-tilde.patch deleted file mode 100644 index 30040e9..0000000 --- a/0001-templates-Generate-files-entry-with-no-tilde.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 94e3528e8f142e09c476417e43bf2597e029590d Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Fri, 13 Dec 2019 22:05:04 +0100 -Subject: [PATCH] templates: Generate files entry with no-tilde - -Signed-off-by: Igor Gnatenko ---- - rust2rpm/templates/main.spec | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec -index 2fb1aff..c5686d3 100644 ---- a/rust2rpm/templates/main.spec -+++ b/rust2rpm/templates/main.spec -@@ -170,9 +170,9 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c - {% if md.readme is not none %} - %doc {{ md.readme }} - {% endif %} --%{cargo_registry}/%{crate}-%{version}/ -+%{cargo_registry}/%{crate}-%{version_no_tilde}/ - {% else %} --%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml -+%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml - {% endif %} - - {% endfor %} --- -2.24.1 - diff --git a/rust-packaging.spec b/rust-packaging.spec index c10be97..1b320fb 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,14 +3,13 @@ %global debug_package %{nil} Name: rust-packaging -Version: 12 -Release: 2%{?dist} +Version: 13 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -Patch0001: 0001-templates-Generate-files-entry-with-no-tilde.patch ExclusiveArch: %{rust_arches} @@ -70,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index a171058..ab8f1d8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-12.tar.xz) = efef036c1457d194ce0b0379638419dc9aae017ed652d6a1ad51a345728f28d73389bbdcf41a56fae2201c199d04bbe95071abd639dcecb750ea7de8e9b8450c +SHA512 (rust2rpm-13.tar.xz) = 48eb5eb5fa574b9c0df8b4feac963e873c15ed4f347023326e0809bff6afbd2c3ad9848e43e678d7bc4314c2f2231dbac8ddacb70d1370c134e3597e2b8f7cfc From e610310150a52fcbc7599e241be30252bb3826a1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 30 Jan 2020 21:25:24 +0000 Subject: [PATCH 63/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 1b320fb..854fcbd 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 13 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -69,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From ea408f2a210af4f78a3458705037a82d9b3b20ee Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 3 Feb 2020 09:15:47 -0800 Subject: [PATCH 64/96] Use 'cargo install --no-track' with cargo 1.41 --- ...rgo-install-no-track-with-cargo-1.41.patch | 37 +++++++++++++++++++ rust-packaging.spec | 10 ++++- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 0001-Use-cargo-install-no-track-with-cargo-1.41.patch diff --git a/0001-Use-cargo-install-no-track-with-cargo-1.41.patch b/0001-Use-cargo-install-no-track-with-cargo-1.41.patch new file mode 100644 index 0000000..95427f1 --- /dev/null +++ b/0001-Use-cargo-install-no-track-with-cargo-1.41.patch @@ -0,0 +1,37 @@ +From b4581d8f5ba5e48de9a97988d95739b364222acd Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Thu, 30 Jan 2020 22:02:59 -0800 +Subject: [PATCH] Use `cargo install --no-track` with cargo 1.41 + +In cargo 1.41, `cargo install` adds a new `.crates2.json` file in the +install root for tracking version upgrades. This would be another file +that `%cargo_install` should remove afterward, but there is also a new +`--no-track` option which disables such metadata files altogether. + +This update should be coordinated with the Rust toolchain update in the +distro, e.g. with rust-packaging `Requires: cargo >= 1.41`. The new +option will be rejected as an unstable option on earlier versions. +--- + data/macros.cargo | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 5f601114a893..a916699b806b 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -101,11 +101,11 @@ fi \ + %{shrink:\ + %{__cargo} install \ + %{__cargo_common_opts} \ ++ --no-track \ + --path . \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ + } \ +- %{__rm} %{buildroot}%{_prefix}/.crates.toml \ + fi \ + %endif \ + ) +-- +2.24.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 854fcbd..2c28984 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,13 +4,16 @@ Name: rust-packaging Version: 13 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz +# https://pagure.io/fedora-rust/rust2rpm/pull-request/107 +Patch1: 0001-Use-cargo-install-no-track-with-cargo-1.41.patch + ExclusiveArch: %{rust_arches} # gawk is needed for stripping dev-deps in macro @@ -18,7 +21,7 @@ Requires: gawk Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} Requires: rust-srpm-macros = %{version} Requires: rust -Requires: cargo +Requires: cargo >= 1.41 %description The package provides macros for building projects in Rust @@ -69,6 +72,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 282431b1c674e4f2f1a3051abbe40b0d6c6f523f Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Sat, 2 May 2020 19:17:22 +0200 Subject: [PATCH 65/96] Update to 14 Signed-off-by: Igor Raits --- .gitignore | 1 + ...rgo-install-no-track-with-cargo-1.41.patch | 37 ------------------- rust-packaging.spec | 10 ++--- sources | 2 +- 4 files changed, 7 insertions(+), 43 deletions(-) delete mode 100644 0001-Use-cargo-install-no-track-with-cargo-1.41.patch diff --git a/.gitignore b/.gitignore index 1fa667d..64d05ef 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /rust2rpm-11.tar.xz /rust2rpm-12.tar.xz /rust2rpm-13.tar.xz +/rust2rpm-14.tar.xz diff --git a/0001-Use-cargo-install-no-track-with-cargo-1.41.patch b/0001-Use-cargo-install-no-track-with-cargo-1.41.patch deleted file mode 100644 index 95427f1..0000000 --- a/0001-Use-cargo-install-no-track-with-cargo-1.41.patch +++ /dev/null @@ -1,37 +0,0 @@ -From b4581d8f5ba5e48de9a97988d95739b364222acd Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Thu, 30 Jan 2020 22:02:59 -0800 -Subject: [PATCH] Use `cargo install --no-track` with cargo 1.41 - -In cargo 1.41, `cargo install` adds a new `.crates2.json` file in the -install root for tracking version upgrades. This would be another file -that `%cargo_install` should remove afterward, but there is also a new -`--no-track` option which disables such metadata files altogether. - -This update should be coordinated with the Rust toolchain update in the -distro, e.g. with rust-packaging `Requires: cargo >= 1.41`. The new -option will be rejected as an unstable option on earlier versions. ---- - data/macros.cargo | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 5f601114a893..a916699b806b 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -101,11 +101,11 @@ fi \ - %{shrink:\ - %{__cargo} install \ - %{__cargo_common_opts} \ -+ --no-track \ - --path . \ - %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ - %* \ - } \ -- %{__rm} %{buildroot}%{_prefix}/.crates.toml \ - fi \ - %endif \ - ) --- -2.24.1 - diff --git a/rust-packaging.spec b/rust-packaging.spec index 2c28984..bd954f3 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,17 +3,14 @@ %global debug_package %{nil} Name: rust-packaging -Version: 13 -Release: 3%{?dist} +Version: 14 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -# https://pagure.io/fedora-rust/rust2rpm/pull-request/107 -Patch1: 0001-Use-cargo-install-no-track-with-cargo-1.41.patch - ExclusiveArch: %{rust_arches} # gawk is needed for stripping dev-deps in macro @@ -72,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index ab8f1d8..b2f766b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-13.tar.xz) = 48eb5eb5fa574b9c0df8b4feac963e873c15ed4f347023326e0809bff6afbd2c3ad9848e43e678d7bc4314c2f2231dbac8ddacb70d1370c134e3597e2b8f7cfc +SHA512 (rust2rpm-14.tar.xz) = 2710843103e1c44a0816f25720a0e711bf0a6beafacdb37f2828d4f1eae7959f0768952d33eb6dc295b9f5adaf383d814e553a20e27e359c0a1afc69b8d063e5 From 8749c144f6f2d91420960db5d150d5a142546c01 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Fri, 22 May 2020 20:06:51 +0200 Subject: [PATCH 66/96] Update to 15 Signed-off-by: Igor Raits --- .gitignore | 1 + rust-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 64d05ef..71fa7db 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /rust2rpm-12.tar.xz /rust2rpm-13.tar.xz /rust2rpm-14.tar.xz +/rust2rpm-15.tar.xz diff --git a/rust-packaging.spec b/rust-packaging.spec index bd954f3..4119703 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,7 +3,7 @@ %global debug_package %{nil} Name: rust-packaging -Version: 14 +Version: 15 Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures @@ -69,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Fri May 22 2020 Igor Raits - 15-1 +- Update to 15 + * Sat May 02 2020 Igor Raits - 14-1 - Update to 14 diff --git a/sources b/sources index b2f766b..2bdf05b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-14.tar.xz) = 2710843103e1c44a0816f25720a0e711bf0a6beafacdb37f2828d4f1eae7959f0768952d33eb6dc295b9f5adaf383d814e553a20e27e359c0a1afc69b8d063e5 +SHA512 (rust2rpm-15.tar.xz) = 5006cf2bd0de5cba3b0551522db40512bf9256d94068fd4cbffbe9227ee1ab02e0da1c2e02f3daaa12e307d3d4342d0624d2ea71771d51b8f070fa4dd9c06152 From f4158d6d48392604aa4ecc775fbcb2516bee41aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 26 May 2020 03:49:43 +0200 Subject: [PATCH 67/96] Rebuilt for Python 3.9 --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 4119703..c65ace4 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 15 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -69,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 645f1c6fc4d117ccb20225de26d4b9d1c733108d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jul 2020 08:51:37 +0000 Subject: [PATCH 68/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index c65ace4..912364e 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 15 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -69,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 3f2f8dad0ec6cbd7e643d82e3a48eb3140860a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 13 Nov 2020 14:23:46 +0100 Subject: [PATCH 69/96] Version 16 --- .gitignore | 1 + rust-packaging.spec | 10 +++++----- sources | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 71fa7db..5252e9b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /rust2rpm-13.tar.xz /rust2rpm-14.tar.xz /rust2rpm-15.tar.xz +/rust2rpm-v16.tar.gz diff --git a/rust-packaging.spec b/rust-packaging.spec index 912364e..095ee1f 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,14 +3,14 @@ %global debug_package %{nil} Name: rust-packaging -Version: 15 -Release: 3%{?dist} +Version: 16 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm -Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz - +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 @@ -40,7 +40,7 @@ Provides: rust2rpm = %{version}-%{release} %{summary}. %prep -%autosetup -n rust2rpm-%{version} -p1 +%autosetup -n rust2rpm-v%{version} -p1 %build %py3_build diff --git a/sources b/sources index 2bdf05b..74237c5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-15.tar.xz) = 5006cf2bd0de5cba3b0551522db40512bf9256d94068fd4cbffbe9227ee1ab02e0da1c2e02f3daaa12e307d3d4342d0624d2ea71771d51b8f070fa4dd9c06152 +SHA512 (rust2rpm-v16.tar.gz) = 02be612b938eec11dba5c7b9a23e3a3fdc92b919dd50a38774222b2f3f06e0600ef815dba97947f6ba5fb71dd5090565b7cc6cb8036eb4c2f8187a1fa36b5b20 From d936b970ca86309574b6bf15fe8a8cdcb933a3f9 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Sat, 26 Dec 2020 12:56:22 +0100 Subject: [PATCH 70/96] Update to 17 Signed-off-by: Igor Raits --- .gitignore | 1 + rust-packaging.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5252e9b..de90253 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /rust2rpm-14.tar.xz /rust2rpm-15.tar.xz /rust2rpm-v16.tar.gz +/rust2rpm-v17.tar.gz diff --git a/rust-packaging.spec b/rust-packaging.spec index 095ee1f..046ab29 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,13 +3,13 @@ %global debug_package %{nil} Name: rust-packaging -Version: 16 +Version: 17 Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm -Source: https://pagure.io/fedora-rust/rust2rpm/archive/v16/rust2rpm-v%{version}.tar.gz +Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz ExclusiveArch: %{rust_arches} @@ -69,6 +69,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index 74237c5..fddf345 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-v16.tar.gz) = 02be612b938eec11dba5c7b9a23e3a3fdc92b919dd50a38774222b2f3f06e0600ef815dba97947f6ba5fb71dd5090565b7cc6cb8036eb4c2f8187a1fa36b5b20 +SHA512 (rust2rpm-v17.tar.gz) = e4863a9545aabe3d4bf4d371ee95f8f62be0a35c6c0425175366ffc51717d7f914562ae4be22379714aff0aadbc9f3f2ff172969aec6c9f7996d16fade870a05 From b042dacc3867878d05a75bf34845e5daed3c47f2 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Mon, 28 Dec 2020 12:47:32 +0100 Subject: [PATCH 71/96] Band-aid clap pre-release version Signed-off-by: Igor Raits --- ...ire-upper-bound-dependency-with-sign.patch | 110 ++++++++++++++++++ rust-packaging.spec | 9 +- 2 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 0001-Always-require-upper-bound-dependency-with-sign.patch diff --git a/0001-Always-require-upper-bound-dependency-with-sign.patch b/0001-Always-require-upper-bound-dependency-with-sign.patch new file mode 100644 index 0000000..51ae3b9 --- /dev/null +++ b/0001-Always-require-upper-bound-dependency-with-sign.patch @@ -0,0 +1,110 @@ +From 617d4b9140b35f4f74def98b87a69a84943a33de Mon Sep 17 00:00:00 2001 +From: Igor Raits +Date: Mon, 28 Dec 2020 12:44:52 +0100 +Subject: [PATCH] Always require upper-bound dependency with ~ sign + +Proper fix is quite complex and given we do not package pre-release +versions very often (and esp. not multiple versions of them), this is +good enough (not nice though). + +References: https://pagure.io/fedora-rust/rust2rpm/issue/70 +Signed-off-by: Igor Raits +--- + rust2rpm/metadata.py | 2 +- + test.py | 40 ++++++++++++++++++++-------------------- + 2 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py +index b29e7b5..4636cc5 100644 +--- a/rust2rpm/metadata.py ++++ b/rust2rpm/metadata.py +@@ -197,7 +197,7 @@ class Dependency: + if not reqs: + return cap + deps = ' with '.join( +- f'{cap} {op} {CargoSemVer.unparse_version(version, sep="~")}' ++ f'{cap} {op} {CargoSemVer.unparse_version(version, sep="~")}{"~" if op == CargoSemVer.KIND_LT else ""}' + for op, version in reqs) + if len(reqs) > 1: + return f"({deps})" +diff --git a/test.py b/test.py +index ccda3b5..7623be0 100644 +--- a/test.py ++++ b/test.py +@@ -6,53 +6,53 @@ from rust2rpm.metadata import Version + + @pytest.mark.parametrize("req, rpmdep", [ + ("^1.2.3", +- "(crate(test) >= 1.2.3 with crate(test) < 2.0.0)"), ++ "(crate(test) >= 1.2.3 with crate(test) < 2.0.0~)"), + ("^1.2", +- "(crate(test) >= 1.2.0 with crate(test) < 2.0.0)"), ++ "(crate(test) >= 1.2.0 with crate(test) < 2.0.0~)"), + ("^1", +- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), ++ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), + ("^0.2.3", +- "(crate(test) >= 0.2.3 with crate(test) < 0.3.0)"), ++ "(crate(test) >= 0.2.3 with crate(test) < 0.3.0~)"), + ("^0.2", +- "(crate(test) >= 0.2.0 with crate(test) < 0.3.0)"), ++ "(crate(test) >= 0.2.0 with crate(test) < 0.3.0~)"), + ("^0.0.3", +- "(crate(test) >= 0.0.3 with crate(test) < 0.0.4)"), ++ "(crate(test) >= 0.0.3 with crate(test) < 0.0.4~)"), + ("^0.0", +- "(crate(test) >= 0.0.0 with crate(test) < 0.1.0)"), ++ "(crate(test) >= 0.0.0 with crate(test) < 0.1.0~)"), + ("^0", +- "(crate(test) >= 0.0.0 with crate(test) < 1.0.0)"), ++ "(crate(test) >= 0.0.0 with crate(test) < 1.0.0~)"), + ("~1.2.3", +- "(crate(test) >= 1.2.3 with crate(test) < 1.3.0)"), ++ "(crate(test) >= 1.2.3 with crate(test) < 1.3.0~)"), + ("~1.2", +- "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"), ++ "(crate(test) >= 1.2.0 with crate(test) < 1.3.0~)"), + ("~1", +- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), ++ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), + ("*", + "crate(test) >= 0.0.0"), + ("1.*", +- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), ++ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), + ("1.2.*", +- "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"), ++ "(crate(test) >= 1.2.0 with crate(test) < 1.3.0~)"), + ("1.*.*", +- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), ++ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), + (">= 1.2.0", + "crate(test) >= 1.2.0"), + ("> 1", + "crate(test) > 1.0.0"), + ("< 2", +- "crate(test) < 2.0.0"), ++ "crate(test) < 2.0.0~"), + ("= 1.2.3", + "crate(test) = 1.2.3"), + (">= 1.2, < 1.5", +- "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"), ++ "(crate(test) >= 1.2.0 with crate(test) < 1.5.0~)"), + ("^1.0.0-alpha.6", +- "(crate(test) >= 1.0.0~alpha.6 with crate(test) < 2.0.0)"), ++ "(crate(test) >= 1.0.0~alpha.6 with crate(test) < 2.0.0~)"), + ("^0.1.0-alpha.6", +- "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0)"), ++ "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0~)"), + ("^0.0.1-alpha.6", +- "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2)"), ++ "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2~)"), + ("^0.0.0-alpha.6", +- "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1)"), ++ "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1~)"), + ]) + def test_dependency(req, rpmdep): + dep = rust2rpm.Dependency("test", req) +-- +2.30.0.rc2 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 046ab29..478a048 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,13 +4,15 @@ Name: rust-packaging Version: 17 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz - +# https://pagure.io/fedora-rust/rust2rpm/issue/70 +Patch0001: 0001-Always-require-upper-bound-dependency-with-sign.patch + ExclusiveArch: %{rust_arches} # gawk is needed for stripping dev-deps in macro @@ -69,6 +71,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 61263cce23152f910ad48f8ec7aa868e2001ab3d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 27 Jan 2021 18:26:04 +0000 Subject: [PATCH 72/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 478a048..77f30c8 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 17 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -71,6 +71,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From 758a9ab518d03e7df2d23da918a04c8ff27d50ec Mon Sep 17 00:00:00 2001 From: Python Maint Date: Wed, 2 Jun 2021 23:10:01 +0200 Subject: [PATCH 73/96] Rebuilt for Python 3.10 --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 77f30c8..4303895 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 17 -Release: 3%{?dist} +Release: 4%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -71,6 +71,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 From f54cf005bddfdfef3db057bd21b11b3127620629 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Mon, 12 Jul 2021 23:37:08 +0200 Subject: [PATCH 74/96] update to version 18 --- .gitignore | 1 + rust-packaging.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index de90253..1ae2c37 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /rust2rpm-15.tar.xz /rust2rpm-v16.tar.gz /rust2rpm-v17.tar.gz +/rust2rpm-v18.tar.gz diff --git a/rust-packaging.spec b/rust-packaging.spec index 4303895..4e24680 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,8 +3,8 @@ %global debug_package %{nil} Name: rust-packaging -Version: 17 -Release: 4%{?dist} +Version: 18 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -71,6 +71,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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 diff --git a/sources b/sources index fddf345..5122c0e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-v17.tar.gz) = e4863a9545aabe3d4bf4d371ee95f8f62be0a35c6c0425175366ffc51717d7f914562ae4be22379714aff0aadbc9f3f2ff172969aec6c9f7996d16fade870a05 +SHA512 (rust2rpm-v18.tar.gz) = 13eb211ad3dd727d6596d4f3f7275760ada9976ed834167b0a033ea394ed7dac3d0812d0044c8b0dc2a9ffadfdb3d79f8669acf0a3dab62bfe81ac5d34c43edd From f8ac24786c7e09cd9e41058b9484973d717bcb2b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 23 Jul 2021 15:07:19 +0000 Subject: [PATCH 75/96] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 4e24680..2568df9 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 18 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -71,6 +71,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* 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. From 98eade42f6e9a458f352908ac0385481092de238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 22 Nov 2021 13:42:06 +0100 Subject: [PATCH 76/96] Convert to rpmautospec --- changelog | 206 +++++++++++++++++++++++++++++++++++++++++++ rust-packaging.spec | 209 +------------------------------------------- 2 files changed, 208 insertions(+), 207 deletions(-) create mode 100644 changelog diff --git a/changelog b/changelog new file mode 100644 index 0000000..779a325 --- /dev/null +++ b/changelog @@ -0,0 +1,206 @@ +* 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 diff --git a/rust-packaging.spec b/rust-packaging.spec index 2568df9..9857a02 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,7 +4,7 @@ Name: rust-packaging Version: 18 -Release: 2%{?dist} +Release: %autorelease Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -71,209 +71,4 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog -* 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 +%autochangelog From 4c2e29500f5cd1bd861f7248558ef99dd1dd05bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 22 Nov 2021 13:49:31 +0100 Subject: [PATCH 77/96] Version 19 --- .gitignore | 1 + rust-packaging.spec | 3 ++- sources | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1ae2c37..cd17452 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /rust2rpm-v16.tar.gz /rust2rpm-v17.tar.gz /rust2rpm-v18.tar.gz +/rust2rpm-v19.tar.gz diff --git a/rust-packaging.spec b/rust-packaging.spec index 9857a02..ef784c9 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,7 +3,7 @@ %global debug_package %{nil} Name: rust-packaging -Version: 18 +Version: 19 Release: %autorelease Summary: RPM macros for building Rust packages on various architectures @@ -65,6 +65,7 @@ py.test-%{python3_version} -vv test.py %files -n python3-rust2rpm %license LICENSE +%doc NEWS %{_bindir}/rust2rpm %{_bindir}/cargo-inspector %{python3_sitelib}/rust2rpm-*.egg-info/ diff --git a/sources b/sources index 5122c0e..9f4cdf4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-v18.tar.gz) = 13eb211ad3dd727d6596d4f3f7275760ada9976ed834167b0a033ea394ed7dac3d0812d0044c8b0dc2a9ffadfdb3d79f8669acf0a3dab62bfe81ac5d34c43edd +SHA512 (rust2rpm-v19.tar.gz) = a75a7994a1e2760c9db2c94c67863e5a03336223963f70d2253b814c247cf547152f0ed7939b0a0ba529b5e8e255ef064bc4d57a0e9d0d539a79d695bf0a6851 From c74127944f2d02b03adddbceedc23bfea6b55ef4 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Sat, 27 Nov 2021 17:47:26 +0100 Subject: [PATCH 79/96] EPEL9 hack: Allow older rust-srpm-macros Signed-off-by: Igor Raits --- rust-packaging.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index ef784c9..c955804 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -18,7 +18,7 @@ ExclusiveArch: %{rust_arches} # gawk is needed for stripping dev-deps in macro Requires: gawk Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} -Requires: rust-srpm-macros = %{version} +Requires: rust-srpm-macros >= 17 Requires: rust Requires: cargo >= 1.41 From 0b773e392d8a49f07a338644dcf95cd5b804c84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 29 Nov 2021 22:33:20 +0100 Subject: [PATCH 81/96] Version 20 --- .gitignore | 1 + ...ire-upper-bound-dependency-with-sign.patch | 110 ------------------ rust-packaging.spec | 4 +- sources | 2 +- 4 files changed, 3 insertions(+), 114 deletions(-) delete mode 100644 0001-Always-require-upper-bound-dependency-with-sign.patch diff --git a/.gitignore b/.gitignore index cd17452..7256461 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ /rust2rpm-v17.tar.gz /rust2rpm-v18.tar.gz /rust2rpm-v19.tar.gz +/rust2rpm-v20.tar.gz diff --git a/0001-Always-require-upper-bound-dependency-with-sign.patch b/0001-Always-require-upper-bound-dependency-with-sign.patch deleted file mode 100644 index 51ae3b9..0000000 --- a/0001-Always-require-upper-bound-dependency-with-sign.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 617d4b9140b35f4f74def98b87a69a84943a33de Mon Sep 17 00:00:00 2001 -From: Igor Raits -Date: Mon, 28 Dec 2020 12:44:52 +0100 -Subject: [PATCH] Always require upper-bound dependency with ~ sign - -Proper fix is quite complex and given we do not package pre-release -versions very often (and esp. not multiple versions of them), this is -good enough (not nice though). - -References: https://pagure.io/fedora-rust/rust2rpm/issue/70 -Signed-off-by: Igor Raits ---- - rust2rpm/metadata.py | 2 +- - test.py | 40 ++++++++++++++++++++-------------------- - 2 files changed, 21 insertions(+), 21 deletions(-) - -diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py -index b29e7b5..4636cc5 100644 ---- a/rust2rpm/metadata.py -+++ b/rust2rpm/metadata.py -@@ -197,7 +197,7 @@ class Dependency: - if not reqs: - return cap - deps = ' with '.join( -- f'{cap} {op} {CargoSemVer.unparse_version(version, sep="~")}' -+ f'{cap} {op} {CargoSemVer.unparse_version(version, sep="~")}{"~" if op == CargoSemVer.KIND_LT else ""}' - for op, version in reqs) - if len(reqs) > 1: - return f"({deps})" -diff --git a/test.py b/test.py -index ccda3b5..7623be0 100644 ---- a/test.py -+++ b/test.py -@@ -6,53 +6,53 @@ from rust2rpm.metadata import Version - - @pytest.mark.parametrize("req, rpmdep", [ - ("^1.2.3", -- "(crate(test) >= 1.2.3 with crate(test) < 2.0.0)"), -+ "(crate(test) >= 1.2.3 with crate(test) < 2.0.0~)"), - ("^1.2", -- "(crate(test) >= 1.2.0 with crate(test) < 2.0.0)"), -+ "(crate(test) >= 1.2.0 with crate(test) < 2.0.0~)"), - ("^1", -- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), -+ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), - ("^0.2.3", -- "(crate(test) >= 0.2.3 with crate(test) < 0.3.0)"), -+ "(crate(test) >= 0.2.3 with crate(test) < 0.3.0~)"), - ("^0.2", -- "(crate(test) >= 0.2.0 with crate(test) < 0.3.0)"), -+ "(crate(test) >= 0.2.0 with crate(test) < 0.3.0~)"), - ("^0.0.3", -- "(crate(test) >= 0.0.3 with crate(test) < 0.0.4)"), -+ "(crate(test) >= 0.0.3 with crate(test) < 0.0.4~)"), - ("^0.0", -- "(crate(test) >= 0.0.0 with crate(test) < 0.1.0)"), -+ "(crate(test) >= 0.0.0 with crate(test) < 0.1.0~)"), - ("^0", -- "(crate(test) >= 0.0.0 with crate(test) < 1.0.0)"), -+ "(crate(test) >= 0.0.0 with crate(test) < 1.0.0~)"), - ("~1.2.3", -- "(crate(test) >= 1.2.3 with crate(test) < 1.3.0)"), -+ "(crate(test) >= 1.2.3 with crate(test) < 1.3.0~)"), - ("~1.2", -- "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"), -+ "(crate(test) >= 1.2.0 with crate(test) < 1.3.0~)"), - ("~1", -- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), -+ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), - ("*", - "crate(test) >= 0.0.0"), - ("1.*", -- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), -+ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), - ("1.2.*", -- "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"), -+ "(crate(test) >= 1.2.0 with crate(test) < 1.3.0~)"), - ("1.*.*", -- "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"), -+ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), - (">= 1.2.0", - "crate(test) >= 1.2.0"), - ("> 1", - "crate(test) > 1.0.0"), - ("< 2", -- "crate(test) < 2.0.0"), -+ "crate(test) < 2.0.0~"), - ("= 1.2.3", - "crate(test) = 1.2.3"), - (">= 1.2, < 1.5", -- "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"), -+ "(crate(test) >= 1.2.0 with crate(test) < 1.5.0~)"), - ("^1.0.0-alpha.6", -- "(crate(test) >= 1.0.0~alpha.6 with crate(test) < 2.0.0)"), -+ "(crate(test) >= 1.0.0~alpha.6 with crate(test) < 2.0.0~)"), - ("^0.1.0-alpha.6", -- "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0)"), -+ "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0~)"), - ("^0.0.1-alpha.6", -- "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2)"), -+ "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2~)"), - ("^0.0.0-alpha.6", -- "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1)"), -+ "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1~)"), - ]) - def test_dependency(req, rpmdep): - dep = rust2rpm.Dependency("test", req) --- -2.30.0.rc2 - diff --git a/rust-packaging.spec b/rust-packaging.spec index c955804..d15feb6 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,15 +3,13 @@ %global debug_package %{nil} Name: rust-packaging -Version: 19 +Version: 20 Release: %autorelease Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz -# https://pagure.io/fedora-rust/rust2rpm/issue/70 -Patch0001: 0001-Always-require-upper-bound-dependency-with-sign.patch ExclusiveArch: %{rust_arches} diff --git a/sources b/sources index 9f4cdf4..3c96919 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-v19.tar.gz) = a75a7994a1e2760c9db2c94c67863e5a03336223963f70d2253b814c247cf547152f0ed7939b0a0ba529b5e8e255ef064bc4d57a0e9d0d539a79d695bf0a6851 +SHA512 (rust2rpm-v20.tar.gz) = f29a443b61690c71b023ce9d9536ca05099fdd9c51ccca921dd75fc578d6213b095b5becdeb85040fb073f9a59610553091345c34ce2bde4514689b303c951b1 From 9490476bd131f63056fe5b9d88e9eb36f64531fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 14 Feb 2022 22:25:29 +0100 Subject: [PATCH 82/96] Include linker flags for package note in %build_rustflags This was tested in copr [1]: 96 packages succeeded: - rust-afterburn rust-alacritty rust-askalono-cli rust-assert_cli rust-base100 rust-bat rust-below rust-bindgen rust-blsctl rust-bodhi-cli rust-bootupd rust-btrd rust-cargo-bloat rust-cargo-c rust-cargo-insta rust-cargo-readme rust-cbindgen rust-choosier rust-comrak rust-copydeps rust-coreos-installer rust-count-zeroes rust-dbus-codegen rust-desed rust-diskonaut rust-docopt rust-drg rust-dua-cli rust-dutree rust-edit rust-elfcat rust-exa rust-fd-find rust-fedora-coreos-pinger rust-fedora-update-feedback rust-fluent-syntax rust-git-delta rust-gitui rust-handlebars rust-heatseeker rust-helvum rust-hexyl rust-hyperfine rust-jql rust-just rust-lalrpop rust-leb128 rust-libbpf-cargo rust-libslirp rust-lscolors rust-lsd rust-oxipng rust-packaging rust-peg0.5 rust-permutate rust-pleaser rust-pommes rust-pretty-git-prompt rust-procs rust-protobuf-codegen rust-pulldown-cmark rust-python-launcher rust-rav1e rust-rd-agent rust-rd-hashd rust-read-process-memory rust-resctl-bench rust-resctl-demo rust-ripgrep rust-rpick rust-rudo rust-rustbus rust-rustdoc-stripper rust-rustfilt rust-sass-rs rust-sd rust-semver-parser rust-sequoia-keyring-linter rust-sequoia-sop rust-sequoia-sq rust-sequoia-sqv rust-sevctl rust-sha1collisiondetection rust-silver rust-skim rust-ssh-key-dir rust-starship rust-subprocess rust-system76_ectool rust-tealdeer rust-termbg rust-tokei rust-varlink-cli rust-varlink_generator rust-weezl rust-ybaas rust-yubibomb rust-zincati rust-zopfli rust-zoxide rust-zram-generator 11 failures: - rust-bootupd: partial architecture support - rust-cargo-c: compilation failure on one architecture - rust-oxipng: partial architecture support - rust-sevctl: partial architecture support - rust-cargo-edit: nothing provides requested (crate(toml_edit/default) >= 0.2.0 with crate(toml_edit/default) < 0.3.0~) - rust-ffsend: nothing provides requested (crate(version-compare/default) >= 0.1.0 with crate(version-compare/default) < 0.2.0~) - rust-image-roll: nothing provides requested (crate(infer/default) >= 0.6.0 with crate(infer/default) < 0.7.0~) - rust-inferno: nothing provides requested (crate(assert_cmd/default) >= 1.0.0 with crate(assert_cmd/default) < 2.0.0~) - rust-navi: compilation erros (releted to clap version?) - rust-rbspy: compilation erros (releted to nix version?) - rust-sequoia-octopus-librnp: cannot find function `thread_rng` in crate `rand` - rust-sevctl: copr build timeout [1] https://copr.fedorainfracloud.org/coprs/zbyszek/rust-package-notes/builds/ --- 168.patch | 34 +++++++++++++++++++++++++ 179.patch | 61 +++++++++++++++++++++++++++++++++++++++++++++ rust-packaging.spec | 2 ++ 3 files changed, 97 insertions(+) create mode 100644 168.patch create mode 100644 179.patch diff --git a/168.patch b/168.patch new file mode 100644 index 0000000..acef049 --- /dev/null +++ b/168.patch @@ -0,0 +1,34 @@ +From f1be3a0d4d2df6497d46f627cc54ce8450da8699 Mon Sep 17 00:00:00 2001 +From: Aleksei Bavshin +Date: Dec 06 2021 06:20:52 +0000 +Subject: macros: pass CFLAGS/CXXFLAGS to the processes started by cargo + + +This is mainly targeted to the crates using `rust-cc`, where we want to +apply system-wide compiler flags when invoking the compiler. `cc` +supports CFLAGS and CXXFLAGS, but we never set those. +Defining that per project is not possible, as we have no way to inherit +any build context from a dependency package. + +Possibly also affects: `bindgen`, `cxx`, any other crate that invokes +the C/C++ compiler and passes the CFLAGSS + +--- + +diff --git a/data/macros.cargo b/data/macros.cargo +index 0a68998..07fcb56 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -22,6 +22,11 @@ rustc = "%{__rustc}"\ + rustdoc = "%{__rustdoc}"\ + rustflags = %{__global_rustflags_toml}\ + \ ++[env]\ ++CFLAGS = "%{build_cflags}"\ ++CXXFLAGS = "%{build_cxxflags}"\ ++LDFLAGS = "%{build_ldflags}"\ ++\ + [install]\ + root = "%{buildroot}%{_prefix}"\ + \ + diff --git a/179.patch b/179.patch new file mode 100644 index 0000000..25c3b80 --- /dev/null +++ b/179.patch @@ -0,0 +1,61 @@ +From 0131b4e28aca1e036d1d089a17553d6378657e07 Mon Sep 17 00:00:00 2001 +From: Zbigniew Jędrzejewski-Szmek +Date: Feb 15 2022 09:59:42 +0000 +Subject: Include linker flags for package note in %build_rustflags + + +%build_rustflags was used in %cargo_prep, which is executed in %prep, +when %buildsubdir is not set yet. To avoid this, insertion of flags is +moved to an environment variable that is set for %cargo_build and +%cargo_test. + +The linker flag gets passed to rustc, and resulting binaries seem to have +note as expected. + +--- + +diff --git a/data/macros.cargo b/data/macros.cargo +index 07fcb56..05f5eb2 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -4,7 +4,7 @@ + # it never writes to ~/.cargo during rpmbuild. + # We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps + # until it gets stabilized: https://github.com/rust-lang/cargo/issues/5133 +-%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo ++%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' %{_bindir}/cargo + %__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps + %__cargo_inspector %{_bindir}/cargo-inspector + +@@ -20,7 +20,6 @@ cat > .cargo/config << EOF \ + [build]\ + rustc = "%{__rustc}"\ + rustdoc = "%{__rustdoc}"\ +-rustflags = %{__global_rustflags_toml}\ + \ + [env]\ + CFLAGS = "%{build_cflags}"\ +@@ -61,6 +60,7 @@ EOF\ + + %cargo_build(naf:) \ + %{shrink:\ ++ RUSTFLAGS='%{build_rustflags}' \ + %{__cargo} build \ + %{__cargo_common_opts} \ + --release \ +diff --git a/data/macros.rust b/data/macros.rust +index 7377f92..0940d06 100644 +--- a/data/macros.rust ++++ b/data/macros.rust +@@ -5,7 +5,9 @@ + %build_rustflags %{shrink: + -Copt-level=3 + -Cdebuginfo=2 +- -Clink-arg=-Wl,-z,relro,-z,now ++ -Clink-arg=-Wl,-z,relro ++ -Clink-arg=-Wl,-z,now ++ %{?_package_note_file:-Clink-arg=-Wl,-dT,%{_package_note_file}} + -Ccodegen-units=1 + --cap-lints=warn + } + diff --git a/rust-packaging.spec b/rust-packaging.spec index d15feb6..8fd7417 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -10,6 +10,8 @@ Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz +Patch: https://pagure.io/fedora-rust/rust2rpm/pull-request/168.patch +Patch: https://pagure.io/fedora-rust/rust2rpm/pull-request/179.patch ExclusiveArch: %{rust_arches} From e8c33415757dbe48d605a7e074ff5c01aac64fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 20 Feb 2022 16:12:23 +0100 Subject: [PATCH 83/96] Version 21 Let's adjust the package descriptions a bit too. --- .gitignore | 1 + 168.patch | 34 ------------------------- 179.patch | 61 --------------------------------------------- rust-packaging.spec | 14 +++++------ sources | 2 +- 5 files changed, 9 insertions(+), 103 deletions(-) delete mode 100644 168.patch delete mode 100644 179.patch diff --git a/.gitignore b/.gitignore index 7256461..875f8ef 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /rust2rpm-v18.tar.gz /rust2rpm-v19.tar.gz /rust2rpm-v20.tar.gz +/rust2rpm-v21.tar.gz diff --git a/168.patch b/168.patch deleted file mode 100644 index acef049..0000000 --- a/168.patch +++ /dev/null @@ -1,34 +0,0 @@ -From f1be3a0d4d2df6497d46f627cc54ce8450da8699 Mon Sep 17 00:00:00 2001 -From: Aleksei Bavshin -Date: Dec 06 2021 06:20:52 +0000 -Subject: macros: pass CFLAGS/CXXFLAGS to the processes started by cargo - - -This is mainly targeted to the crates using `rust-cc`, where we want to -apply system-wide compiler flags when invoking the compiler. `cc` -supports CFLAGS and CXXFLAGS, but we never set those. -Defining that per project is not possible, as we have no way to inherit -any build context from a dependency package. - -Possibly also affects: `bindgen`, `cxx`, any other crate that invokes -the C/C++ compiler and passes the CFLAGSS - ---- - -diff --git a/data/macros.cargo b/data/macros.cargo -index 0a68998..07fcb56 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -22,6 +22,11 @@ rustc = "%{__rustc}"\ - rustdoc = "%{__rustdoc}"\ - rustflags = %{__global_rustflags_toml}\ - \ -+[env]\ -+CFLAGS = "%{build_cflags}"\ -+CXXFLAGS = "%{build_cxxflags}"\ -+LDFLAGS = "%{build_ldflags}"\ -+\ - [install]\ - root = "%{buildroot}%{_prefix}"\ - \ - diff --git a/179.patch b/179.patch deleted file mode 100644 index 25c3b80..0000000 --- a/179.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0131b4e28aca1e036d1d089a17553d6378657e07 Mon Sep 17 00:00:00 2001 -From: Zbigniew Jędrzejewski-Szmek -Date: Feb 15 2022 09:59:42 +0000 -Subject: Include linker flags for package note in %build_rustflags - - -%build_rustflags was used in %cargo_prep, which is executed in %prep, -when %buildsubdir is not set yet. To avoid this, insertion of flags is -moved to an environment variable that is set for %cargo_build and -%cargo_test. - -The linker flag gets passed to rustc, and resulting binaries seem to have -note as expected. - ---- - -diff --git a/data/macros.cargo b/data/macros.cargo -index 07fcb56..05f5eb2 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -4,7 +4,7 @@ - # it never writes to ~/.cargo during rpmbuild. - # We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps - # until it gets stabilized: https://github.com/rust-lang/cargo/issues/5133 --%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo -+%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' %{_bindir}/cargo - %__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps - %__cargo_inspector %{_bindir}/cargo-inspector - -@@ -20,7 +20,6 @@ cat > .cargo/config << EOF \ - [build]\ - rustc = "%{__rustc}"\ - rustdoc = "%{__rustdoc}"\ --rustflags = %{__global_rustflags_toml}\ - \ - [env]\ - CFLAGS = "%{build_cflags}"\ -@@ -61,6 +60,7 @@ EOF\ - - %cargo_build(naf:) \ - %{shrink:\ -+ RUSTFLAGS='%{build_rustflags}' \ - %{__cargo} build \ - %{__cargo_common_opts} \ - --release \ -diff --git a/data/macros.rust b/data/macros.rust -index 7377f92..0940d06 100644 ---- a/data/macros.rust -+++ b/data/macros.rust -@@ -5,7 +5,9 @@ - %build_rustflags %{shrink: - -Copt-level=3 - -Cdebuginfo=2 -- -Clink-arg=-Wl,-z,relro,-z,now -+ -Clink-arg=-Wl,-z,relro -+ -Clink-arg=-Wl,-z,now -+ %{?_package_note_file:-Clink-arg=-Wl,-dT,%{_package_note_file}} - -Ccodegen-units=1 - --cap-lints=warn - } - diff --git a/rust-packaging.spec b/rust-packaging.spec index 8fd7417..35eff22 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -3,15 +3,13 @@ %global debug_package %{nil} Name: rust-packaging -Version: 20 +Version: 21 Release: %autorelease -Summary: RPM macros for building Rust packages on various architectures +Summary: RPM macros for building Rust packages License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz -Patch: https://pagure.io/fedora-rust/rust2rpm/pull-request/168.patch -Patch: https://pagure.io/fedora-rust/rust2rpm/pull-request/179.patch ExclusiveArch: %{rust_arches} @@ -23,11 +21,13 @@ Requires: rust Requires: cargo >= 1.41 %description -The package provides macros for building projects in Rust -on various architectures. +The package provides RPM macros for building Rust projects. + +Note that rust-srpm-macros is a seperate arch-independent package that +is also required to build Rust packages. %package -n python3-rust2rpm -Summary: Convert Rust packages to RPM +Summary: Generate RPM spec files for Rust packages BuildRequires: python3-devel BuildRequires: python3-setuptools %if %{with check} diff --git a/sources b/sources index 3c96919..a2f5243 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-v20.tar.gz) = f29a443b61690c71b023ce9d9536ca05099fdd9c51ccca921dd75fc578d6213b095b5becdeb85040fb073f9a59610553091345c34ce2bde4514689b303c951b1 +SHA512 (rust2rpm-v21.tar.gz) = 50864eea0025d1c6d681e5e618f7e7dfe3aab576ec722134e07089459d73cb954e5886409578de7dd7d1a05dfbe7cc034af5f2b4d4e27db3310b0e0a2170869e From eef3bf5cc7721e97e7ac1cda01e708ada516d32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 22 Feb 2022 11:45:43 +0100 Subject: [PATCH 84/96] Add patches to allow debuginfo level to be set easily again --- 0001-Add-comment-about-unused-macro.patch | 21 ++++++++++ ...iding-of-the-opt-level-debuginfo-cod.patch | 40 +++++++++++++++++++ rust-packaging.spec | 3 ++ 3 files changed, 64 insertions(+) create mode 100644 0001-Add-comment-about-unused-macro.patch create mode 100644 0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch diff --git a/0001-Add-comment-about-unused-macro.patch b/0001-Add-comment-about-unused-macro.patch new file mode 100644 index 0000000..cb73197 --- /dev/null +++ b/0001-Add-comment-about-unused-macro.patch @@ -0,0 +1,21 @@ +From 0aa82d22b00b4191ddff1e9ba9cb53686481f8ac Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 22 Feb 2022 11:28:52 +0100 +Subject: [PATCH 1/2] Add comment about unused macro + +--- + data/macros.rust | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/data/macros.rust b/data/macros.rust +index 0940d06485..3a9281849f 100644 +--- a/data/macros.rust ++++ b/data/macros.rust +@@ -14,6 +14,7 @@ + + %__global_rustflags %{build_rustflags} + ++# Currently unused, retained for backwards compatibility. + %__global_rustflags_toml [%{lua: + for arg in string.gmatch(rpm.expand("%{build_rustflags}"), "%S+") do + print('"' .. arg .. '", ') diff --git a/0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch b/0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch new file mode 100644 index 0000000..5e26a9c --- /dev/null +++ b/0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch @@ -0,0 +1,40 @@ +From 1b14d44d5705e2c87bc52d56f9ea184994669da1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 22 Feb 2022 11:41:46 +0100 +Subject: [PATCH 2/2] Allow easy overriding of the + opt-level/debuginfo/codegen-units flags + +Some crates use debuginfo=0 or debuginfo=1 to reduce memory pressure during +builds. This should make this easy. + +Fixes https://pagure.io/fedora-rust/rust2rpm/issue/181 +--- + data/macros.rust | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/data/macros.rust b/data/macros.rust +index 3a9281849f..efa46a3212 100644 +--- a/data/macros.rust ++++ b/data/macros.rust +@@ -1,14 +1,18 @@ + %__rustc %{_bindir}/rustc + %__rustdoc %{_bindir}/rustdoc + ++%rustflags_opt_level 3 ++%rustflags_debuginfo 2 ++%rustflags_codegen_units 1 ++ + # Enable optimization, debuginfo, and link hardening. + %build_rustflags %{shrink: +- -Copt-level=3 +- -Cdebuginfo=2 ++ -Copt-level=%rustflags_opt_level ++ -Cdebuginfo=%rustflags_debuginfo ++ -Ccodegen-units=%rustflags_codegen_units + -Clink-arg=-Wl,-z,relro + -Clink-arg=-Wl,-z,now + %{?_package_note_file:-Clink-arg=-Wl,-dT,%{_package_note_file}} +- -Ccodegen-units=1 + --cap-lints=warn + } + diff --git a/rust-packaging.spec b/rust-packaging.spec index 35eff22..ca7af2c 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -11,6 +11,9 @@ License: MIT URL: https://pagure.io/fedora-rust/rust2rpm Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz +Patch: 0001-Add-comment-about-unused-macro.patch +Patch: 0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch + ExclusiveArch: %{rust_arches} # gawk is needed for stripping dev-deps in macro From cb69f3bb23c1f261d3c141a8aff496362f34e32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 19 Mar 2022 17:37:38 +0100 Subject: [PATCH 85/96] Backport patch to fix rpmautospec detection --- 0003-Fix-autodetection-of-rpmautospec.patch | 31 +++++++++++++++++++ ...rint-information-about-written-files.patch | 31 +++++++++++++++++++ rust-packaging.spec | 2 ++ 3 files changed, 64 insertions(+) create mode 100644 0003-Fix-autodetection-of-rpmautospec.patch create mode 100644 0004-Print-information-about-written-files.patch diff --git a/0003-Fix-autodetection-of-rpmautospec.patch b/0003-Fix-autodetection-of-rpmautospec.patch new file mode 100644 index 0000000..c3c5bd0 --- /dev/null +++ b/0003-Fix-autodetection-of-rpmautospec.patch @@ -0,0 +1,31 @@ +From b9e95b4d61739f21c2f64ee3df497d93272a67af Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 28 Feb 2022 14:01:20 +0100 +Subject: [PATCH 2/3] Fix autodetection of rpmautospec + +When store_true or store_false are used, the default default changes +from None to a boolean. I didn't know about this, and I wrote the code +to assume args.rpmautospec would be None. rpmautospec detection was +effectively always disabled. +--- + rust2rpm/__main__.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index 0f575ad12f..13dc26a313 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -360,8 +360,10 @@ def main(): + parser.add_argument("-s", "--store-crate", action="store_true", + help="Store crate in current directory") + parser.add_argument("-a", "--rpmautospec", action="store_true", ++ default=None, + help="Use autorelease and autochangelog features") + parser.add_argument("--no-rpmautospec", action="store_false", ++ default=None, + help="Do not use rpmautospec") + parser.add_argument("--relative-license-paths", action="store_true", + help="Put all license files in main license directory") +-- +2.35.1 + diff --git a/0004-Print-information-about-written-files.patch b/0004-Print-information-about-written-files.patch new file mode 100644 index 0000000..fd6ac2f --- /dev/null +++ b/0004-Print-information-about-written-files.patch @@ -0,0 +1,31 @@ +From 7d8c9a802866ef0a35ab4d67d8869f30c650827a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 28 Feb 2022 10:32:10 +0100 +Subject: [PATCH 3/3] Print information about written files + +We already output some messages, but not the most important part: what +files were written. +--- + rust2rpm/__main__.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py +index 13dc26a313..a011217443 100644 +--- a/rust2rpm/__main__.py ++++ b/rust2rpm/__main__.py +@@ -515,10 +515,11 @@ def main(): + with open(spec_file, "w") as fobj: + fobj.write(spec_contents) + fobj.write("\n") ++ print(f'Wrote {fobj.name}') + if patch_file is not None: + with open(patch_file, "w") as fobj: + fobj.writelines(diff) +- ++ print(f'Wrote {fobj.name}') + + if __name__ == "__main__": + main() +-- +2.35.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index ca7af2c..11ffad4 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -13,6 +13,8 @@ Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2 Patch: 0001-Add-comment-about-unused-macro.patch Patch: 0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch +Patch: 0003-Fix-autodetection-of-rpmautospec.patch +Patch: 0004-Print-information-about-written-files.patch ExclusiveArch: %{rust_arches} From b92078eee51c43e14b09fb2e7bd2fb28c22708c4 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 1 Jul 2022 19:39:57 +0200 Subject: [PATCH 86/96] Adapt %cargo_prep macro to fix builds with Rust 1.62+ Starting with Rust 1.62, cargo fails if Cargo.toml.orig already exists, so it needs to be removed in %cargo_prep. --- ...uum-up-Cargo.toml.orig-in-addition-t.patch | 27 +++++++++++++++++++ rust-packaging.spec | 1 + 2 files changed, 28 insertions(+) create mode 100644 0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch diff --git a/0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch b/0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch new file mode 100644 index 0000000..5c0e45f --- /dev/null +++ b/0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch @@ -0,0 +1,27 @@ +From 98638813aa1e085e05092ebfcbcad7ce7fd00a44 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Fri, 1 Jul 2022 19:29:56 +0200 +Subject: [PATCH] macros.cargo: vacuum up Cargo.toml.orig in addition to + Cargo.lock + +This fixes builds with cargo from Rust 1.62+, which now complains +and fails our builds if the Cargo.toml.orig file already exists. +--- + data/macros.cargo | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 344b44e..206df14 100644 +--- a/data/macros.cargo ++++ b/data/macros.cargo +@@ -44,6 +44,7 @@ registry = "https://crates.io"\ + replace-with = "local-registry"\ + EOF\ + %{__rm} -f Cargo.lock \ ++%{__rm} -f Cargo.toml.orig \ + ) + + %__cargo_parse_opts(naf:) %{shrink:\ +-- +2.36.1 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 11ffad4..84b4f87 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -15,6 +15,7 @@ Patch: 0001-Add-comment-about-unused-macro.patch Patch: 0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch Patch: 0003-Fix-autodetection-of-rpmautospec.patch Patch: 0004-Print-information-about-written-files.patch +Patch: 0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch ExclusiveArch: %{rust_arches} From e1ab69eff6298a1412832750dfdd9fe32717b1d8 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 16 Feb 2023 14:52:14 +0100 Subject: [PATCH 87/96] Update to version 24 --- .gitignore | 3 + 0001-Add-comment-about-unused-macro.patch | 21 ---- ...iding-of-the-opt-level-debuginfo-cod.patch | 40 -------- 0003-Fix-autodetection-of-rpmautospec.patch | 31 ------ ...rint-information-about-written-files.patch | 31 ------ ...uum-up-Cargo.toml.orig-in-addition-t.patch | 27 ------ rust-packaging.spec | 95 ++++++++----------- sources | 2 +- 8 files changed, 41 insertions(+), 209 deletions(-) delete mode 100644 0001-Add-comment-about-unused-macro.patch delete mode 100644 0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch delete mode 100644 0003-Fix-autodetection-of-rpmautospec.patch delete mode 100644 0004-Print-information-about-written-files.patch delete mode 100644 0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch diff --git a/.gitignore b/.gitignore index 875f8ef..151a9ce 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ /rust2rpm-v19.tar.gz /rust2rpm-v20.tar.gz /rust2rpm-v21.tar.gz +/rust2rpm-v22.tar.gz +/rust2rpm-v23.tar.gz +/rust-packaging-24.tar.gz diff --git a/0001-Add-comment-about-unused-macro.patch b/0001-Add-comment-about-unused-macro.patch deleted file mode 100644 index cb73197..0000000 --- a/0001-Add-comment-about-unused-macro.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0aa82d22b00b4191ddff1e9ba9cb53686481f8ac Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Tue, 22 Feb 2022 11:28:52 +0100 -Subject: [PATCH 1/2] Add comment about unused macro - ---- - data/macros.rust | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/data/macros.rust b/data/macros.rust -index 0940d06485..3a9281849f 100644 ---- a/data/macros.rust -+++ b/data/macros.rust -@@ -14,6 +14,7 @@ - - %__global_rustflags %{build_rustflags} - -+# Currently unused, retained for backwards compatibility. - %__global_rustflags_toml [%{lua: - for arg in string.gmatch(rpm.expand("%{build_rustflags}"), "%S+") do - print('"' .. arg .. '", ') diff --git a/0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch b/0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch deleted file mode 100644 index 5e26a9c..0000000 --- a/0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 1b14d44d5705e2c87bc52d56f9ea184994669da1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Tue, 22 Feb 2022 11:41:46 +0100 -Subject: [PATCH 2/2] Allow easy overriding of the - opt-level/debuginfo/codegen-units flags - -Some crates use debuginfo=0 or debuginfo=1 to reduce memory pressure during -builds. This should make this easy. - -Fixes https://pagure.io/fedora-rust/rust2rpm/issue/181 ---- - data/macros.rust | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/data/macros.rust b/data/macros.rust -index 3a9281849f..efa46a3212 100644 ---- a/data/macros.rust -+++ b/data/macros.rust -@@ -1,14 +1,18 @@ - %__rustc %{_bindir}/rustc - %__rustdoc %{_bindir}/rustdoc - -+%rustflags_opt_level 3 -+%rustflags_debuginfo 2 -+%rustflags_codegen_units 1 -+ - # Enable optimization, debuginfo, and link hardening. - %build_rustflags %{shrink: -- -Copt-level=3 -- -Cdebuginfo=2 -+ -Copt-level=%rustflags_opt_level -+ -Cdebuginfo=%rustflags_debuginfo -+ -Ccodegen-units=%rustflags_codegen_units - -Clink-arg=-Wl,-z,relro - -Clink-arg=-Wl,-z,now - %{?_package_note_file:-Clink-arg=-Wl,-dT,%{_package_note_file}} -- -Ccodegen-units=1 - --cap-lints=warn - } - diff --git a/0003-Fix-autodetection-of-rpmautospec.patch b/0003-Fix-autodetection-of-rpmautospec.patch deleted file mode 100644 index c3c5bd0..0000000 --- a/0003-Fix-autodetection-of-rpmautospec.patch +++ /dev/null @@ -1,31 +0,0 @@ -From b9e95b4d61739f21c2f64ee3df497d93272a67af Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 28 Feb 2022 14:01:20 +0100 -Subject: [PATCH 2/3] Fix autodetection of rpmautospec - -When store_true or store_false are used, the default default changes -from None to a boolean. I didn't know about this, and I wrote the code -to assume args.rpmautospec would be None. rpmautospec detection was -effectively always disabled. ---- - rust2rpm/__main__.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index 0f575ad12f..13dc26a313 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -360,8 +360,10 @@ def main(): - parser.add_argument("-s", "--store-crate", action="store_true", - help="Store crate in current directory") - parser.add_argument("-a", "--rpmautospec", action="store_true", -+ default=None, - help="Use autorelease and autochangelog features") - parser.add_argument("--no-rpmautospec", action="store_false", -+ default=None, - help="Do not use rpmautospec") - parser.add_argument("--relative-license-paths", action="store_true", - help="Put all license files in main license directory") --- -2.35.1 - diff --git a/0004-Print-information-about-written-files.patch b/0004-Print-information-about-written-files.patch deleted file mode 100644 index fd6ac2f..0000000 --- a/0004-Print-information-about-written-files.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7d8c9a802866ef0a35ab4d67d8869f30c650827a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 28 Feb 2022 10:32:10 +0100 -Subject: [PATCH 3/3] Print information about written files - -We already output some messages, but not the most important part: what -files were written. ---- - rust2rpm/__main__.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py -index 13dc26a313..a011217443 100644 ---- a/rust2rpm/__main__.py -+++ b/rust2rpm/__main__.py -@@ -515,10 +515,11 @@ def main(): - with open(spec_file, "w") as fobj: - fobj.write(spec_contents) - fobj.write("\n") -+ print(f'Wrote {fobj.name}') - if patch_file is not None: - with open(patch_file, "w") as fobj: - fobj.writelines(diff) -- -+ print(f'Wrote {fobj.name}') - - if __name__ == "__main__": - main() --- -2.35.1 - diff --git a/0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch b/0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch deleted file mode 100644 index 5c0e45f..0000000 --- a/0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 98638813aa1e085e05092ebfcbcad7ce7fd00a44 Mon Sep 17 00:00:00 2001 -From: Fabio Valentini -Date: Fri, 1 Jul 2022 19:29:56 +0200 -Subject: [PATCH] macros.cargo: vacuum up Cargo.toml.orig in addition to - Cargo.lock - -This fixes builds with cargo from Rust 1.62+, which now complains -and fails our builds if the Cargo.toml.orig file already exists. ---- - data/macros.cargo | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/data/macros.cargo b/data/macros.cargo -index 344b44e..206df14 100644 ---- a/data/macros.cargo -+++ b/data/macros.cargo -@@ -44,6 +44,7 @@ registry = "https://crates.io"\ - replace-with = "local-registry"\ - EOF\ - %{__rm} -f Cargo.lock \ -+%{__rm} -f Cargo.toml.orig \ - ) - - %__cargo_parse_opts(naf:) %{shrink:\ --- -2.36.1 - diff --git a/rust-packaging.spec b/rust-packaging.spec index 84b4f87..4fac3ac 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,81 +1,60 @@ -%bcond_without check -# https://pagure.io/koji/issue/659 -%global debug_package %{nil} - Name: rust-packaging -Version: 21 +Version: 24 Release: %autorelease -Summary: RPM macros for building Rust packages - +Summary: RPM macros and generators for building Rust packages License: MIT -URL: https://pagure.io/fedora-rust/rust2rpm -Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz -Patch: 0001-Add-comment-about-unused-macro.patch -Patch: 0002-Allow-easy-overriding-of-the-opt-level-debuginfo-cod.patch -Patch: 0003-Fix-autodetection-of-rpmautospec.patch -Patch: 0004-Print-information-about-written-files.patch -Patch: 0005-macros.cargo-vacuum-up-Cargo.toml.orig-in-addition-t.patch +URL: https://pagure.io/fedora-rust/rust-packaging +Source: %{url}/archive/%{version}/rust-packaging-%{version}.tar.gz -ExclusiveArch: %{rust_arches} - -# gawk is needed for stripping dev-deps in macro -Requires: gawk -Requires: python3-rust2rpm = %{?epoch:%{epoch}:}%{version}-%{release} -Requires: rust-srpm-macros >= 17 -Requires: rust -Requires: cargo >= 1.41 +BuildArch: noarch %description -The package provides RPM macros for building Rust projects. - -Note that rust-srpm-macros is a seperate arch-independent package that -is also required to build Rust packages. - -%package -n python3-rust2rpm -Summary: Generate RPM spec files for Rust packages -BuildRequires: python3-devel -BuildRequires: python3-setuptools -%if %{with check} -BuildRequires: python3-pytest -BuildRequires: cargo -%endif +%{summary}. + +%package -n rust-srpm-macros +Summary: RPM macros for building Rust projects + +%description -n rust-srpm-macros +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 -Provides: rust2rpm = %{version}-%{release} -%{?python_provide:%python_provide python3-rust2rpm} +Requires: cargo2rpm >= 0.1.0 +Requires: gawk -%description -n python3-rust2rpm -%{summary}. +Requires: rust-srpm-macros = %{version}-%{release} + +%description -n cargo-rpm-macros +RPM macros for building projects with cargo. %prep -%autosetup -n rust2rpm-v%{version} -p1 +%autosetup -p1 %build -%py3_build +# nothing to do %install -%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 - -%if %{with check} -%check -py.test-%{python3_version} -vv test.py -%endif +install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.cargo +install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.rust +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 +%files -n rust-srpm-macros %license LICENSE %{_rpmmacrodir}/macros.rust -%{_rpmmacrodir}/macros.cargo -%{_fileattrsdir}/cargo.attr +%{_rpmmacrodir}/macros.rust-srpm -%files -n python3-rust2rpm +%files -n cargo-rpm-macros %license LICENSE -%doc NEWS -%{_bindir}/rust2rpm -%{_bindir}/cargo-inspector -%{python3_sitelib}/rust2rpm-*.egg-info/ -%{python3_sitelib}/rust2rpm/ +%{_rpmmacrodir}/macros.cargo +%{_fileattrsdir}/cargo.attr %changelog %autochangelog diff --git a/sources b/sources index a2f5243..a4e9a5b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-v21.tar.gz) = 50864eea0025d1c6d681e5e618f7e7dfe3aab576ec722134e07089459d73cb954e5886409578de7dd7d1a05dfbe7cc034af5f2b4d4e27db3310b0e0a2170869e +SHA512 (rust-packaging-24.tar.gz) = bd40ccc62786c7aa1799755ee3d4801d8df53b54edb625d4fe2f3e7fb932171b871355146f9cb226398aabdba733cf8c9e9a9d7f2f2891f623f5bc9bd703e5de From 7adae7548de4b4e9577e9f9dfcb40b567b4af134 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Wed, 22 Feb 2023 17:47:31 -0600 Subject: [PATCH 88/96] rust-srpm-macros -> rust-srpm-macros-epel on epel9 --- rust-packaging.spec | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 4fac3ac..23a73a0 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -12,10 +12,10 @@ BuildArch: noarch %description %{summary}. -%package -n rust-srpm-macros +%package -n rust-srpm-macros-epel Summary: RPM macros for building Rust projects -%description -n rust-srpm-macros +%description -n rust-srpm-macros-epel RPM macros for building source packages for Rust projects. %package -n cargo-rpm-macros @@ -43,13 +43,19 @@ RPM macros for building projects with cargo. %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 -install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.rust-srpm + +# 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 +%files -n rust-srpm-macros-epel %license LICENSE %{_rpmmacrodir}/macros.rust -%{_rpmmacrodir}/macros.rust-srpm +%dnl %{_rpmmacrodir}/macros.rust-srpm %files -n cargo-rpm-macros %license LICENSE From 2839a4e81586c8d862bb3fa2dcc1d7307889d3b2 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Sun, 26 Feb 2023 10:57:08 -0600 Subject: [PATCH 89/96] Fix rust-srpm-macros-epel's Requires --- rust-packaging.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-packaging.spec b/rust-packaging.spec index 23a73a0..9c288a1 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -14,6 +14,8 @@ BuildArch: noarch %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. @@ -29,7 +31,7 @@ Requires: cargo Requires: cargo2rpm >= 0.1.0 Requires: gawk -Requires: rust-srpm-macros = %{version}-%{release} +Requires: rust-srpm-macros-epel = %{version}-%{release} %description -n cargo-rpm-macros RPM macros for building projects with cargo. From a15f0b73c01205c44d22963889b50115a1395de2 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 19 May 2023 19:38:41 +0200 Subject: [PATCH 90/96] Include upstream patches with minor bug fixes and improvements --- 3df6ad1.patch | 33 +++++++++++++++++++++++++++++++++ 8690145.patch | 34 ++++++++++++++++++++++++++++++++++ b9d6410.patch | 26 ++++++++++++++++++++++++++ rust-packaging.spec | 5 +++++ 4 files changed, 98 insertions(+) create mode 100644 3df6ad1.patch create mode 100644 8690145.patch create mode 100644 b9d6410.patch diff --git a/3df6ad1.patch b/3df6ad1.patch new file mode 100644 index 0000000..20bdca8 --- /dev/null +++ b/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/8690145.patch b/8690145.patch new file mode 100644 index 0000000..debcf7f --- /dev/null +++ b/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/b9d6410.patch b/b9d6410.patch new file mode 100644 index 0000000..fe591f4 --- /dev/null +++ b/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/rust-packaging.spec b/rust-packaging.spec index 9c288a1..01ecfe9 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -7,6 +7,11 @@ 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 From 9cb130a2cf301fa2e013f1da9de8ef601c03f660 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 17 Aug 2023 13:35:39 -0400 Subject: [PATCH 91/96] Correct cargo and cargo2rpm paths https://pagure.io/fedora-rust/rust-packaging/pull-request/6 --- 0ff9bb8.patch | 49 +++++++++++++++++++++++++++++++++++++++++++++ rust-packaging.spec | 1 + 2 files changed, 50 insertions(+) create mode 100644 0ff9bb8.patch diff --git a/0ff9bb8.patch b/0ff9bb8.patch new file mode 100644 index 0000000..daf846c --- /dev/null +++ b/0ff9bb8.patch @@ -0,0 +1,49 @@ +From 0ff9bb855cf6be46f26801d00dd8c057a11eecd9 Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Thu, 17 Aug 2023 13:33:17 -0400 +Subject: [PATCH] Correct %__cargo and %__cargo_to_rpm paths + +%{_bindir} should not be used like this in specfiles or macros. It +breaks flatpak builds. + +Relates: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_file_and_directory_dependencies +--- + fileattrs/cargo.attr | 4 ++-- + macros.d/macros.cargo | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/fileattrs/cargo.attr b/fileattrs/cargo.attr +index b97383d..0dabe9b 100644 +--- a/fileattrs/cargo.attr ++++ b/fileattrs/cargo.attr +@@ -1,3 +1,3 @@ +-%__cargo_provides %{_bindir}/cargo2rpm provides --subpackage --feature=%{name} +-%__cargo_requires %{_bindir}/cargo2rpm requires --subpackage --feature=%{name} ++%__cargo_provides /usr/bin/cargo2rpm provides --subpackage --feature=%{name} ++%__cargo_requires /usr/bin/cargo2rpm requires --subpackage --feature=%{name} + %__cargo_path ^%{cargo_registry}/[^/]+/Cargo\\.toml$ +diff --git a/macros.d/macros.cargo b/macros.d/macros.cargo +index 672ae06..147a7ca 100644 +--- a/macros.d/macros.cargo ++++ b/macros.d/macros.cargo +@@ -6,7 +6,7 @@ + # features that have not been stabilized yet, i.e. the + # "-Z avoid-dev-deps" flag which is passed to cargo by the cargo_build, + # cargo_install, and cargo_test macros. +-%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' %{_bindir}/cargo ++%__cargo /usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo + + # __cargo_common_opts: common command line flags for cargo + # +@@ -22,7 +22,7 @@ + %__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps + + # __cargo_to_rpm: path to the default cargo2rpm executable +-%__cargo_to_rpm %{_bindir}/cargo2rpm ++%__cargo_to_rpm /usr/bin/cargo2rpm + + # cargo_registry: path to the root of the directory-based "local cargo registry" + # with replaces the "crates.io" source +-- +2.41.0 + diff --git a/rust-packaging.spec b/rust-packaging.spec index 01ecfe9..f52df55 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -11,6 +11,7 @@ Source: %{url}/archive/%{version}/rust-packaging-%{version}.tar.gz 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 +Patch: https://pagure.io/fedora-rust/rust-packaging/c/0ff9bb8.patch BuildArch: noarch From 240e6fe3e496745df4fa667ee750d7a749612f27 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 17 Aug 2023 17:55:55 -0400 Subject: [PATCH 92/96] Correct cargo_registry path https://pagure.io/fedora-rust/rust-packaging/pull-request/7 --- 801dd51.patch | 29 +++++++++++++++++++++++++++++ rust-packaging.spec | 1 + 2 files changed, 30 insertions(+) create mode 100644 801dd51.patch diff --git a/801dd51.patch b/801dd51.patch new file mode 100644 index 0000000..dd06257 --- /dev/null +++ b/801dd51.patch @@ -0,0 +1,29 @@ +From 801dd51f84ec5979c540dc2cca16edd088f72d7c Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Thu, 17 Aug 2023 17:28:34 -0400 +Subject: [PATCH] Correct %cargo_registry path + +%{_datadir} should not be used like this in specfiles or macros. It +breaks flatpak builds. + +Relates: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_file_and_directory_dependencies +--- + macros.d/macros.cargo | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/macros.d/macros.cargo b/macros.d/macros.cargo +index 147a7ca..3d03e2e 100644 +--- a/macros.d/macros.cargo ++++ b/macros.d/macros.cargo +@@ -26,7 +26,7 @@ + + # cargo_registry: path to the root of the directory-based "local cargo registry" + # with replaces the "crates.io" source +-%cargo_registry %{_datadir}/cargo/registry ++%cargo_registry /usr/share/cargo/registry + + # crate_instdir: path to the directory where library crates are installed, + # with version_no_tilde being the upstream version of the crate +-- +2.41.0 + diff --git a/rust-packaging.spec b/rust-packaging.spec index f52df55..3c7e43d 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -12,6 +12,7 @@ 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 Patch: https://pagure.io/fedora-rust/rust-packaging/c/0ff9bb8.patch +Patch: https://pagure.io/fedora-rust/rust-packaging/c/801dd51.patch BuildArch: noarch From 4d51f860d18b4381c4f951a086bfcf1092e764cd Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 28 Sep 2023 18:42:36 +0200 Subject: [PATCH 93/96] Update to version 25.0 --- .gitignore | 1 + 0ff9bb8.patch | 49 --------------------------------------------- 3df6ad1.patch | 33 ------------------------------ 801dd51.patch | 29 --------------------------- 8690145.patch | 34 ------------------------------- b9d6410.patch | 26 ------------------------ rust-packaging.spec | 27 ++++++++++++++++--------- sources | 2 +- 8 files changed, 20 insertions(+), 181 deletions(-) delete mode 100644 0ff9bb8.patch delete mode 100644 3df6ad1.patch delete mode 100644 801dd51.patch delete mode 100644 8690145.patch delete mode 100644 b9d6410.patch diff --git a/.gitignore b/.gitignore index 151a9ce..da39740 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ /rust2rpm-v22.tar.gz /rust2rpm-v23.tar.gz /rust-packaging-24.tar.gz +/rust-packaging-25.0.tar.gz diff --git a/0ff9bb8.patch b/0ff9bb8.patch deleted file mode 100644 index daf846c..0000000 --- a/0ff9bb8.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0ff9bb855cf6be46f26801d00dd8c057a11eecd9 Mon Sep 17 00:00:00 2001 -From: Yaakov Selkowitz -Date: Thu, 17 Aug 2023 13:33:17 -0400 -Subject: [PATCH] Correct %__cargo and %__cargo_to_rpm paths - -%{_bindir} should not be used like this in specfiles or macros. It -breaks flatpak builds. - -Relates: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_file_and_directory_dependencies ---- - fileattrs/cargo.attr | 4 ++-- - macros.d/macros.cargo | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/fileattrs/cargo.attr b/fileattrs/cargo.attr -index b97383d..0dabe9b 100644 ---- a/fileattrs/cargo.attr -+++ b/fileattrs/cargo.attr -@@ -1,3 +1,3 @@ --%__cargo_provides %{_bindir}/cargo2rpm provides --subpackage --feature=%{name} --%__cargo_requires %{_bindir}/cargo2rpm requires --subpackage --feature=%{name} -+%__cargo_provides /usr/bin/cargo2rpm provides --subpackage --feature=%{name} -+%__cargo_requires /usr/bin/cargo2rpm requires --subpackage --feature=%{name} - %__cargo_path ^%{cargo_registry}/[^/]+/Cargo\\.toml$ -diff --git a/macros.d/macros.cargo b/macros.d/macros.cargo -index 672ae06..147a7ca 100644 ---- a/macros.d/macros.cargo -+++ b/macros.d/macros.cargo -@@ -6,7 +6,7 @@ - # features that have not been stabilized yet, i.e. the - # "-Z avoid-dev-deps" flag which is passed to cargo by the cargo_build, - # cargo_install, and cargo_test macros. --%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' %{_bindir}/cargo -+%__cargo /usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo - - # __cargo_common_opts: common command line flags for cargo - # -@@ -22,7 +22,7 @@ - %__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps - - # __cargo_to_rpm: path to the default cargo2rpm executable --%__cargo_to_rpm %{_bindir}/cargo2rpm -+%__cargo_to_rpm /usr/bin/cargo2rpm - - # cargo_registry: path to the root of the directory-based "local cargo registry" - # with replaces the "crates.io" source --- -2.41.0 - diff --git a/3df6ad1.patch b/3df6ad1.patch deleted file mode 100644 index 20bdca8..0000000 --- a/3df6ad1.patch +++ /dev/null @@ -1,33 +0,0 @@ -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/801dd51.patch b/801dd51.patch deleted file mode 100644 index dd06257..0000000 --- a/801dd51.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 801dd51f84ec5979c540dc2cca16edd088f72d7c Mon Sep 17 00:00:00 2001 -From: Yaakov Selkowitz -Date: Thu, 17 Aug 2023 17:28:34 -0400 -Subject: [PATCH] Correct %cargo_registry path - -%{_datadir} should not be used like this in specfiles or macros. It -breaks flatpak builds. - -Relates: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_file_and_directory_dependencies ---- - macros.d/macros.cargo | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/macros.d/macros.cargo b/macros.d/macros.cargo -index 147a7ca..3d03e2e 100644 ---- a/macros.d/macros.cargo -+++ b/macros.d/macros.cargo -@@ -26,7 +26,7 @@ - - # cargo_registry: path to the root of the directory-based "local cargo registry" - # with replaces the "crates.io" source --%cargo_registry %{_datadir}/cargo/registry -+%cargo_registry /usr/share/cargo/registry - - # crate_instdir: path to the directory where library crates are installed, - # with version_no_tilde being the upstream version of the crate --- -2.41.0 - diff --git a/8690145.patch b/8690145.patch deleted file mode 100644 index debcf7f..0000000 --- a/8690145.patch +++ /dev/null @@ -1,34 +0,0 @@ -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/b9d6410.patch b/b9d6410.patch deleted file mode 100644 index fe591f4..0000000 --- a/b9d6410.patch +++ /dev/null @@ -1,26 +0,0 @@ -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/rust-packaging.spec b/rust-packaging.spec index 3c7e43d..d13e8a5 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,5 +1,7 @@ +%bcond_without check + Name: rust-packaging -Version: 24 +Version: 25.0 Release: %autorelease Summary: RPM macros and generators for building Rust packages License: MIT @@ -7,15 +9,12 @@ 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 -Patch: https://pagure.io/fedora-rust/rust-packaging/c/0ff9bb8.patch -Patch: https://pagure.io/fedora-rust/rust-packaging/c/801dd51.patch - BuildArch: noarch +%if %{with check} +BuildRequires: python3-pytest +%endif + %description %{summary}. @@ -34,9 +33,11 @@ Summary: RPM macros for building projects with cargo Obsoletes: rust-packaging < 24 Provides: rust-packaging = %{version}-%{release} +Requires: cargo2rpm >= 0.1.8 + Requires: cargo -Requires: cargo2rpm >= 0.1.0 Requires: gawk +Requires: grep Requires: rust-srpm-macros-epel = %{version}-%{release} @@ -60,6 +61,13 @@ install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.rust %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 +install -D -p -m 0644 -t %{buildroot}/%{_fileattrsdir} fileattrs/cargo_vendor.attr + +%if %{with check} +%check +export MACRO_DIR=%{buildroot}%{_rpmmacrodir} +pytest -vv +%endif %files -n rust-srpm-macros-epel %license LICENSE @@ -70,6 +78,7 @@ install -D -p -m 0644 -t %{buildroot}/%{_fileattrsdir} fileattrs/cargo.attr %license LICENSE %{_rpmmacrodir}/macros.cargo %{_fileattrsdir}/cargo.attr +%{_fileattrsdir}/cargo_vendor.attr %changelog %autochangelog diff --git a/sources b/sources index a4e9a5b..a84750d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust-packaging-24.tar.gz) = bd40ccc62786c7aa1799755ee3d4801d8df53b54edb625d4fe2f3e7fb932171b871355146f9cb226398aabdba733cf8c9e9a9d7f2f2891f623f5bc9bd703e5de +SHA512 (rust-packaging-25.0.tar.gz) = 173907ddec802baa4f4336c1f75350bd55d971793531cc81492dba8eba758b9768cbce18fa802dbac5d8fda13344e05516909da83f9d30433200f6bbd9ccc938 From bee2c45f80a1de3adeb1e0e2fe3cff52daef5413 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Sat, 30 Sep 2023 01:06:02 +0200 Subject: [PATCH 94/96] Update to version 25.1; Fixes RHBZ#2241437 --- .gitignore | 1 + rust-packaging.spec | 2 +- sources | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index da39740..17e42ad 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ /rust2rpm-v23.tar.gz /rust-packaging-24.tar.gz /rust-packaging-25.0.tar.gz +/rust-packaging-25.1.tar.gz diff --git a/rust-packaging.spec b/rust-packaging.spec index d13e8a5..7463598 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,7 +1,7 @@ %bcond_without check Name: rust-packaging -Version: 25.0 +Version: 25.1 Release: %autorelease Summary: RPM macros and generators for building Rust packages License: MIT diff --git a/sources b/sources index a84750d..4fb117d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust-packaging-25.0.tar.gz) = 173907ddec802baa4f4336c1f75350bd55d971793531cc81492dba8eba758b9768cbce18fa802dbac5d8fda13344e05516909da83f9d30433200f6bbd9ccc938 +SHA512 (rust-packaging-25.1.tar.gz) = b8d07722d85955f2ecf7490d1e904d7bd111bebb66a6208f36e13f0af983b38b1efbaf5fa1105558ffafa53926a95efabd76eca0a7132e21f9966fc6eea86e18 From 61a7058f270df610b32afe9e77447d1a444a55a4 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Sat, 30 Sep 2023 12:15:30 +0200 Subject: [PATCH 95/96] Update to version 25.2 --- .gitignore | 1 + rust-packaging.spec | 7 ++++--- sources | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 17e42ad..c48a1fe 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ /rust-packaging-24.tar.gz /rust-packaging-25.0.tar.gz /rust-packaging-25.1.tar.gz +/rust-packaging-25.2.tar.gz diff --git a/rust-packaging.spec b/rust-packaging.spec index 7463598..c239e72 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,7 +1,7 @@ %bcond_without check Name: rust-packaging -Version: 25.1 +Version: 25.2 Release: %autorelease Summary: RPM macros and generators for building Rust packages License: MIT @@ -12,7 +12,7 @@ Source: %{url}/archive/%{version}/rust-packaging-%{version}.tar.gz BuildArch: noarch %if %{with check} -BuildRequires: python3-pytest +BuildRequires: python3.11-pytest %endif %description @@ -66,7 +66,8 @@ install -D -p -m 0644 -t %{buildroot}/%{_fileattrsdir} fileattrs/cargo_vendor.at %if %{with check} %check export MACRO_DIR=%{buildroot}%{_rpmmacrodir} -pytest -vv +# skip tests that fail due to whitespace differences in expected strings +pytest-3.11 -vv -k "not test_cargo_prep" %endif %files -n rust-srpm-macros-epel diff --git a/sources b/sources index 4fb117d..88ac844 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust-packaging-25.1.tar.gz) = b8d07722d85955f2ecf7490d1e904d7bd111bebb66a6208f36e13f0af983b38b1efbaf5fa1105558ffafa53926a95efabd76eca0a7132e21f9966fc6eea86e18 +SHA512 (rust-packaging-25.2.tar.gz) = a57908f0d0dc4294fd7bd693d97519a2ac6a6a98a0c37f0317635bfb20bf55fb70a5d850bc57d869e8f5dad88386840112f345bd40a599a9a4b53553832199ea From c4dbec1946b7222f337355c165450c4de8015f72 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Thu, 2 Nov 2023 13:34:24 +0300 Subject: [PATCH 96/96] Remove unnecessary files and fix spec-file --- changelog | 206 --------------------------------- rust-packaging.spec | 275 +++++++++++++++++++++++++++++++++++++++++++- sources | 1 - 3 files changed, 274 insertions(+), 208 deletions(-) delete mode 100644 changelog delete mode 100644 sources diff --git a/changelog b/changelog deleted file mode 100644 index 779a325..0000000 --- a/changelog +++ /dev/null @@ -1,206 +0,0 @@ -* 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 diff --git a/rust-packaging.spec b/rust-packaging.spec index c239e72..583b988 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -1,3 +1,13 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.3.5) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 1; + 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 + %bcond_without check Name: rust-packaging @@ -82,4 +92,267 @@ pytest-3.11 -vv -k "not test_cargo_prep" %{_fileattrsdir}/cargo_vendor.attr %changelog -%autochangelog +* Sat Sep 30 2023 Fabio Valentini - 25.2-1 +- Update to version 25.2 + +* Sat Sep 30 2023 Fabio Valentini - 25.1-1 +- Update to version 25.1; Fixes RHBZ#2241437 + +* Sat Sep 30 2023 Fabio Valentini - 25.0-1 +- Update to version 25.0 + +* Thu Aug 17 2023 Yaakov Selkowitz - 24-6 +- Correct cargo_registry path + +* Thu Aug 17 2023 Yaakov Selkowitz - 24-5 +- Correct cargo and cargo2rpm paths + +* 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 + diff --git a/sources b/sources deleted file mode 100644 index 88ac844..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -SHA512 (rust-packaging-25.2.tar.gz) = a57908f0d0dc4294fd7bd693d97519a2ac6a6a98a0c37f0317635bfb20bf55fb70a5d850bc57d869e8f5dad88386840112f345bd40a599a9a4b53553832199ea