You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#!/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
|