Adapt diff files generated by rust2rpm v22 to be more like those from v21

- change file names of written patches to match the old one
- don't leak the name of temporary directories into the diff
This commit is contained in:
Fabio Valentini 2022-07-24 10:07:33 +02:00
parent 1763c73dfa
commit a090caaa62
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF

View file

@ -246,10 +246,11 @@ def make_patches(args, toml):
toml_before = open(toml).readlines()
diff1 = diff2 = None
toml_path = f"{args.crate}-{args.version}/Cargo.toml"
# We always do the automatic part before asking the user for more edits.
if toml_after := args.patch_foreign and drop_foreign_dependencies(toml_before):
diff1 = make_diff(toml,
diff1 = make_diff(toml_path,
toml_before, mtime_before,
toml_after, mtime_before)
else:
@ -267,7 +268,7 @@ def make_patches(args, toml):
mtime_after2 = file_mtime(tmpfile.name)
toml_after2 = open(tmpfile.name).readlines()
diff2 = make_diff(toml,
diff2 = make_diff(toml_path,
toml_after, mtime_before,
toml_after2, mtime_after2)
@ -508,8 +509,8 @@ def main():
pkg_name = package_name_suffixed(metadata.name, args.suffix)
patch_files = (f"{metadata.name}-automatic.diff" if diffs[0] else None,
f"{metadata.name}-manual.diff" if diffs[1] else None)
patch_files = (f"{metadata.name}-fix-metadata-auto.diff" if diffs[0] else None,
f"{metadata.name}-fix-metadata.diff" if diffs[1] else None)
spec_file = pathlib.Path(f"{pkg_name}.spec")