!5 [sync] PR-4: promu存在不安全的编译选项PIE、STRIP

From: @openeuler-sync-bot 
Reviewed-by: @yangzhao_kl 
Signed-off-by: @yangzhao_kl
This commit is contained in:
openeuler-ci-bot 2023-03-07 05:44:03 +00:00 committed by Gitee
commit 6eeb58b682
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,20 @@
--- c/.promu.yml 2023-03-07 11:30:19.037256381 +0800
+++ a/.promu.yml 2023-03-07 11:32:48.661260604 +0800
@@ -7,12 +7,11 @@ repository:
build:
flags: -mod=vendor -a -tags 'netgo static_build'
ldflags: |
- -s
- -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 -pie' -X github.com/prometheus/common/version.Version={{.Version}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Revision={{.Revision}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Branch={{.Branch}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
tarball:
files:
- LICENSE

View File

@ -2,14 +2,17 @@
Name: promu
Version: 0.7.0
Release: 1
Release: 2
Summary: Prometheus Utility Tool
License: ASL 2.0
URL: https://github.com/prometheus/promu
Source0: https://github.com/prometheus/promu/archive/v%{version}.tar.gz
Patch0: add-parameters-to-solve-the-strip.patch
BuildRequires: golang >= 1.13
BuildRequires: gcc
Conflicts: promu
Provides: %{name} = %{version}
@ -19,9 +22,11 @@ promu is the utility tool for building and releasing Prometheus projects
%prep
%setup -q -T -n %{name}-%{version} -b 0
%patch0 -p1
%build
GOFLAGS=-mod=vendor make build
export GOFLAGS="-mod=vendor -buildmode=pie"
make build
%install
install -D -m 755 %{name}-%{version} %{buildroot}%{_bindir}/promu
@ -31,5 +36,8 @@ install -D -m 755 %{name}-%{version} %{buildroot}%{_bindir}/promu
%{_bindir}/promu
%changelog
* Fri Mar 03 2023 wangjunqi <wangjunqi@kylinos.cn> - 0.7.0-2
- add strip and pie
* Wed Dec 16 2020 yangzhao <yangzhao1@kylinos.cn> - 0.7.0-1
- Init project promu