This commit is contained in:
Collin J. Doering 2021-12-05 03:50:24 -05:00
parent 792792e940
commit 67377a5623
Signed by: rekahsoft
GPG Key ID: 7B4DEB93212B3022
1 changed files with 85 additions and 80 deletions

View File

@ -19,6 +19,7 @@
(define-module (rekahsoft-gnu packages terraform) (define-module (rekahsoft-gnu packages terraform)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages golang) #:use-module (gnu packages golang)
#:use-module (guix utils)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download) #:use-module (guix git-download)
@ -30,6 +31,12 @@
(package (package
(name "terraform") (name "terraform")
(version "0.12.30") (version "0.12.30")
;; TODO: Uses vendored dependencies
(define-public terraform-0.13
(package
(name "terraform")
(version "0.13.6")
(source (origin (source (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
@ -38,35 +45,45 @@
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"0mv2nsy2ygb1kgkw98xckihcdqxpzhdmks5p2gi2l7wb7lx51yz2")))) "1mvxjn1mpc32xq1ax521wa49m5gj5hvdajmb7q4i8sjiqf49213j"))))
(build-system go-build-system) (build-system go-build-system)
(native-inputs (native-inputs
`(("go-gox" ,go-github-com-mitchellh-gox))) `(("go-gox" ,go-github-com-mitchellh-gox)))
(arguments (arguments
`(#:import-path "github.com/hashicorp/terraform" `(#:import-path "github.com/hashicorp/terraform"
#:install-source? #f #:install-source? #f
#:phases (modify-phases %standard-phases #:modules ((guix build go-build-system)
(replace 'build (guix build utils)
(lambda _ (srfi srfi-1))
(with-directory-excursion "src/github.com/hashicorp/terraform" #:phases
(setenv "TF_RELEASE" "") (modify-phases %standard-phases
(setenv "XC_OS" "linux") (replace 'build
(setenv "XC_ARCH" (lambda _
(let ((system ,(or (%current-target-system) (with-directory-excursion "src/github.com/hashicorp/terraform"
(%current-system)))) (setenv "TF_RELEASE" "")
(cond (setenv "XC_OS" "linux")
((string-prefix? "x86_64" system) (setenv "XC_ARCH"
"amd64") (let ((system ,(or (%current-target-system)
((string-prefix? "i686" system) (%current-system))))
"386") (cond
(else "")))) ((string-prefix? "x86_64" system)
(invoke "./scripts/build.sh")))) "amd64")
(replace 'install ((string-prefix? "i686" system)
(lambda* (#:key outputs #:allow-other-keys) "386")
(let ((out (assoc-ref outputs "out"))) (else ""))))
(with-directory-excursion "src/github.com/hashicorp/terraform" (invoke "./scripts/build.sh"))))
(rename-file "bin/terraform" "bin/terraform-0.12") (replace 'install
(copy-recursively "bin" (string-append out "/bin"))))))))) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(version (last (string-split out #\-)))
(components (string-split version #\.))
(major+minor (take components 2))
(executable (string-append "terraform-" (string-join major+minor "."))))
(with-directory-excursion "src/github.com/hashicorp/terraform/bin"
(rename-file "terraform" executable)
(install-file executable bin)
#t)))))))
(synopsis "Safely and predictably create, change, and improve infrastructure") (synopsis "Safely and predictably create, change, and improve infrastructure")
(description (description
"Terraform is a tool for building, changing, and versioning "Terraform is a tool for building, changing, and versioning
@ -75,6 +92,34 @@ popular service providers as well as custom in-house solutions.")
(home-page "https://github.com/hashicorp/terraform") (home-page "https://github.com/hashicorp/terraform")
(license license:mpl2.0))) (license license:mpl2.0)))
(define-public terraform-0.12
(package/inherit terraform-0.13
(name "terraform")
(version "0.12.30")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/hashicorp/terraform")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0mv2nsy2ygb1kgkw98xckihcdqxpzhdmks5p2gi2l7wb7lx51yz2"))))))
(define-public terraform-0.11
(package/inherit terraform-0.13
(name "terraform")
(version "0.11.14")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/hashicorp/terraform")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1bzz5wy13gh8j47mxxp6ij6yh20xmxd9n5lidaln3mf1bil19dmc"))))))
(define* (wrap-terraform terraform (define* (wrap-terraform terraform
#:optional #:optional
(name (string-append (package-name terraform) "-wrapper"))) (name (string-append (package-name terraform) "-wrapper")))
@ -85,71 +130,31 @@ popular service providers as well as custom in-house solutions.")
(outputs '("out")) (outputs '("out"))
(propagated-inputs `(("terraform" ,terraform))) (propagated-inputs `(("terraform" ,terraform)))
(arguments (arguments
`(#:modules ((guix build utils)) `(#:modules ((guix build utils)
(srfi srfi-1))
#:builder #:builder
(begin (begin
(use-modules (guix build utils)) (use-modules (guix build utils)
(let ((bin (string-append (assoc-ref %outputs "out") "/bin")) (srfi srfi-1))
(terraform (string-append (assoc-ref %build-inputs "terraform") "/bin/"))) (let* ((out (assoc-ref %outputs "out"))
(bin (string-append out "/bin"))
(terraform (string-append (assoc-ref %build-inputs "terraform") "/bin/"))
(version (last (string-split out #\-)))
(components (string-split version #\.))
(major+minor (take components 2)))
(mkdir-p bin) (mkdir-p bin)
(symlink (string-append terraform "terraform-0.12") (symlink (string-append terraform "terraform-" (string-join major+minor "."))
(string-append bin "/" "terraform")) (string-append bin "/" "terraform"))
#t)))) #t))))
(synopsis "Wrapper for the terraform 0.12 commands") (synopsis "Wrapper for terraform commands")
(description (description
"This package provides wrappers for the commands of Terraform@tie{}0.12.x such "This package provides wrappers for the commands of Terraform@tie{}MAJOR.MINOR.x such
that they can be invoked under their usual name---e.g., @command{terraform} that they can be invoked under their usual name---e.g., @command{terraform}
instead of @command{terraform-0.12}."))) instead of @command{terraform-MAJOR.MINOR}.")))
(define-public terraform-wrapper (wrap-terraform terraform)) (define-public terraform-wrapper-0.13 (wrap-terraform terraform-0.13))
(define-public terraform-wrapper-0.12 (wrap-terraform terraform-0.12))
(define-public terraform-0.11 (define-public terraform-wrapper-0.11 (wrap-terraform terraform-0.11))
(package
(name "terraform0.11")
(version "0.11.14")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/hashicorp/terraform")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1bzz5wy13gh8j47mxxp6ij6yh20xmxd9n5lidaln3mf1bil19dmc"))))
(build-system go-build-system)
(native-inputs
`(("go-gox" ,go-github-com-mitchellh-gox)))
(arguments
`(#:import-path "github.com/hashicorp/terraform"
#:install-source? #f
#:phases (modify-phases %standard-phases
(replace 'build
(lambda _
(with-directory-excursion "src/github.com/hashicorp/terraform"
(setenv "TF_RELEASE" "")
(setenv "XC_OS" "linux")
(setenv "XC_ARCH"
(let ((system ,(or (%current-target-system)
(%current-system))))
(cond
((string-prefix? "x86_64" system)
"amd64")
((string-prefix? "i686" system)
"386")
(else ""))))
(invoke "./scripts/build.sh"))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(with-directory-excursion "src/github.com/hashicorp/terraform"
(copy-recursively "bin" (string-append out "/bin")))))))))
(synopsis "Safely and predictably create, change, and improve infrastructure")
(description
"Terraform is a tool for building, changing, and versioning
infrastructure safely and efficiently. Terraform can manage existing and
popular service providers as well as custom in-house solutions.")
(home-page "https://github.com/hashicorp/terraform")
(license license:mpl2.0)))
(define terraform-provider-phases (define terraform-provider-phases
'(modify-phases %standard-phases '(modify-phases %standard-phases