diff --git a/0002-fix-safety-build.patch b/0002-fix-safety-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..ea4cb7985715651e95d070f94a229efcebff9be3 --- /dev/null +++ b/0002-fix-safety-build.patch @@ -0,0 +1,53 @@ +From 9588ffd7c133fd1b40b4a8f5841f3b9537a8466c Mon Sep 17 00:00:00 2001 +From: zhangsong234 +Date: Fri, 19 Mar 2021 14:52:35 +0800 +Subject: [PATCH] fix safety build + +Signed-off-by: zhangsong234 +--- + Makefile | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/Makefile b/Makefile +index 6050a58..19e4af6 100644 +--- a/Makefile ++++ b/Makefile +@@ -12,16 +12,30 @@ + # Create: 2019-01-18 + + VERSION ?= v1.0.0 ++TAGS="cgo static_build" ++BEP_DIR=/tmp/authz-build-bep ++BEP_FLAGS=-tmpdir=/tmp/authz-build-bep + +-default: binary ++default: dep binary + +-ENV = CGO_ENABLED=0 +-GO_LDFLAGS = "-X main.version=$(VERSION)" +-GOMOD = "-mod=vendor" ++GO_LDFLAGS = "-buildid=IdByiSula $(BEP_FLAGS) -buildmode=pie -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.version=$(VERSION)" ++ifneq ($(GOPATH), ) ++CUS_GOPATH=${GOPATH}:${PWD} ++ENV = GOPATH=${CUS_GOPATH} \ ++ CGO_ENABLED=1 \ ++ CGO_CFLAGS="-fstack-protector-strong -fPIE" \ ++ CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now' \ ++ CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" ++else ++ENV = CGO_ENABLED=1 ++endif ++ ++dep: ++ mkdir -p $(BEP_DIR) + + binary: + mkdir -p bin/ +- $(ENV) go build $(GOMOD) -o bin/authz-broker --ldflags $(GO_LDFLAGS) -a -installsuffix cgo ./main.go ++ $(ENV) go build -mod=vendor -tags ${TAGS} -ldflags $(GO_LDFLAGS) -o bin/authz-broker ./main.go + + clean: + rm -rf bin/ +-- +1.8.3.1 + diff --git a/authz.spec b/authz.spec index e3cee4ced03f3813eda942305ba3f426d9e17f91..39e5c38c7acf5abe3d830ac1967dd016da0ef8c8 100644 --- a/authz.spec +++ b/authz.spec @@ -2,7 +2,7 @@ Name: authz Version: 0.1 -Release: 23 +Release: 24 Summary: a isula auth plugin for RBAC License: Mulan PSL v2 URL: https://gitee.com/openeuler/authz @@ -10,6 +10,7 @@ Source0: authz-%{version}.tar.gz BuildRoot: %{_tmppath}/authz-root Patch0001: 0001-authz-print-error-instead-of-panic-when-start-server.patch +Patch0002: 0002-fix-safety-build.patch #Dependency BuildRequires: golang >= 1.8 @@ -22,6 +23,7 @@ Work with isulad daemon that enables TLS. It brings the support of RBAC. %prep %setup -n %{name} -q %patch1 -p1 +%patch2 -p1 %build make @@ -67,6 +69,9 @@ chmod 0640 /var/lib/authz-broker/policy.json rm -rfv %{buildroot} %changelog +* Fri Mar 19 2021 zhangsong234 - 0.1-24 +- fix safety build + * Thu Mar 04 2021 zhangsong234 - 0.1-23 - bump version to 0.1-23