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.
rust-fiat-crypto/gen_clean_tarball.sh

44 lines
1.0 KiB

#!/usr/bin/bash
set -e
CRATE="fiat-crypto"
NAME="rust-${CRATE}"
VERSION=$(rpmspec -q $NAME.spec --srpm --qf "%{version}")
URL="https://crates.io/api/v1/crates/${CRATE}/${VERSION}/download"
ROOTDIR="${CRATE}-${VERSION}"
# download and extract published crate from crates.io
wget $URL -O ${ROOTDIR}.crate
tar -xzf ${ROOTDIR}.crate
rm ${ROOTDIR}.crate
pushd ${ROOTDIR}
# remove code related to the p434 curve which is not permitted in Fedora:
# https://lists.fedoraproject.org/archives/list/legal@lists.fedoraproject.org/thread/FBZU2X7ZKTK2BVZKBHFUCI44SMY4UQCE/
rm src/p434_64.rs
# clean up cargo files
rm .cargo_vcs_info.json
mv Cargo.toml.orig Cargo.toml
# initialize git repo and remove references to code related to the p434 curve
git init
git add .
git apply ../0001-remove-references-to-code-related-to-the-p434-curve.patch
git commit -a -m "import"
# repackage crate
cargo package
# move clean crate
mv target/package/${ROOTDIR}.crate ../${ROOTDIR}-clean.crate
popd
# remove temporary directory
rm -rf ${ROOTDIR}