From 60f3d8f016932795e43c88d70d9bb7d733da9a92 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mar 10 2019 09:16:51 +0000 Subject: Escape `\n` properly in macro file Signed-off-by: Igor Gnatenko --- 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-Do-not-pull-optional-dependencies.patch b/0018-Do-not-pull-optional-dependencies.patch deleted file mode 100644 index 68f2a8c..0000000 --- a/0018-Do-not-pull-optional-dependencies.patch +++ /dev/null @@ -1,66 +0,0 @@ -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/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/0019-Do-not-pull-optional-dependencies.patch b/0019-Do-not-pull-optional-dependencies.patch new file mode 100644 index 0000000..363fdc4 --- /dev/null +++ b/0019-Do-not-pull-optional-dependencies.patch @@ -0,0 +1,66 @@ +From ccc7ed42c168675efc4b9719dad12800b92450d5 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 +++++++++++-- + rust2rpm/templates/main.spec | 5 ----- + 2 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/data/macros.cargo b/data/macros.cargo +index 96dc354..4e8f0c9 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 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