2017-04-28 19:29:25 +03:00
#!/usr/bin/bash
2021-02-03 21:11:41 +03:00
# OpenShift Prow jobs don't set $HOME, but we need
# one for cargo right now.
2021-02-03 22:49:57 +03:00
if test -z " $HOME " || test ! -w " $HOME " ; then
2021-02-03 21:11:41 +03:00
export HOME = $( mktemp -d -t --suffix .prowhome)
fi
2021-02-03 23:54:24 +03:00
# In some cases we install tools via cargo, ensure that's in PATH
export PATH = " $HOME /.cargo/bin: $PATH "
2021-02-03 21:11:41 +03:00
2017-09-06 20:53:46 +03:00
pkg_upgrade( ) {
2019-09-06 22:20:48 +03:00
echo " Running dnf -y distro-sync... $( date) "
2021-02-16 18:06:33 +03:00
time dnf -y distro-sync
2019-09-06 22:20:48 +03:00
echo " Done dnf -y distro-sync! $( date) "
2017-09-06 20:53:46 +03:00
}
2017-04-28 19:29:25 +03:00
make( ) {
2021-02-16 18:06:33 +03:00
time /usr/bin/make -j ${ MAKE_JOBS :- $( getconf _NPROCESSORS_ONLN) } " $@ "
2017-04-28 19:29:25 +03:00
}
build( ) {
env NOCONFIGURE = 1 ./autogen.sh
2021-02-16 18:06:33 +03:00
time ./configure --prefix= /usr --libdir= /usr/lib64 --sysconfdir= /etc " $@ "
time make V = 1
2017-04-28 19:29:25 +03:00
}
2017-09-19 17:40:35 +03:00
pkg_install( ) {
2019-09-06 22:20:48 +03:00
echo " Running dnf -y install... $( date) "
2021-02-16 18:06:33 +03:00
time dnf -y install " $@ "
2019-09-06 22:20:48 +03:00
echo " Done running dnf -y install! $( date) "
2017-09-19 17:40:35 +03:00
}
2017-07-17 20:40:25 +03:00
2017-09-19 17:40:35 +03:00
pkg_builddep( ) {
# This is sadly the only case where it's a different command
if test -x /usr/bin/dnf; then
2021-02-16 18:06:33 +03:00
time dnf builddep -y " $@ "
2017-07-17 20:40:25 +03:00
else
2021-02-16 18:06:33 +03:00
time yum-builddep -y " $@ "
2017-07-17 20:40:25 +03:00
fi
2017-09-19 17:40:35 +03:00
}
2017-04-28 19:29:25 +03:00
2017-09-19 17:40:35 +03:00
pkg_install_builddeps( ) {
2019-09-06 22:20:48 +03:00
pkg_install dnf-plugins-core 'dnf-command(builddep)'
# Base buildroot (but exclude fedora-release, conflicts with -container:
# https://bugzilla.redhat.com/show_bug.cgi?id=1649921)
pkg_install @buildsys-build --excludepkg fedora-release
2017-04-28 19:29:25 +03:00
# builddeps+runtime deps
2020-02-21 23:30:32 +03:00
if [ $# -ne 0 ] ; then
pkg_builddep " $@ "
pkg_install " $@ "
2021-02-16 18:06:33 +03:00
time rpm -e " $@ "
2020-02-21 23:30:32 +03:00
fi
2017-04-28 19:29:25 +03:00
}