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

Sanitize package creation script

parent 172f2989
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
set -x
set -e set -e
TARGET="-t plain"
POSITIONAL=() POSITIONAL=()
while [ $# -gt 0 ] ; do while [ $# -gt 0 ] ; do
case $1 in case $1 in
...@@ -25,13 +26,15 @@ set -- "${POSITIONAL[@]}" # restore positional parameters ...@@ -25,13 +26,15 @@ set -- "${POSITIONAL[@]}" # restore positional parameters
NAME=${POSITIONAL[0]} NAME=${POSITIONAL[0]}
rust2rpm ${PATCH} ${TARGET} ${POSITIONAL[@]} rust2rpm ${PATCH} ${TARGET} ${POSITIONAL[@]}
sed -i -re 's/(BuildRequires:\s*)\((crate[\(][^\)]+\)).*/&\n\1\2/' \
rust-${NAME}.spec
DOWNLOAD=$(rpmspec -P rust-${NAME}.spec \ DOWNLOAD=$(rpmspec -P rust-${NAME}.spec \
| grep Source0 \ | grep Source0 \
| sed -re 's/^Source0:\s+(.*)$/\1/') | sed -re 's/^Source0:\s+(.*)$/\1/')
curl -L ${DOWNLOAD} > /usr/src/andersb/rpmbuild/SOURCES/$(basename ${DOWNLOAD}) curl -L ${DOWNLOAD} > ${HOME}/rpmbuild/SOURCES/$(basename ${DOWNLOAD})
if [ -n "${PATCH}" ] ; then if [ -n "${PATCH}" ] ; then
DIFF=$(basename ${DOWNLOAD} | sed -e 's/.crate//')-fix-metadata.diff DIFF=$(basename ${DOWNLOAD} | sed -e 's/.crate//')-fix-metadata.diff
cp ${DIFF} /usr/src/andersb/rpmbuild/SOURCES/ cp ${DIFF} ${HOME}/rpmbuild/SOURCES/
fi fi
rpmbuild -bs rust-${NAME}.spec
rpmbuild -bb rust-${NAME}.spec rpmbuild -bb rust-${NAME}.spec
rpmbuild -bs rust-${NAME}.spec
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment