Skip to content

Commit e2898db

Browse files
authored
Merge pull request #511 from mulkieran/issue_project_694
No longer unpack crate on top of GitHub release
2 parents 3caee8a + 4d275b3 commit e2898db

4 files changed

Lines changed: 8 additions & 38 deletions

File tree

mockbuild_test/stratisd.spec

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ License: MPL-2.0
1212
URL: https://github.com/stratis-storage/stratisd
1313
Source0: %{url}/archive/stratisd-v%{version}/%{name}-%{version}.tar.gz
1414
Source1: %{url}/releases/download/stratisd-v%{version}/%{name}-%{version}-vendor.tar.gz
15-
Source2: %{crates_source}
1615

1716

1817
ExclusiveArch: %{rust_arches}
@@ -84,13 +83,7 @@ Requires: stratisd
8483
%{summary}. This package should not be used in production.
8584

8685
%prep
87-
# Extract the upstream crate on top of the extracted GitHub release, overwriting
88-
# changed files. The primary purpose of this step is to ensure that the
89-
# Cargo.toml that is used in building is the one that is generated by
90-
# cargo-publish and cargo-package, not the file with path dependencies that
91-
# GitHub packs up.
9286
%autosetup -n stratisd-stratisd-v%{version}
93-
tar --strip-components=1 --extract --overwrite --file %{SOURCE2}
9487

9588
%if 0%{?rhel}
9689
%cargo_prep -V 1

release_management/_utils.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -276,35 +276,18 @@ def vendor(manifest_abs_path, release_version, *, filterer=False):
276276
:param str manifest_abs_path: manifest path (absolute)
277277
:param ReleaseVersion release_version: the release version
278278
:param bool filterer: filter dependencies in vendor tarfile
279-
:return: name of vendored tarfile and path of crate relative to manifest
280-
:rtype: str * str
279+
:return: name of vendored tarfile
280+
:rtype: str
281281
"""
282282

283283
vendor_dir = "vendor"
284284

285-
subprocess.run(
286-
["cargo", "package", "--no-verify", f"--manifest-path={manifest_abs_path}"],
287-
check=True,
288-
)
289-
290-
stratis_package_name = f"stratisd-{release_version.base_only()}"
291-
292-
crate_path = os.path.join("target", "package", f"{stratis_package_name}.crate")
293-
294-
subprocess.run(["tar", "--extract", f"--file={crate_path}"], check=True)
295-
296-
package_manifest = os.path.join(
297-
os.path.dirname(manifest_abs_path),
298-
stratis_package_name,
299-
"Cargo.toml",
300-
)
301-
302285
if filterer:
303286
subprocess.run(
304287
[
305288
"cargo",
306289
"vendor-filterer",
307-
f"--manifest-path={package_manifest}",
290+
f"--manifest-path={manifest_abs_path}",
308291
vendor_dir,
309292
],
310293
check=True,
@@ -316,7 +299,7 @@ def vendor(manifest_abs_path, release_version, *, filterer=False):
316299
"cargo",
317300
"vendor",
318301
"--quiet",
319-
f"--manifest-path={package_manifest}",
302+
f"--manifest-path={manifest_abs_path}",
320303
vendor_dir,
321304
],
322305
check=True,
@@ -339,7 +322,7 @@ def vendor(manifest_abs_path, release_version, *, filterer=False):
339322
check=True,
340323
)
341324

342-
return (vendor_tarfile_name, crate_path)
325+
return vendor_tarfile_name
343326

344327

345328
def make_source_tarball(package_name, release_version, output_dir):

release_management/create_artifacts.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,12 @@ def _stratisd_artifacts(namespace):
129129
)
130130
print(os.path.relpath(source_tarfile_path))
131131

132-
(vendor_tarfile_name, cargo_crate_path) = vendor(
132+
vendor_tarfile_name = vendor(
133133
manifest_abs_path,
134134
release_version,
135135
filterer=filtered,
136136
)
137137

138-
crate_path = os.path.join(
139-
output_path, f"stratisd-{release_version.to_crate_str()}.crate"
140-
)
141-
142-
os.rename(cargo_crate_path, crate_path)
143-
144138
vendor_tarfile_path = os.path.join(output_path, vendor_tarfile_name)
145139

146140
os.rename(vendor_tarfile_name, vendor_tarfile_path)
@@ -161,7 +155,7 @@ def insert_bundled_provides(spec):
161155
release_version=release_version,
162156
sources=[
163157
os.path.basename(path)
164-
for path in [source_tarfile_path, vendor_tarfile_path, crate_path]
158+
for path in [source_tarfile_path, vendor_tarfile_path]
165159
],
166160
arbitrary=insert_bundled_provides,
167161
)

release_management/create_release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def tag_rust_library(namespace, name):
203203
additional_assets = []
204204
if not namespace.no_vendor:
205205
filtered = namespace.vendor_method == "filtered"
206-
(vendor_tarfile_name, _) = vendor(
206+
vendor_tarfile_name = vendor(
207207
manifest_abs_path,
208208
ReleaseVersion(release_version),
209209
filterer=filtered,

0 commit comments

Comments
 (0)