Ensure rust2rpm reads crate metadata is read from the patched file

When the automatic patching step was implemented, the metadata started
being read from the original Cargo.toml file instead of from the one
with manually applied changes.
This commit is contained in:
Fabio Valentini 2022-07-24 12:52:50 +02:00
parent c4488a3fe8
commit f31fd721f5
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
13 changed files with 26 additions and 23 deletions

View file

@ -252,16 +252,19 @@ def make_patches(args, version, toml):
toml_after = toml_before
if args.patch:
with tempfile.NamedTemporaryFile("w+t", dir=os.path.dirname(toml),
prefix="Cargo.", suffix=".toml") as tmpfile:
tmpfile.writelines(toml_after)
tmpfile.flush()
# remove original Cargo.toml file
os.remove(toml)
# write auto-patched Cargo.toml to disk
with open(toml, "w") as file:
file.writelines(toml_after)
file.flush()
editor = util.detect_editor()
subprocess.check_call([editor, tmpfile.name])
subprocess.check_call([editor, toml])
mtime_after2 = file_mtime(tmpfile.name)
toml_after2 = open(tmpfile.name).readlines()
mtime_after2 = file_mtime(toml)
toml_after2 = open(toml).readlines()
diff2 = make_diff(toml_path,
toml_after, mtime_before,

View file

@ -14,7 +14,7 @@ URL: https://crates.io/crates/cxx-build-1.0.71
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: cxx-build-1.0.71-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: cxx-build-1.0.71-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -16,7 +16,7 @@ URL: https://crates.io/crates/cxx-build-1.0.71
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: cxx-build-1.0.71-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: cxx-build-1.0.71-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -32,7 +32,7 @@ URL: https://crates.io/crates/cxx-build-1.0.71
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: cxx-build-1.0.71-patch1.diff
# PATCH-FIX-OPENSUSE cxx-build-1.0.71-patch2.diff — Maintainer patch to adjust dependencies
# PATCH-FIX-OPENSUSE cxx-build-1.0.71-patch2.diff — Manually created patch for downstream crate metadata changes
Patch: cxx-build-1.0.71-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -14,7 +14,7 @@ URL: https://crates.io/crates/cxx-build-1.0.71
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: cxx-build-1.0.71-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: cxx-build-1.0.71-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -14,7 +14,7 @@ URL: https://crates.io/crates/nix-0.24.1
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: nix-0.24.1-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: nix-0.24.1-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -15,7 +15,7 @@ URL: https://crates.io/crates/nix-0.24.1
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: nix-0.24.1-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: nix-0.24.1-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -32,7 +32,7 @@ URL: https://crates.io/crates/nix-0.24.1
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: nix-0.24.1-patch1.diff
# PATCH-FIX-OPENSUSE nix-0.24.1-patch2.diff — Maintainer patch to adjust dependencies
# PATCH-FIX-OPENSUSE nix-0.24.1-patch2.diff — Manually created patch for downstream crate metadata changes
Patch: nix-0.24.1-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -14,7 +14,7 @@ URL: https://crates.io/crates/nix-0.24.1
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: nix-0.24.1-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: nix-0.24.1-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -14,7 +14,7 @@ URL: https://crates.io/crates/tokio-1.19.2
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: tokio-1.19.2-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: tokio-1.19.2-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -15,7 +15,7 @@ URL: https://crates.io/crates/tokio-1.19.2
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: tokio-1.19.2-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: tokio-1.19.2-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -32,7 +32,7 @@ URL: https://crates.io/crates/tokio-1.19.2
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: tokio-1.19.2-patch1.diff
# PATCH-FIX-OPENSUSE tokio-1.19.2-patch2.diff — Maintainer patch to adjust dependencies
# PATCH-FIX-OPENSUSE tokio-1.19.2-patch2.diff — Manually created patch for downstream crate metadata changes
Patch: tokio-1.19.2-patch2.diff
ExclusiveArch: %{rust_arches}

View file

@ -14,7 +14,7 @@ URL: https://crates.io/crates/tokio-1.19.2
Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies
Patch: tokio-1.19.2-patch1.diff
# Maintainer patch to adjust dependencies
# Manually created patch for downstream crate metadata changes
Patch: tokio-1.19.2-patch2.diff
ExclusiveArch: %{rust_arches}