commit 0fa0d6fe229dafd0e9363db581c8421d40b1d089 Author: tigro Date: Sun Jan 5 22:26:12 2025 +0300 import rust-blosc2-rs-0.3.1-1.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cd8e80 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/blosc2-rs-0.3.1+2.15.1-clean.crate diff --git a/.rust-blosc2-rs.metadata b/.rust-blosc2-rs.metadata new file mode 100644 index 0000000..e3fb7a7 --- /dev/null +++ b/.rust-blosc2-rs.metadata @@ -0,0 +1 @@ +df218234a07e9c931280759fa2dfd21aaf3d5d31 SOURCES/blosc2-rs-0.3.1+2.15.1-clean.crate diff --git a/SOURCES/blosc2-rs-fix-metadata-auto.diff b/SOURCES/blosc2-rs-fix-metadata-auto.diff new file mode 100644 index 0000000..3e2e24c --- /dev/null +++ b/SOURCES/blosc2-rs-fix-metadata-auto.diff @@ -0,0 +1,16 @@ +--- blosc2-rs-0.3.1+2.15.1/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ blosc2-rs-0.3.1+2.15.1/Cargo.toml 2024-10-03T13:47:03.804604+00:00 +@@ -12,7 +12,7 @@ + [package] + edition = "2021" + name = "blosc2-rs" +-version = "0.3.1+2.15.1" ++version = "0.3.1" + build = false + autobins = false + autoexamples = false +@@ -67,3 +67,4 @@ + shared = ["blosc2-sys/shared"] + static = ["blosc2-sys/static"] + use-system-blosc2 = ["blosc2-sys/use-system-blosc2"] ++ diff --git a/SOURCES/gen_clean_tarball.sh b/SOURCES/gen_clean_tarball.sh new file mode 100755 index 0000000..07e5c41 --- /dev/null +++ b/SOURCES/gen_clean_tarball.sh @@ -0,0 +1,59 @@ +#!/usr/bin/bash + +set -e -u + +CRATE="blosc2-rs" +NAME="rust-${CRATE}" + +# VERSION=$(rpmspec -q "$NAME.spec" --srpm --qf "%{version}") +VERSION="$( + grep -E '^%global upstream_version ' "${NAME}.spec" | awk '{print $3}' +)" +URL="https://crates.io/api/v1/crates/${CRATE}/${VERSION}/download" + +OUTDIR="${PWD}" +TMPDIR="$(mktemp -d)" +trap "rm -rf '${TMPDIR}'" INT TERM EXIT +ROOTDIR="${TMPDIR}/${CRATE}-${VERSION}" +mkdir "${ROOTDIR}" + +# download and extract published crate from crates.io +CRATEFILE="${CRATE}-${VERSION}.crate" +wget "${URL}" -O "${TMPDIR}/${CRATEFILE}" +tar -C "${TMPDIR}" -xzf "${CRATEFILE}" +rm "${TMPDIR}/${CRATEFILE}" + +pushd "${ROOTDIR}" + +# Exclude benchmarks and their data files from released crates (plus a few +# other files) +# +# https://github.com/milesgranger/blosc2-rs/pull/31 +# +# Removing the benchmark data is required due to complicated or unclear license +# terms. We remove other files to match the state of the crate after merging +# the PR. +rm -rv \ + .gitignore \ + .gitmodules \ + .github/ \ + benches/ \ + data/ \ + environment.yml + +# clean up cargo files +rm .cargo_vcs_info.json +mv Cargo.toml.orig Cargo.toml + +# Remove the path dependency on blosc2-sys – we otherwise cannot repackage the +# crate without a local copy. +tomcli set Cargo.toml del dependencies.blosc2-sys.path + +# repackage crate +cargo package + +# move clean crate +mv "target/package/${CRATEFILE}" \ + "${OUTDIR}/$(basename "${CRATEFILE}" .crate)-clean.crate" + +popd diff --git a/SPECS/rust-blosc2-rs.spec b/SPECS/rust-blosc2-rs.spec new file mode 100644 index 0000000..8c29490 --- /dev/null +++ b/SPECS/rust-blosc2-rs.spec @@ -0,0 +1,189 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.7.2) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 1; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +# Generated by rust2rpm 26 +%bcond_without check +%global debug_package %{nil} + +%global crate blosc2-rs +%global upstream_version 0.3.1+2.15.1 + +Name: rust-blosc2-rs +Version: 0.3.1 +Release: %autorelease +Summary: Bindings to C Blosc2 + +License: MIT +URL: https://crates.io/crates/blosc2-rs +Source: %{crate}-%{upstream_version}-clean.crate +# * script to create tarball with only permissible content: run "rust2rpm" and +# then "./gen_clean_tarball.sh" for new versions +# * Exclude benchmarks and their data files from released crates (plus a few +# other files): https://github.com/milesgranger/blosc2-rs/pull/31 +Source10: gen_clean_tarball.sh +# Automatically generated patch to strip dependencies and normalize metadata +Patch: blosc2-rs-fix-metadata-auto.diff + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: tomcli + +%global _description %{expand: +Bindings to C Blosc2.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/README.md +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+prefer-external-lz4-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+prefer-external-lz4-devel %{_description} + +This package contains library source intended for building other packages which +use the "prefer-external-lz4" feature of the "%{crate}" crate. + +%files -n %{name}+prefer-external-lz4-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+prefer-external-zlib-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+prefer-external-zlib-devel %{_description} + +This package contains library source intended for building other packages which +use the "prefer-external-zlib" feature of the "%{crate}" crate. + +%files -n %{name}+prefer-external-zlib-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+prefer-external-zstd-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+prefer-external-zstd-devel %{_description} + +This package contains library source intended for building other packages which +use the "prefer-external-zstd" feature of the "%{crate}" crate. + +%files -n %{name}+prefer-external-zstd-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+regenerate-bindings-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+regenerate-bindings-devel %{_description} + +This package contains library source intended for building other packages which +use the "regenerate-bindings" feature of the "%{crate}" crate. + +%files -n %{name}+regenerate-bindings-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+shared-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+shared-devel %{_description} + +This package contains library source intended for building other packages which +use the "shared" feature of the "%{crate}" crate. + +%files -n %{name}+shared-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+use-system-blosc2-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+use-system-blosc2-devel %{_description} + +This package contains library source intended for building other packages which +use the "use-system-blosc2" feature of the "%{crate}" crate. + +%files -n %{name}+use-system-blosc2-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{upstream_version} -p1 +%cargo_prep +# Do not depend on criterion; it is needed only for benchmarks. +tomcli set Cargo.toml del dev-dependencies.criterion + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%ifnarch s390x +# * Do not test that the blosc2-sys bidings were generated against the exact +# version of c-blosc2 that upstream expects; we always use the system blosc2, +# whatever that may be. +%cargo_test -- -- --exact --skip tests::test_get_version_string +%else +skip="${skip-} --skip tests::test_get_version_string" +# Even after serious effort by upstream (see +# https://github.com/milesgranger/blosc2-rs/issues/23), several tests still +# fail on s390x. This would seem to justify making this package ExcludeArch, +# but that would have a ripple effect on python-cramjam and a whole tree of +# packages that depend on it, and which probably do not even use its blosc2 +# support. We consider that outcome even worse than shipping broken blosc2 +# support on s390x. Note that the endianness issues are probably in the C +# blosc2 library (and that the blosc2 packages ignores any and all test +# failures on s390x), and see also: +# https://github.com/Blosc/c-blosc2/issues/467. +skip="${skip-} --skip schunk::Chunk::decompress" +skip="${skip-} --skip schunk::Chunk::repeatval" +skip="${skip-} --skip schunk::Chunk::uninit" +skip="${skip-} --skip schunk::Chunk::zeros" +%cargo_test -- -- ${skip-} +%endif +%endif + +%changelog +* Sun Jan 05 2025 Arkady L. Shane - 0.3.1-1 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Fri Oct 04 2024 Benjamin A. Beasley - 0.3.1-1 +- Initial package (close RHBZ#2312901) +## END: Generated by rpmautospec