rust2rpm.sh 493 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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