|
- #!/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
|