summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Baz2018-11-14 22:15:42 +0100
committerMaxim Baz2018-11-14 22:22:40 +0100
commitcf4be235344435e6986547635191b07ae3789eac (patch)
tree026ae6568fa81f140d69d940cff55e6475fff8e5
parent7ec7498de61014a31ef6c1b1c2aee1933640cd14 (diff)
downloadaur-cf4be235344435e6986547635191b07ae3789eac.tar.gz
skaffold: compile from sources with RELRO, make reproducible
-rw-r--r--.SRCINFO11
-rw-r--r--PKGBUILD41
-rw-r--r--build_flags.patch34
3 files changed, 71 insertions, 15 deletions
diff --git a/.SRCINFO b/.SRCINFO
index bb010523fc6c..889722cf2678 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,19 @@
pkgbase = skaffold
pkgdesc = A command line tool that facilitates continuous development for Kubernetes applications
pkgver = 0.18.0
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/GoogleContainerTools/skaffold
arch = x86_64
- license = APACHE
+ license = Apache
+ makedepends = go-pie
depends = docker
depends = kubectl-bin
optdepends = google-cloud-sdk: To use GKE
optdepends = minikube: To use Minikube
- source = skaffold-0.18.0::https://storage.googleapis.com/skaffold/releases/v0.18.0/skaffold-linux-amd64
- sha256sums = 00de742c8052cacff5812d3aa4e4192d6e27e05652a6949fa4152fa18f359935
+ source = skaffold-0.18.0::https://github.com/GoogleContainerTools/skaffold/archive/v0.18.0.tar.gz
+ source = build_flags.patch
+ sha256sums = 3ec621485d2ebeac3366346271527326c3c97115784597bff457ccce162be008
+ sha256sums = 03be8856eec2169b72fae7369ce11c32a66cd49638e4e68bae7f63b0d5519a6a
pkgname = skaffold
diff --git a/PKGBUILD b/PKGBUILD
index 9c21e7f1074e..9d86e754dbdc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,18 +1,37 @@
# Maintainer: Fredy GarcĂ­a <frealgagu at gmail dot com>
+# Maintainer: Maxim Baz <$pkgbuild at maximbaz dot com>
+_pkgauthor=GoogleContainerTools
pkgname=skaffold
pkgver=0.18.0
-pkgrel=1
-pkgdesc="A command line tool that facilitates continuous development for Kubernetes applications"
-arch=("x86_64")
-url="https://github.com/GoogleContainerTools/${pkgname}"
-license=("APACHE")
-depends=("docker" "kubectl-bin")
-optdepends=("google-cloud-sdk: To use GKE"
- "minikube: To use Minikube")
-source=("${pkgname}-${pkgver}::https://storage.googleapis.com/${pkgname}/releases/v${pkgver}/${pkgname}-linux-amd64")
-sha256sums=("00de742c8052cacff5812d3aa4e4192d6e27e05652a6949fa4152fa18f359935")
+pkgrel=2
+pkgdesc='A command line tool that facilitates continuous development for Kubernetes applications'
+arch=('x86_64')
+url="https://github.com/$_pkgauthor/$pkgname"
+license=('Apache')
+depends=('docker' 'kubectl-bin')
+makedepends=('go-pie')
+optdepends=('google-cloud-sdk: To use GKE'
+ 'minikube: To use Minikube')
+source=("$pkgname-$pkgver::https://github.com/$_pkgauthor/$pkgname/archive/v$pkgver.tar.gz"
+ 'build_flags.patch')
+sha256sums=('3ec621485d2ebeac3366346271527326c3c97115784597bff457ccce162be008'
+ '03be8856eec2169b72fae7369ce11c32a66cd49638e4e68bae7f63b0d5519a6a')
+
+prepare() {
+ mkdir -p "gopath/src/github.com/$_pkgauthor"
+ ln -rTsf "$pkgname-$pkgver" "gopath/src/github.com/$_pkgauthor/$pkgname"
+
+ cd "$pkgname-$pkgver"
+ patch -Np1 -i ../build_flags.patch
+}
+
+build() {
+ export GOPATH="$srcdir/gopath"
+ cd "gopath/src/github.com/$_pkgauthor/$pkgname"
+ VERSION="v$pkgver" make install
+}
package() {
- install -Dm755 "${srcdir}/${pkgname}-${pkgver}" "${pkgdir}/usr/bin/${pkgname}"
+ install -Dm755 "gopath/bin/$pkgname" "$pkgdir/usr/bin/$pkgname"
}
diff --git a/build_flags.patch b/build_flags.patch
new file mode 100644
index 000000000000..da945a0b1cb3
--- /dev/null
+++ b/build_flags.patch
@@ -0,0 +1,34 @@
+diff --git a/Makefile b/Makefile
+index caa9d41f..f8516e59 100644
+--- a/Makefile
++++ b/Makefile
+@@ -36,7 +36,11 @@ VERSION_PACKAGE = $(REPOPATH)/pkg/skaffold/version
+ COMMIT = $(shell git rev-parse HEAD)
+ VERSION ?= $(shell git describe --always --tags --dirty)
+
++GO_GCFLAGS := "all=-trimpath=${PWD}"
++GO_ASMFLAGS := "all=-trimpath=${PWD}"
++
+ GO_LDFLAGS :="
++GO_LDFLAGS += -extldflags \"${LDFLAGS}\"
+ GO_LDFLAGS += -X $(VERSION_PACKAGE).version=$(VERSION)
+ GO_LDFLAGS += -X $(VERSION_PACKAGE).buildDate=$(shell date +'%Y-%m-%dT%H:%M:%SZ')
+ GO_LDFLAGS += -X $(VERSION_PACKAGE).gitCommit=$(COMMIT)
+@@ -50,7 +54,7 @@ $(BUILD_DIR)/$(PROJECT): $(BUILD_DIR)/$(PROJECT)-$(GOOS)-$(GOARCH)
+ cp $(BUILD_DIR)/$(PROJECT)-$(GOOS)-$(GOARCH) $@
+
+ $(BUILD_DIR)/$(PROJECT)-%-$(GOARCH): $(GO_FILES) $(BUILD_DIR)
+- GOOS=$* GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags $(GO_LDFLAGS) -tags $(GO_BUILD_TAGS) -o $@ $(BUILD_PACKAGE)
++ GOOS=$* GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -tags $(GO_BUILD_TAGS) -o $@ $(BUILD_PACKAGE)
+
+ %.sha256: %
+ shasum -a 256 $< > $@
+@@ -76,7 +80,7 @@ test:
+
+ .PHONY: install
+ install: $(GO_FILES) $(BUILD_DIR)
+- GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go install -ldflags $(GO_LDFLAGS) -tags $(GO_BUILD_TAGS) $(BUILD_PACKAGE)
++ GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go install -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -tags $(GO_BUILD_TAGS) $(BUILD_PACKAGE)
+
+ .PHONY: integration
+ integration: install $(BUILD_DIR)/$(PROJECT)