commit:     06e89b240c525b560c76d5b55f2baf8173ba7f96
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 10 23:33:05 2020 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Mar 10 23:39:17 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06e89b24

app-admin/helm: fix build process

Fix the build process where 3.1.1 did not build at all, and ensure that
it has correct Git data in the version output.

Fixes: https://bugs.gentoo.org/711852
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 app-admin/helm/helm-3.1.1.ebuild | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/app-admin/helm/helm-3.1.1.ebuild b/app-admin/helm/helm-3.1.1.ebuild
index f49619ea932..21fe413bbc9 100644
--- a/app-admin/helm/helm-3.1.1.ebuild
+++ b/app-admin/helm/helm-3.1.1.ebuild
@@ -700,17 +700,29 @@ RESTRICT+=" test"
 
 src_prepare() {
        default
-       mv ../vendor .
-       sed -i -e "s/git rev-parse HEAD/echo ${GIT_COMMIT}/"\
-               -e "s/git rev-parse --short HEAD/echo ${GIT_COMMIT:0:7}/"\
-               -e "s#git describe --tags --abbrev=0 --exact-match 
2>/dev/null#echo v${PV}#"\
-               -e 's/test -n "`git status --porcelain`" && echo "dirty" || //' 
\
-               -e "/GOFLAGS    :=/d" \
+       # Makefile:
+       # - change GIT & LDFLAGS variable assignments from immediate ":=" to
+       #   deferred "=", to allow better overrides.
+       # - Remove GOFLAGS entirely
+       # - Remove -w & -s from LDFLAGS
+       # - Git spec will be passed later
+       sed -r -i \
+               -e '/^GIT_(COMMIT|SHA|TAG|DIRTY)/s,:?=.*,=,g' \
+               -e "/^GOFLAGS[[:space:]]+:?=/d" \
+               -e '/^LDFLAGS[[:space:]]+:?=/{s,-[ws],,g;s,:=,=,g}' \
                Makefile || die
 }
 
 src_compile() {
-       emake GOFLAGS="-mod=vendor" LDFLAGS= build
+       # Do not pass LDFLAGS directly here, as the upstream Makefile adds some
+       # data to it via +=
+       emake \
+               GOFLAGS="${GOFLAGS}" \
+               GIT_SHA=${GIT_COMMIT} \
+               GIT_COMMIT=${GIT_COMMIT:0:7} \
+               GIT_TAG=v${PV} \
+               GIT_DIRTY=clean \
+               build
        bin/${PN} completion bash > ${PN}.bash || die
        bin/${PN} completion zsh > ${PN}.zsh || die
 }

Reply via email to