RedPanda-CPP/packages/opensuse/buildrpm.sh

17 lines
679 B
Bash
Raw Normal View History

2023-10-24 12:20:32 +08:00
#!/bin/bash
set -xeuo pipefail
SPECDIR=$(rpm --eval %{_specdir})
SOURCEDIR=$(rpm --eval %{_sourcedir})
2023-10-24 12:20:32 +08:00
BUILDDIR=$(rpm --eval %{_builddir})/redpanda-cpp-git
[[ -d $BUILDDIR ]] && rm -rf $BUILDDIR
2023-10-24 12:20:32 +08:00
VERSION=$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g') || VERSION="0.0.r$(git rev-list HEAD --count).g$(git rev-parse --short HEAD)"
sed "s/__VERSION__/$VERSION/g" packages/opensuse/redpanda-cpp-git.spec.in >$SPECDIR/redpanda-cpp-git.spec
2023-10-24 12:20:32 +08:00
git archive --prefix="RedPanda-CPP/" -o "$SOURCEDIR/RedPanda-CPP.tar.gz" HEAD
2023-10-24 12:20:32 +08:00
sudo zypper in -y $(rpmspec -q --buildrequires $SPECDIR/redpanda-cpp-git.spec)
rpmbuild --nodebuginfo -bb $SPECDIR/redpanda-cpp-git.spec