GNU bug report logs -
#30806
[PATCH] Add terraform and terraform-provider-libvirt
Previous Next
Reported by: Christopher Baines <mail <at> cbaines.net>
Date: Tue, 13 Mar 2018 20:26:01 UTC
Severity: normal
Tags: moreinfo, patch
Merged with 44721
Done: Sharlatan Hellseher <sharlatanus <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30806 in the body.
You can then email your comments to 30806 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#30806
; Package
guix-patches
.
(Tue, 13 Mar 2018 20:26:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Christopher Baines <mail <at> cbaines.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 13 Mar 2018 20:26:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: moreinfo
I'll send some patches for adding a Terraform package and the Terraform
libvirt provider. Both of these work, at least in the way I've been
using them, but the packages need more work before they can be
included. I think both packages include quite a few copies of other
libraries which need packaging for Guix.
Christopher Baines (2):
gnu: Add terraform.
gnu: Add terraform-provider-libvirt.
gnu/local.mk | 1 +
gnu/packages/terraform.scm | 106 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+)
create mode 100644 gnu/packages/terraform.scm
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#30806
; Package
guix-patches
.
(Tue, 13 Mar 2018 20:31:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 30806 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/terraform.scm (terraform-provider-libvirt): New variable.
---
gnu/packages/terraform.scm | 48 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/terraform.scm b/gnu/packages/terraform.scm
index 277d19aed..e81ada45d 100644
--- a/gnu/packages/terraform.scm
+++ b/gnu/packages/terraform.scm
@@ -21,7 +21,11 @@
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
- #:use-module (guix build-system go))
+ #:use-module (guix build-system go)
+ #:use-module (gnu packages golang)
+ #:use-module (gnu packages cdrom)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages virtualization))
(define-public terraform
(package
@@ -58,3 +62,45 @@ apply changes to the described resources.
Terraform uses plugins that provide intergrations to different providers.")
(home-page "https://www.terraform.io/")
(license license:mpl2.0)))
+
+(define-public terraform-provider-libvirt
+ (package
+ (name "terraform-provider-libvirt")
+ (version "0.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dmacvicar/terraform-provider-libvirt")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "004gxy55p5cf39f2zpah0i2zhvs4x6ixnxy8z9v7314604ggpkna"))))
+ (build-system go-build-system)
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (inputs
+ `(("libvirt" ,libvirt)
+ ("cdrtools" ,cdrtools)))
+ (arguments
+ '(#:import-path "github.com/dmacvicar/terraform-provider-libvirt"
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-mkisofs
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute*
+ "src/github.com/dmacvicar/terraform-provider-libvirt/libvirt/cloudinit_def.go"
+ (("mkisofs")
+ (string-append (assoc-ref inputs "cdrtools")
+ "/bin/mkisofs")))))
+ ;; This should be redundant once the vendor directory is removed from
+ ;; this package
+ (add-before 'reset-gzip-timestamps 'remove-readonly-gzip-files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (for-each delete-file
+ (find-files
+ (assoc-ref outputs "out")
+ ".*\\.gz")))))))
+ (synopsis "")
+ (description "")
+ (home-page "")
+ (license "")))
--
2.16.2
Information forwarded
to
guix-patches <at> gnu.org
:
bug#30806
; Package
guix-patches
.
(Tue, 13 Mar 2018 20:31:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 30806 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/terraform.scm (New file).
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
gnu/local.mk | 1 +
gnu/packages/terraform.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
create mode 100644 gnu/packages/terraform.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index 5a3ae502f..2b5502e8e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -410,6 +410,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/tcl.scm \
%D%/packages/telephony.scm \
%D%/packages/terminals.scm \
+ %D%/packages/terraform.scm \
%D%/packages/texinfo.scm \
%D%/packages/tex.scm \
%D%/packages/textutils.scm \
diff --git a/gnu/packages/terraform.scm b/gnu/packages/terraform.scm
new file mode 100644
index 000000000..277d19aed
--- /dev/null
+++ b/gnu/packages/terraform.scm
@@ -0,0 +1,60 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Christopher Baines <mail <at> cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages terraform)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix build-system go))
+
+(define-public terraform
+ (package
+ (name "terraform")
+ (version "0.11.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/hashicorp/terraform")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "0637x7jcm62pdnivmh4rggly6dmlvdh3jpsd1z4vba15gbm203nz"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/hashicorp/terraform"
+ #:phases
+ (modify-phases %standard-phases
+ ;; I'm not sure what purpose they serve, but they are readonly, so
+ ;; they break the reset-gzip-timestamps phase.
+ (add-after 'install 'delete-test-fixtures
+ (lambda* (#:key outputs #:allow-other-keys)
+ (delete-file-recursively
+ (string-append
+ (assoc-ref outputs "out")
+ "/src/github.com/hashicorp/terraform/config/module/test-fixtures")))))))
+ (synopsis "Tool for building and changing computing infrastructure")
+ (description
+ "Terraform uses descriptions of infrastructure written in @acronym{HCL,
+Hashicorp Configuration Language} which describe graphs of resources,
+including information about dependencies. From this, Terraform can plan and
+apply changes to the described resources.
+
+Terraform uses plugins that provide intergrations to different providers.")
+ (home-page "https://www.terraform.io/")
+ (license license:mpl2.0)))
--
2.16.2
Information forwarded
to
guix-patches <at> gnu.org
:
bug#30806
; Package
guix-patches
.
(Thu, 20 Dec 2018 09:33:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 30806 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello Chris and Pierre!
Thank you for your tips regarding Golang and Terraform. I've built it -
both ad-hoc and using a slightly modified version of Chris' original
package definition. I'm still getting used to Golang's build system and
our own golang-build-system, so please bear with me!
I was able to run the official Terraform build steps on the latest
Terraform release by issuing the following commands - but I'm not sure
if this actually produced the terraform program:
mkdir terraform
cd terraform/
wget https://github.com/hashicorp/terraform/archive/v0.11.11.tar.gz
tar -xf v0.11.11.tar.gz
mkdir -p src/github.com/hashicorp
cp -r terraform-0.11.11 src/github.com/hashicorp/terraform
guix package -i go make git bash grep findutils which coreutils diffutils -p .guix-profile
mkdir gobin
eval "$(guix package --search-paths=exact --profile=$(realpath --no-symlinks .guix-profile))"
export GOPATH="$(pwd)"
export GOBIN="$GOPATH/bin"
export PATH="$PATH:$GOBIN"
cd src/github.com/hashicorp/terraform/
make tools
make
Those last two commands are the ones listed in Terraform's README.md.
It looks like the final command, "make" will execute the "fmtcheck",
"generate", and "test" recipes in that order. Here are the relevant
parts of the Makefile:
--8<---------------cut here---------------start------------->8---
default: test
[...]
# test runs the unit tests
# we run this one package at a time here because running the entire suite in
# one command creates memory usage issues when running in Travis-CI.
test: fmtcheck generate
go list $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=2m -parallel=4
[...]
# generate runs `go generate` to build the dynamically generated
# source files.
generate:
@which stringer > /dev/null; if [ $$? -ne 0 ]; then \
go get -u golang.org/x/tools/cmd/stringer; \
fi
go generate ./...
@go fmt command/internal_plugin_list.go > /dev/null
[...]
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
--8<---------------cut here---------------end--------------->8---
So, in essence this runs "go generate", "go fmt", and "go test". The
script gofmtcheck.sh seems to be a read-only linter to assist the
Terraform maintainers in finding badly formatted Golang files.
This is slightly different from the installation procedure that our
go-build-system runs. When you build the attached package (which
packages an older version of terraform for now), our go-build-system
runs steps like the following (in order from top to bottom):
* Phase: unpack: Make a "src/github.com/hashicorp/terraform" directory.
* Phase: setup-environment: set GOPATH to (getcwd) and GOBIN to $out/bin.
* Phase: build: go install -v -x '-ldflags=-s -w' github.com/hashicorp/terraform
* Phase: check: go test github.com/hashicorp/terraform
All in all, this has raised some questions in my mind:
1) Is it bad that our package definition isn't running "go generate" or
"go fmt"? Do you know if "go install" does this for us somehow? I
don't think "stringer" or "mockgen" are present in the build
environment, but our "go install" invocation seems to build terraform
even without them. I wonder if the built terraform is broken in some
ways because we didn't run the code generation/formatting steps.
2) After I ran "make" ad-hoc, I couldn't find a built "terraform"
executable anywhere. Where is it? Am missing something obvious, or
could it be that the official documentation incomplete and I need to ask
upstream for advice?
3) The official instructions seem to arbitrarily choose to run the build
in parallel, using 4 threads, which means this package won't play nice
with build arguments like --cores. I suppose I might need to work with
upstream to fix that.
This feels so close, and yet so far. Hopefully we only have a little
more to do to get Terraform packaged well! Thank you again for your
help.
--
Chris
[0001-gnu-Add-terraform.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#30806
; Package
guix-patches
.
(Thu, 20 Dec 2018 09:48:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 30806 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> 1) Is it bad that our package definition isn't running "go generate" or
> "go fmt"? Do you know if "go install" does this for us somehow? I
> don't think "stringer" or "mockgen" are present in the build
"go generate" is used to generate code, it's like a preprocessor. Most Go
programs don't use it, but if they do, then it's needed.
"go fmt" should not be part of the build process in my opinion. A code
formatter fits better into a Git hook or something.
> 2) After I ran "make" ad-hoc, I couldn't find a built "terraform"
> executable anywhere. Where is it? Am missing something obvious, or
> could it be that the official documentation incomplete and I need to ask
> upstream for advice?
I haven't looked into it, but it should be either in ~/go/bin or in the package
source folder, something like ~/go/src/.../terraform/.
> 3) The official instructions seem to arbitrarily choose to run the build
> in parallel, using 4 threads, which means this package won't play nice
> with build arguments like --cores. I suppose I might need to work with
> upstream to fix that.
I think Go decides this on its own. Off the top of my head, there is an
environment variable to control the number of CPU threads used globally,
GO_xxx_CORES or something like that.
--
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]
Merged 30806 44721.
Request was from
Sarah Morgensen <iskarian <at> mgsn.dev>
to
control <at> debbugs.gnu.org
.
(Mon, 13 Sep 2021 01:19:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#30806
; Package
guix-patches
.
(Tue, 28 Sep 2021 19:58:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 30806 <at> debbugs.gnu.org (full text, mbox):
Hi all,
Terraform is reached stable version 1.0.0+ is it still in review to
have it in Guix or it will be regected due to any licensing reason?
--
… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 17 Mar 2025 11:24:14 GMT)
Full text and
rfc822 format available.
This bug report was last modified 53 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.