diff --git a/fix-x86-failed-offline.patch b/fix-x86-failed-offline.patch new file mode 100644 index 0000000000000000000000000000000000000000..7184aad01eb1a5b2c745405eb88ca75fa8b11dac --- /dev/null +++ b/fix-x86-failed-offline.patch @@ -0,0 +1,75 @@ +diff -uNr zabbix-5.2.6/src/go/go.mod zabbix-5.2.6-new/src/go/go.mod +--- zabbix-5.2.6/src/go/go.mod 2021-03-29 17:21:28.000000000 +0800 ++++ zabbix-5.2.6-new/src/go/go.mod 2021-10-29 15:39:27.215189410 +0800 +@@ -20,7 +20,7 @@ + github.com/memcachier/mc/v3 v3.0.1 + github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce + github.com/omeid/go-yarn v0.0.1 +- github.com/pkg/errors v0.9.1 ++ github.com/pkg/errors v0.9.1 // indirect + golang.org/x/sys v0.0.0-20200428200454-593003d681fa + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect +diff -uNr zabbix-5.2.6/src/go/Makefile zabbix-5.2.6-new/src/go/Makefile +--- zabbix-5.2.6/src/go/Makefile 2021-03-29 17:21:41.000000000 +0800 ++++ zabbix-5.2.6-new/src/go/Makefile 2021-10-29 15:39:27.248189410 +0800 +@@ -536,7 +536,7 @@ + all: build + + build: +- CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build -ldflags="${GOLDFLAGS}" -o bin ./... ++ CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build -mod=vendor -ldflags="${GOLDFLAGS}" -o bin ./... + + clean: + go clean ./... +@@ -544,7 +544,7 @@ + + install: + CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" GOBIN=${GOBIN} \ +- go install -ldflags="${GOLDFLAGS}" zabbix.com/cmd/zabbix_agent2 ++ go install -mod=vendor -ldflags="${GOLDFLAGS}" zabbix.com/cmd/zabbix_agent2 + test -f "$(DESTDIR)${prefix}/etc/zabbix_agent2.conf" || cp "conf/zabbix_agent2.conf" "$(DESTDIR)${prefix}/etc/zabbix_agent2.conf" + + check: +diff -uNr zabbix-5.2.6/src/go/Makefile.am zabbix-5.2.6-new/src/go/Makefile.am +--- zabbix-5.2.6/src/go/Makefile.am 2021-03-29 17:02:12.000000000 +0800 ++++ zabbix-5.2.6-new/src/go/Makefile.am 2021-10-29 15:39:27.248189410 +0800 +@@ -19,7 +19,7 @@ + all: build + + build: +- CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build -ldflags="${GOLDFLAGS}" -o bin ./... ++ CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build -mod=vendor -ldflags="${GOLDFLAGS}" -o bin ./... + + clean: + go clean ./... +@@ -27,7 +27,7 @@ + + install: + CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" GOBIN=${GOBIN} \ +- go install -ldflags="${GOLDFLAGS}" zabbix.com/cmd/zabbix_agent2 ++ go install -mod=vendor -ldflags="${GOLDFLAGS}" zabbix.com/cmd/zabbix_agent2 + test -f "$(DESTDIR)@AGENT2_CONFIG_FILE@" || cp "conf/zabbix_agent2.conf" "$(DESTDIR)@AGENT2_CONFIG_FILE@" + + check: +diff -uNr zabbix-5.2.6/src/go/Makefile.in zabbix-5.2.6-new/src/go/Makefile.in +--- zabbix-5.2.6/src/go/Makefile.in 2021-03-29 17:21:33.000000000 +0800 ++++ zabbix-5.2.6-new/src/go/Makefile.in 2021-10-29 15:39:27.248189410 +0800 +@@ -536,7 +536,7 @@ + all: build + + build: +- CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build -ldflags="${GOLDFLAGS}" -o bin ./... ++ CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" go build -mod=vendor -ldflags="${GOLDFLAGS}" -o bin ./... + + clean: + go clean ./... +@@ -544,7 +544,7 @@ + + install: + CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS="${CGO_LDFLAGS}" GOBIN=${GOBIN} \ +- go install -ldflags="${GOLDFLAGS}" zabbix.com/cmd/zabbix_agent2 ++ go install -mod=vendor -ldflags="${GOLDFLAGS}" zabbix.com/cmd/zabbix_agent2 + test -f "$(DESTDIR)@AGENT2_CONFIG_FILE@" || cp "conf/zabbix_agent2.conf" "$(DESTDIR)@AGENT2_CONFIG_FILE@" + + check: diff --git a/gomodules-for-x86.tar.gz b/gomodules-for-x86.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..7f7f5289558785ca6ce997022f1fd012d809dc80 Binary files /dev/null and b/gomodules-for-x86.tar.gz differ diff --git a/zabbix.spec b/zabbix.spec index bd53f4ce782d3e48ff3fffb7bbba01a46a770ca7..cc60ef0608e1884149f2ede69df137e92f21dff4 100644 --- a/zabbix.spec +++ b/zabbix.spec @@ -1,6 +1,6 @@ Name: zabbix Version: 5.2.6 -Release: 2 +Release: 3 Summary: The Enterprise-class open source monitoring solution License: GPLv2+ URL: http://www.zabbix.com/ @@ -25,8 +25,10 @@ Source19: zabbix-agent2.service Source20: zabbix-agent.sysconfig Source21: zabbix-agent2.init Source22: zabbix-agent2.sysconfig +Source23: gomodules-for-x86.tar.gz Patch0: config.patch Patch1: fping3-sourceip-option.patch +Patch2: fix-x86-failed-offline.patch Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n) @@ -75,6 +77,7 @@ BuildRequires: pcre-devel BuildRequires: openssl-devel >= 1.0.1 BuildRequires: systemd BuildRequires: golang +BuildRequires: iputils %description Zabbix is the ultimate enterprise-level software designed for @@ -314,9 +317,20 @@ Zabbix java gateway %prep %setup0 -q -n %{name}-%{version}%{?alphatag} +if ping -c 3 -w 20 8.8.8.8; then + echo "Internet ok" +else +%if 0%{?build_agent2} +%setup -T -D -a 23 +mv vendor src/go/ +%endif + echo "Internet error" +fi + %if 0%{?build_frontend} %patch0 -p1 + ## remove font file rm -f ui/assets/fonts/DejaVuSans.ttf @@ -339,6 +353,15 @@ find ui/locale -name '*.sh' | xargs rm -f %patch1 -p1 %endif +if ping -c 3 -w 20 8.8.8.8; then + echo "Internet ok" +else +%if 0%{?build_agent2} +%patch2 -p1 +%endif + echo "Internet error" +fi + %if 0%{?build_server} || 0%{?build_proxy} # traceroute command path for global script sed -i -e 's|/usr/bin/traceroute|/bin/traceroute|' database/mysql/data.sql @@ -1092,6 +1115,9 @@ fi %changelog +* Thu Oct 29 2021 Wang Jiangyong - 5.2.6-3 +- solve the problem x86 build failed on offline environment + * Fri May 14 2021 duyiwei - 5.2.6-2 - solve the problem that missing or redundant if/endif