forked from aufover/rpm-divine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo_SRPM.sh
executable file
·41 lines (30 loc) · 837 Bytes
/
do_SRPM.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
SPEC=${SPEC:-../divine.spec}
rm -rf srpm
mkdir srpm
cd srpm
# clone git repo
git clone https://gitlab.fi.muni.cz/paradise/mirror/divine.git
# make package
pushd divine > /dev/null
TAG=$(git describe | sed -e "s/-/_/g")
PREFIX="divine-$TAG/"
echo "Making divine-$TAG.tar.gz..."
git archive --prefix="$PREFIX" -o "../divine-$TAG.tar.gz" HEAD
popd > /dev/null
# update version
echo "Updating $SPEC..."
VERSION="Version: $TAG"
if ! grep -q "$VERSION" "$SPEC"; then
echo "New release found: $TAG"
sed -i "s/^Version:.*/$VERSION/" "$SPEC"
sed -i "s/^Release:.*/Release: 1%{?dist}/" "$SPEC"
fi
# copy patches
cp ../*.patch .
# copy tools
cp ../divine2csgrep.py ../csexec-divine.sh .
# build SRPM
echo Building SRPMs...
rpmbuild -bs "$SPEC" --define "_sourcedir $PWD" --define "_srcrpmdir $PWD"