nnn/redhat/build-rpm
Michael Fenn 41235445e7 Add automatic RPM builds via travis (#18)
* Add automatic RPM builds via travis

* readline.h must be imported after stdio.h to pick up def of FILE
2017-04-28 12:44:27 +05:30

26 lines
653 B
Bash
Executable file

#!/bin/bash
set -xe
# create the rpm tree
rpmdir=$(mktemp -d)
install -d -m0755 $rpmdir/{BUILD,BUILDROOT,RPMS/$(uname -m),SOURCES,SPECS,SRPMS}
# copy the sources into place
cp redhat/nnn.spec $rpmdir/SPECS/nnn.spec
vers=$(git describe --always | sed 's/^v//' | tr - .)
sed -i -e "s/Version:\s*\(\S\+\)/Version: $vers/" $rpmdir/SPECS/nnn.spec
git archive --prefix=nnn-$vers/ --format=tar.gz -o $rpmdir/SOURCES/nnn-$vers.tar.gz HEAD
# do the build
( cd $rpmdir/SPECS && rpmbuild --define="%_topdir $rpmdir" -ba nnn.spec )
# retreive the artifacts
mkdir -p dist
cp $rpmdir/{SRPMS,RPMS/*}/*.rpm dist/
# clean up
rm -rf $rpmdir
# vim: et:ai:ts=4:sw=4