Skip to content
Snippets Groups Projects
Commit 172f2989 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Added some potentially useful hacks

parents
No related branches found
No related tags found
No related merge requests found
*~
#!/bin/bash
set -e
set -x
CACHE=${HOME}/.cache/rust2rpm
cargo package
mkdir -p ${CACHE}
for f in $(pwd)/target/package/*.crate ; do
echo $f
SYMLINK=${CACHE}/$(basename "$f")
if [ -L "${SYMLINK}" ] ; then
rm -f "${SYMLINK}"
fi
ln -s "$f" "${SYMLINK}"
if [[ "$(basename "$f")" =~ (.*)-(.*).crate ]] ; then
NAME=${BASH_REMATCH[1]}
VERSION=${BASH_REMATCH[2]}
rust2rpm --stdout ${NAME} ${VERSION} > rust-${NAME}-${VERSION}.spec
fi
done
#!/bin/bash
set -x
set -e
POSITIONAL=()
while [ $# -gt 0 ] ; do
case $1 in
-p|--patch)
PATCH="$1"
shift
;;
-t|--target)
TARGET="$1 $2"
shift
shift
;;
*) # unknown option
POSITIONAL+=("$1")
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
NAME=${POSITIONAL[0]}
rust2rpm ${PATCH} ${TARGET} ${POSITIONAL[@]}
DOWNLOAD=$(rpmspec -P rust-${NAME}.spec \
| grep Source0 \
| sed -re 's/^Source0:\s+(.*)$/\1/')
curl -L ${DOWNLOAD} > /usr/src/andersb/rpmbuild/SOURCES/$(basename ${DOWNLOAD})
if [ -n "${PATCH}" ] ; then
DIFF=$(basename ${DOWNLOAD} | sed -e 's/.crate//')-fix-metadata.diff
cp ${DIFF} /usr/src/andersb/rpmbuild/SOURCES/
fi
rpmbuild -bs rust-${NAME}.spec
rpmbuild -bb rust-${NAME}.spec
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment