pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
terraform: Implement install logic in terraform/provider.mk
Module Name: pkgsrc-wip
Committed By: Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By: leot
Date: Sun May 2 22:57:19 2021 +0200
Changeset: 673c7b9f6a592949dba59e486863b3e25e2490c9
Modified Files:
terraform-provider-aws/Makefile
terraform-provider-kubernetes/Makefile
terraform-provider-kubernetes1/Makefile
terraform-provider-local/Makefile
terraform-provider-random/Makefile
terraform/provider.mk
Log Message:
terraform: Implement install logic in terraform/provider.mk
Automatically handle installation of Terraform provider binary in
terraform/provider.mk via a custom `pre-install:' target.
Instead of overwriting `do-install:' and paying attention to inclusion order of
go-{module,package}.mk let's overwrite `pre-install:'.
Adjust all terraform/provider.mk users.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=673c7b9f6a592949dba59e486863b3e25e2490c9
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
terraform-provider-aws/Makefile | 6 ------
terraform-provider-kubernetes/Makefile | 6 ------
terraform-provider-kubernetes1/Makefile | 6 ------
terraform-provider-local/Makefile | 6 ------
terraform-provider-random/Makefile | 6 ------
terraform/provider.mk | 27 ++++++++++++++++++++-------
6 files changed, 20 insertions(+), 37 deletions(-)
diffs:
diff --git a/terraform-provider-aws/Makefile b/terraform-provider-aws/Makefile
index f7d364fe0a..e731954313 100644
--- a/terraform-provider-aws/Makefile
+++ b/terraform-provider-aws/Makefile
@@ -18,12 +18,6 @@ TERRAFORM_PROVIDER_BIN= terraform-provider-aws
TERRAFORM_PROVIDER_NAMESPACE= hashicorp
TERRAFORM_PROVIDER_TYPE= aws
-INSTALLATION_DIRS+= ${TERRAFORM_PROVIDER_DIR}
-
-do-install:
- ${INSTALL_PROGRAM} ${WRKDIR}/.gopath/bin/${TERRAFORM_PROVIDER_BIN} \
- ${DESTDIR}${PREFIX}/${TERRAFORM_PROVIDER_DIR}
-
.include "go-modules.mk"
.include "../../lang/go/go-module.mk"
diff --git a/terraform-provider-kubernetes/Makefile b/terraform-provider-kubernetes/Makefile
index b73dd8c733..af23f0231e 100644
--- a/terraform-provider-kubernetes/Makefile
+++ b/terraform-provider-kubernetes/Makefile
@@ -18,12 +18,6 @@ TERRAFORM_PROVIDER_BIN= terraform-provider-kubernetes
TERRAFORM_PROVIDER_NAMESPACE= hashicorp
TERRAFORM_PROVIDER_TYPE= kubernetes
-INSTALLATION_DIRS+= ${TERRAFORM_PROVIDER_DIR}
-
-do-install:
- ${INSTALL_PROGRAM} ${WRKDIR}/.gopath/bin/${TERRAFORM_PROVIDER_BIN} \
- ${DESTDIR}${PREFIX}/${TERRAFORM_PROVIDER_DIR}
-
.include "go-modules.mk"
.include "../../lang/go/go-module.mk"
diff --git a/terraform-provider-kubernetes1/Makefile b/terraform-provider-kubernetes1/Makefile
index 4100dd3840..26a0c68445 100644
--- a/terraform-provider-kubernetes1/Makefile
+++ b/terraform-provider-kubernetes1/Makefile
@@ -26,12 +26,6 @@ GO_BUILD_PATTERN= ${GO_SRCPATH}/.
USE_TOOLS+= bash
REPLACE_BASH+= scripts/*.sh
-INSTALLATION_DIRS+= ${TERRAFORM_PROVIDER_DIR}
-
-do-install:
- ${INSTALL_PROGRAM} ${WRKDIR}/bin/${TERRAFORM_PROVIDER_BIN} \
- ${DESTDIR}${PREFIX}/${TERRAFORM_PROVIDER_DIR}
-
.include "../../lang/go/go-package.mk"
.include "../../wip/terraform/provider.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/terraform-provider-local/Makefile b/terraform-provider-local/Makefile
index e0cae16703..b8c059e18f 100644
--- a/terraform-provider-local/Makefile
+++ b/terraform-provider-local/Makefile
@@ -18,12 +18,6 @@ TERRAFORM_PROVIDER_BIN= terraform-provider-local
TERRAFORM_PROVIDER_NAMESPACE= hashicorp
TERRAFORM_PROVIDER_TYPE= local
-INSTALLATION_DIRS+= ${TERRAFORM_PROVIDER_DIR}
-
-do-install:
- ${INSTALL_PROGRAM} ${WRKDIR}/.gopath/bin/${TERRAFORM_PROVIDER_BIN} \
- ${DESTDIR}${PREFIX}/${TERRAFORM_PROVIDER_DIR}
-
.include "go-modules.mk"
.include "../../lang/go/go-module.mk"
diff --git a/terraform-provider-random/Makefile b/terraform-provider-random/Makefile
index 1e6478b9ef..f2d3dc6a7f 100644
--- a/terraform-provider-random/Makefile
+++ b/terraform-provider-random/Makefile
@@ -24,12 +24,6 @@ GO_BUILD_PATTERN= ${GO_SRCPATH}/.
USE_TOOLS+= bash
REPLACE_BASH+= scripts/*.sh
-INSTALLATION_DIRS+= ${TERRAFORM_PROVIDER_DIR}
-
-do-install:
- ${INSTALL_PROGRAM} ${WRKDIR}/bin/${TERRAFORM_PROVIDER_BIN} \
- ${DESTDIR}${PREFIX}/${TERRAFORM_PROVIDER_DIR}
-
.include "../../lang/go/go-package.mk"
.include "../../wip/terraform/provider.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/terraform/provider.mk b/terraform/provider.mk
index efd738b9f3..ce73726bc3 100644
--- a/terraform/provider.mk
+++ b/terraform/provider.mk
@@ -37,11 +37,24 @@ PRINT_PLIST_AWK+= { sub("${TERRAFORM_PROVIDER_NAMESPACE}", "$${TERRAFORM_PROVIDE
PRINT_PLIST_AWK+= { sub("${TERRAFORM_PROVIDER_TYPE}", "$${TERRAFORM_PROVIDER_TYPE}") }
PRINT_PLIST_AWK+= { sub("${TERRAFORM_PROVIDER_VERSION}", "$${TERRAFORM_PROVIDER_VERSION}") }
+INSTALLATION_DIRS+= ${TERRAFORM_PROVIDER_DIR}
+
#
-# TODO: overwrite do-install: target so it DTRT both for go-module.mk packages
-# TODO: and go-packages.mk packages. This can be probably done by checking for
-# TODO: both existence of TERRAFORM_PROVIDER_BIN in .gopath/bin and bin and copy
-# TODO: what is found. Currently, for all packaged providers, this is probably
-# TODO: good enough but if there is any exception we can probably adjust that
-# TODO: via pre-install:/post-install: too.
-#
+# This should overwrite `do-install:' target, however
+# lang/go/go-{module,package}.mk already overwrite them.
+#
+.if !target(pre-install)
+pre-install:
+ ${RUN} \
+ if [ -f ${WRKDIR}/.gopath/bin/${TERRAFORM_PROVIDER_BIN} ]; then \
+ ${INSTALL_PROGRAM} ${WRKDIR}/.gopath/bin/${TERRAFORM_PROVIDER_BIN} \
+ ${DESTDIR}${PREFIX}/${TERRAFORM_PROVIDER_DIR} ; \
+ { [ -d ${WRKDIR}/.gopath ] && chmod -R +w ${WRKDIR}/.gopath || true ; } ; \
+ ${RM} -rf ${WRKDIR}/.gopath/bin ; \
+ elif [ -f ${WRKDIR}/bin/${TERRAFORM_PROVIDER_BIN} ]; then \
+ ${INSTALL_PROGRAM} ${WRKDIR}/bin/${TERRAFORM_PROVIDER_BIN} \
+ ${DESTDIR}${PREFIX}/${TERRAFORM_PROVIDER_DIR} ; \
+ ${RM} -rf ${WRKDIR}/bin ; \
+ ${RM} -rf ${WRKDIR}/pkg ; \
+ fi
+.endif
Home |
Main Index |
Thread Index |
Old Index