-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
45 lines (37 loc) · 1.95 KB
/
build.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
42
43
44
45
#!/usr/bin/env bash
if [ -z "$@" ]; then
EL_RELEASES='7 9'
else
EL_RELEASES="$@"
fi
RELEASE=$(grep '^%define esgrep_release' ./rpmbuild/SPECS/esgrep.spec | awk '{print $NF}')
VERSION=$(grep '^%define esgrep_version' ./rpmbuild/SPECS/esgrep.spec | awk '{print $NF}')
echo "$(date) - creating tarball for esgrep-${VERSION}-${RELEASE}"
mkdir ./esgrep-${VERSION}-${RELEASE}/
cp -a ./src/esgrep ./config/esgrep.yml ./esgrep-${VERSION}-${RELEASE}/
tar czf ./esgrep-${VERSION}-${RELEASE}.tar.gz ./esgrep-${VERSION}-${RELEASE}/
echo "$(date) - cleaning up"
rm -r ./esgrep-${VERSION}-${RELEASE}/
mv ./esgrep-${VERSION}-${RELEASE}.tar.gz ./rpmbuild/SOURCES/
for el_release in $EL_RELEASES; do
mock_config=libmoose-el-${el_release}-x86_64
mock_dir=/var/lib/mock/${mock_config}/result
echo "$(date) - building el${el_release} SRPM"
sudo mock -v -r ./rpmbuild/mock/${mock_config}.cfg --buildsrpm --spec ./rpmbuild/SPECS/esgrep.spec --source ./rpmbuild/SOURCES/ &> ./rpmbuild/${mock_config}.srpm.log
if [ -f "${mock_dir}/esgrep-${VERSION}-${RELEASE}.el${el_release}.src.rpm" ]; then
echo "$(date) - copying el${el_release} SRPM"
cp -v ${mock_dir}/esgrep-${VERSION}-${RELEASE}.el${el_release}.src.rpm ./rpmbuild/SRPMS/
else
echo "$(date) - error building SRPM. Check logs in ${mock_dir}/ or ./rpmbuild/${mock_config}.srpm.log"
exit 1
fi
echo "$(date) - building el${el_release} RPM"
sudo mock -v -r ./rpmbuild/mock/${mock_config}.cfg ./rpmbuild/SRPMS/esgrep-${VERSION}-${RELEASE}.el${el_release}.src.rpm &> ./rpmbuild/${mock_config}.rpm.log
if [ -f "${mock_dir}/esgrep-${VERSION}-${RELEASE}.el${el_release}.noarch.rpm" ]; then
echo "$(date) - copying el${el_release} RPM"
cp -v ${mock_dir}/esgrep-${VERSION}-${RELEASE}.el${el_release}.noarch.rpm ./rpmbuild/RPMS/
else
echo "$(date) - error building RPM. Check logs in ${mock_dir}/ or ./rpmbuild/${mock_config}.rpm.log"
exit 1
fi
done