/
build.sh
27 lines (23 loc) · 1.08 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
#!/bin/bash
# disable proxy
unset http_proxy
unset no_proxy
unset https_proxy
# install rpm devtools
cd /home
swupd update --quiet
swupd bundle-add curl dnf mixer --quiet
# manage dependencies
echo -e "[main]\nmax_parallel_downloads=20\nretries=30\nfastestmirror=True" >> /etc/dnf/dnf.conf
shopt -s expand_aliases && alias dnf='dnf -q -y --releasever=latest --disableplugin=changelog,needs_restarting'
createrepo_c -q /home/artifact/
dnf config-manager --add-repo https://cdn.download.clearlinux.org/current/x86_64/os --add-repo https://cdn-alt.download.clearlinux.org/current/x86_64/os --add-repo https://download.clearlinux.org/current/x86_64/os --add-repo file:///home/artifact
dnf groupinstall build srpm-build
dnf builddep *.spec || { echo "Failed to handle build dependencies"; exit 1; }
# building the package
echo 'exit 0' > /usr/lib/rpm/clr/brp-create-abi
rpmbuild --quiet -bb *.spec --define "_topdir $PWD" \
--define "_sourcedir $PWD" --undefine=_disable_source_fetch \
--define "abi_package %{nil}" || { echo "Build failed"; exit 1; }
# post cleanup
mv RPMS/*/*.rpm RPMS/