2023-10-24 12:20:32 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -xeuo pipefail
|
|
|
|
|
|
|
|
SPECDIR=$(rpm --eval %{_specdir})
|
2023-11-19 08:48:58 +08:00
|
|
|
SOURCEDIR=$(rpm --eval %{_sourcedir})
|
2023-10-24 12:20:32 +08:00
|
|
|
BUILDDIR=$(rpm --eval %{_builddir})/redpanda-cpp-git
|
2023-11-19 08:48:58 +08:00
|
|
|
[[ -d $BUILDDIR ]] && rm -rf $BUILDDIR
|
2023-10-24 12:20:32 +08:00
|
|
|
|
2023-11-19 08:48:58 +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/fedora/redpanda-cpp-git.spec.in >$SPECDIR/redpanda-cpp-git.spec
|
2023-10-24 12:20:32 +08:00
|
|
|
|
2023-11-19 08:48:58 +08:00
|
|
|
git archive --prefix="RedPanda-CPP/" -o "$SOURCEDIR/RedPanda-CPP.tar.gz" HEAD
|
2023-10-24 12:20:32 +08:00
|
|
|
|
2023-11-19 08:48:58 +08:00
|
|
|
sudo dnf builddep -y $SPECDIR/redpanda-cpp-git.spec
|
|
|
|
rpmbuild --nodebuginfo -bb $SPECDIR/redpanda-cpp-git.spec
|