Skip to content

Commit

Permalink
Merge pull request #510 from bgurney-rh/stratisd-autosetup-tar
Browse files Browse the repository at this point in the history
stratisd.spec: only extract upstream crate
  • Loading branch information
mulkieran authored Mar 11, 2024
2 parents d482454 + bfed675 commit 289d4c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
21 changes: 6 additions & 15 deletions mockbuild_test/stratisd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion release_management/create_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 289d4c4

Please sign in to comment.