blob: bc05625a14bd9116063d13d12873e51956e9866f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/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
|