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

Add post processing of RPM .spec file, and create a .src.rpm

parent e6c9c46a
Branches
Tags v0.3.2
No related merge requests found
...@@ -3,6 +3,16 @@ ...@@ -3,6 +3,16 @@
set -e set -e
set -x set -x
post_package() {
if [ -x post-package-$1-$2 ] ; then
$(realpath post-package-$1-$2) $3
elif [ -x post-package-$1 ] ; then
$(realpath post-package-$1) $3
elif [ -x post-package ] ; then
$(realpath post-package) $3
fi
}
CACHE=${HOME}/.cache/rust2rpm CACHE=${HOME}/.cache/rust2rpm
cargo package cargo package
mkdir -p ${CACHE} mkdir -p ${CACHE}
...@@ -16,6 +26,11 @@ for f in $(pwd)/target/package/*.crate ; do ...@@ -16,6 +26,11 @@ for f in $(pwd)/target/package/*.crate ; do
if [[ "$(basename "$f")" =~ (.*)-(.*).crate ]] ; then if [[ "$(basename "$f")" =~ (.*)-(.*).crate ]] ; then
NAME=${BASH_REMATCH[1]} NAME=${BASH_REMATCH[1]}
VERSION=${BASH_REMATCH[2]} VERSION=${BASH_REMATCH[2]}
rust2rpm --stdout ${NAME} ${VERSION} > rust-${NAME}-${VERSION}.spec SPEC=rust-${NAME}-${VERSION}.spec
rust2rpm -t plain --stdout ${NAME} ${VERSION} > ${SPEC}
sed -i -re 's/(BuildRequires:\s*)\((crate[\(][^\)]+\)).*/&\n\1\2/' \
${SPEC}
post_package ${NAME} ${VERSION} ${SPEC}
rpmbuild -bs ${SPEC} -D'_sourcedir target/package/.' -D'_srcrpmdir .'
fi fi
done done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment