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