From bfed6757669637c838ef92f2a74ff47ef9b92d2c Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Thu, 7 Mar 2024 16:55:08 -0500 Subject: [PATCH] stratisd.spec: only extract upstream crate Also update create_artifacts.py to emulate the GitHub source tarfile naming, to agree with the output from the create_release.py script. Signed-off-by: Bryan Gurney --- mockbuild_test/stratisd.spec | 21 ++++++--------------- release_management/create_artifacts.py | 4 +++- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/mockbuild_test/stratisd.spec b/mockbuild_test/stratisd.spec index f34f275..e2a4ff4 100644 --- a/mockbuild_test/stratisd.spec +++ b/mockbuild_test/stratisd.spec @@ -84,22 +84,13 @@ Requires: stratisd %{summary}. This package should not be used in production. %prep -# Rename SOURCE0's top-level directory because it starts with -# stratisd-stratisd-v. GitHub calculates the directory name from the repo name -# + the tag. Extract the upstream crate on top of the extracted GitHub release, -# overwriting changed files. The primary purpose of this step is to ensure that -# the Cargo.toml that is used in building is the one that is generated by +# Extract the upstream crate on top of the extracted GitHub release, overwriting +# changed files. The primary purpose of this step is to ensure that the +# Cargo.toml that is used in building is the one that is generated by # cargo-publish and cargo-package, not the file with path dependencies that -# GitHub packs up. Tar the overwritten files back up again into a tar file -# with the format and top-level directory that %setup expects cleaning up the -# previously extracted directory and its contents at the same time. Move the -# newly created tar file to the SOURCE0 location. -tar --transform="s/^stratisd\-stratisd-v/stratisd-/" --extract --file %{SOURCE0} -tar --directory=./stratisd-%{version} --strip-components=1 --extract --overwrite --file %{SOURCE2} -tar --create --gzip --file %{SOURCE0}.newfile ./stratisd-%{version} --remove-files -mv %{SOURCE0}.newfile %{SOURCE0} - -%setup -q +# GitHub packs up. +%autosetup -n stratisd-stratisd-v%{version} +tar --strip-components=1 --extract --overwrite --file %{SOURCE2} %if 0%{?rhel} %cargo_prep -V 1 diff --git a/release_management/create_artifacts.py b/release_management/create_artifacts.py index 171ca2e..3211469 100755 --- a/release_management/create_artifacts.py +++ b/release_management/create_artifacts.py @@ -124,7 +124,9 @@ def _stratisd_artifacts(namespace): filtered = namespace.vendor_method == "filtered" - source_tarfile_path = make_source_tarball("stratisd", release_version, output_path) + source_tarfile_path = make_source_tarball( + "stratisd", f"stratisd-v{release_version}", output_path + ) print(os.path.relpath(source_tarfile_path)) (vendor_tarfile_name, cargo_crate_path) = vendor(