From dca3388364422ab45368da40dcb09c59c511bac0 Mon Sep 17 00:00:00 2001 From: wu-leilei Date: Thu, 9 Feb 2023 16:08:15 +0800 Subject: [PATCH] Add strip and pie --- add-parameters-to-solve-the-strip.patch | 20 ++++++++++++++++++++ blackbox_exporter.spec | 11 ++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 add-parameters-to-solve-the-strip.patch diff --git a/add-parameters-to-solve-the-strip.patch b/add-parameters-to-solve-the-strip.patch new file mode 100644 index 0000000..edae972 --- /dev/null +++ b/add-parameters-to-solve-the-strip.patch @@ -0,0 +1,20 @@ +diff -Nur a/.promu.yml b/.promu.yml +--- a/.promu.yml 2023-02-09 14:54:47.876832158 +0800 ++++ b/.promu.yml 2023-02-09 14:56:28.322288215 +0800 +@@ -7,11 +7,11 @@ + build: + flags: -a -tags netgo + ldflags: | +- -X github.com/prometheus/common/version.Version={{.Version}} +- -X github.com/prometheus/common/version.Revision={{.Revision}} +- -X github.com/prometheus/common/version.Branch={{.Branch}} +- -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} +- -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now' -X github.com/prometheus/common/version.Version={{.Version}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now' -X github.com/prometheus/common/version.Revision={{.Revision}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now' -X github.com/prometheus/common/version.Branch={{.Branch}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now' -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now' -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} + tarball: + files: + - blackbox.yml diff --git a/blackbox_exporter.spec b/blackbox_exporter.spec index 2d5aeb0..0f627f0 100644 --- a/blackbox_exporter.spec +++ b/blackbox_exporter.spec @@ -2,14 +2,15 @@ %define debug_package %{nil} Name: blackbox_exporter Version: 0.19.0 -Release: 2 +Release: 3 Summary: Prometheus blackbox prober exporter License: Apache-2.0 Url: https://github.com/prometheus/blackbox_exporter Source: https://github.com/prometheus/blackbox_exporter/archive/refs/tags/v%{version}.tar.gz Source1: %{name}.service Source2: vendor.tar.gz -BuildRequires: golang promu +Patch0: add-parameters-to-solve-the-strip.patch +BuildRequires: golang promu gcc Requires(pre): prometheus2 %description The blackbox exporter allows blackbox probing of endpoints over HTTP, HTTPS, DNS, TCP and ICMP. @@ -17,9 +18,10 @@ The blackbox exporter allows blackbox probing of endpoints over HTTP, HTTPS, DNS %prep %setup -q -n %{name}-%{version} tar xvf %{SOURCE2} -C . +%patch0 -p1 %build -export GOFLAGS="-mod=vendor" +export GOFLAGS="-mod=vendor -buildmode=pie" promu build %install @@ -41,6 +43,9 @@ install -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service %config(noreplace) %{_sysconfdir}/prometheus/blackbox.yml %changelog +* Thu Feb 09 2023 wulei - 0.19.0-3 +- Add strip and pie + * Tue Aug 10 2021 huanghaitao - 0.19.0-2 - Fix systemd macro spelling errors. -- Gitee