Spec file for icingadb lacks buildrequires for golang compiler
robert-scheck opened this issue · 3 comments
Trying to rebuild an existing source RPM using mock --enable-network -r centos-stream+epel-9-x86_64 rebuild icingadb-1.0.0-1.fc36.icinga.src.rpm
leads to this:
$ mock --enable-network -r centos-stream+epel-9-x86_64 rebuild icingadb-1.0.0-1.fc36.icinga.src.rpm
[…]
Start: rpmbuild icingadb-1.0.0-1.fc36.icinga.src.rpm
warning: extra tokens at the end of %endif directive in line 19: %endif # suse
warning: extra tokens at the end of %else directive in line 40: %else # suse
warning: extra tokens at the end of %endif directive in line 42: %endif # suse
warning: extra tokens at the end of %endif directive in line 69: %endif # suse
warning: extra tokens at the end of %endif directive in line 77: %endif # suse
warning: extra tokens at the end of %else directive in line 82: %else # suse
warning: extra tokens at the end of %endif directive in line 84: %endif # suse
warning: extra tokens at the end of %else directive in line 89: %else # suse
warning: extra tokens at the end of %endif directive in line 91: %endif # suse
warning: extra tokens at the end of %else directive in line 96: %else # suse
warning: extra tokens at the end of %endif directive in line 98: %endif # suse
warning: extra tokens at the end of %endif directive in line 111: %endif # suse
Building target platforms: x86_64
Building for target x86_64
setting SOURCE_DATE_EPOCH=1656547200
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.0O237m
+ umask 022
+ cd /builddir/build/BUILD
+ cd /builddir/build/BUILD
+ rm -rf icingadb-1.0.0
+ /usr/bin/gzip -dc /builddir/build/SOURCES/v1.0.0.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd icingadb-1.0.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ go build -buildvcs=false -trimpath ./cmd/icingadb
/var/tmp/rpm-tmp.0O237m: line 41: go: command not found
error: Bad exit status from /var/tmp/rpm-tmp.0O237m (%prep)
RPM build errors:
extra tokens at the end of %endif directive in line 19: %endif # suse
extra tokens at the end of %else directive in line 40: %else # suse
extra tokens at the end of %endif directive in line 42: %endif # suse
extra tokens at the end of %endif directive in line 69: %endif # suse
extra tokens at the end of %endif directive in line 77: %endif # suse
extra tokens at the end of %else directive in line 82: %else # suse
extra tokens at the end of %endif directive in line 84: %endif # suse
extra tokens at the end of %else directive in line 89: %else # suse
extra tokens at the end of %endif directive in line 91: %endif # suse
extra tokens at the end of %else directive in line 96: %else # suse
extra tokens at the end of %endif directive in line 98: %endif # suse
extra tokens at the end of %endif directive in line 111: %endif # suse
Bad exit status from /var/tmp/rpm-tmp.0O237m (%prep)
Finish: rpmbuild icingadb-1.0.0-1.fc36.icinga.src.rpm
Finish: build phase for icingadb-1.0.0-1.fc36.icinga.src.rpm
ERROR: Exception(icingadb-1.0.0-1.fc36.icinga.src.rpm) Config(centos-stream+epel-9-x86_64) 0 minutes 17 seconds
INFO: Results and/or logs in: /var/lib/mock/centos-stream+epel-9-x86_64/result
ERROR: Command failed:
# /usr/bin/systemd-nspawn -q -M d688840b965b48fa9d98d764b788549e -D /var/lib/mock/centos-stream+epel-9-x86_64/root -a -u mockbuild --capability=cap_ipc_lock --bind=/tmp/mock-resolv.rpk4ibuw:/etc/resolv.conf --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=PS1=<mock-chroot> \s-\v\$ --setenv=LANG=C.UTF-8 --resolv-conf=off bash --login -c /usr/bin/rpmbuild -bb --noclean --target x86_64 --nodeps /builddir/build/SPECS/icingadb.spec
$
From my point of view, the following spec file change is required (to achieve a more clean SRPM package, more matching with the Fedora Packaging Guidelines):
--- icingadb.spec 2022-06-30 13:49:57.000000000 +0200
+++ icingadb.spec.rsc 2022-11-10 15:32:39.360791772 +0100
@@ -25,6 +25,9 @@
BuildRequires: gcc
BuildRequires: git
+%if "%{_vendor}" != "suse"
+BuildRequires: golang-bin
+%endif # suse
%{?systemd_requires}
BuildRequires: systemd
On non openSUSE/SLES-systems, such as CentOS Stream 9, the golang-bin package is not part of the default minimal build chroot environment.
Had the same issue on Debian. The reason for this was that Icinga required a newer version of Go than the Debian repositories provided. After installing a newer Go version, it worked. Details: #278 (comment)
Really? Because CentOS Stream 9 actually ships a Go version that is new enough and works fine.