rekahsoft-gnu: Fix and update awscli and dependencies

Note: there is more cleanup to follow this. Namely, the vendored libraries
should be further investigated and packaged individually as before, but
including the variation that now exists in awscli after updating it.
This commit is contained in:
Collin J. Doering 2023-12-31 12:05:21 -05:00
parent 3c77938ff9
commit 6b8acec6c8
Signed by: rekahsoft
GPG Key ID: 7B4DEB93212B3022
4 changed files with 119 additions and 89 deletions

View File

@ -30,6 +30,7 @@
#:use-module (gnu packages admin)
#:use-module (gnu packages gcc)
#:use-module (gnu packages golang)
#:use-module (gnu packages golang-web)
#:use-module (gnu packages base)
#:use-module (gnu packages check)
#:use-module (gnu packages gnupg)

View File

@ -22,7 +22,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages check)
#:use-module (gnu packages cmake)
#:use-module (gnu packages commencement)
#:use-module (gnu packages glib)
#:use-module (gnu packages groff)
#:use-module (gnu packages libffi)
#:use-module (gnu packages maths)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
@ -31,11 +34,15 @@
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages serialization)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages time)
#:use-module (gnu packages tls)
#:use-module (gnu packages xml)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix build-system python)
#:use-module (guix build-system pyproject)
#:use-module (srfi srfi-1))
;; TODO: Candidate for upstream
@ -223,7 +230,6 @@ bindings for Python 3.")
(license license:bsd-3)))
;; python-prompt-toolkit-2 was removed upstream from guix's channel; added here as awscliv2 depends on it
;; awscliv2 depends on 'prompt-toolkit<3.0.29,>=3.0.24', however upstream 3.0.29 is packaged
(define-public python-prompt-toolkit-3.0.28
(package/inherit python-prompt-toolkit
@ -235,11 +241,23 @@ bindings for Python 3.")
(sha256 (base32
"0l0nnm9fvs8lklk2qq8mylb9jrlxvlqzpmqr4n7rdhl63rmx274z"))))))
;; awscliv2 is a little bit of a packaging mess. They vendor multiple modified
;; forks of software also maintained by the same company. Namely:
;;
;; - botocore@2.0.0dev155 and some of its dependencies:
;; - python-six@1.10.0
;; - Fragments (exceptions only) were extracted from:
;; - requests
;; - urllib3
;; - s3transfer@0.5.1
;;
;; botocore@2.0.0dev155 is incompatable with the same upstream version. For example:
;; https://github.com/aws/aws-cli/blob/2.15.4/awscli/botocore/httpchecksum.py
;; does not exist upstream (see: https://github.com/boto/botocore/tree/7083e5c204e139dc41f646e0ad85286b5e7c0c23/botocore)
(define-public awscliv2
(package
(inherit awscli)
(name "awscliv2")
(version "2.7.18")
(version "2.15.6")
(source (origin
(method git-fetch)
(uri (git-reference
@ -248,59 +266,45 @@ bindings for Python 3.")
(file-name (git-file-name name version))
(sha256
(base32
"10p6433spz3lw5jwnw0kflp3fh629chiscp868slld6x2kp80gi4"))))
(native-inputs `(("python-distro" ,python-distro-1.5)
("python-docutils" ,python-docutils-0.15)
("python-s3transfer" ,python-s3transfer)
("python-awscrt" ,python-awscrt)
("python-prompt-toolkit" ,python-prompt-toolkit-3.0.28)
("python-ruamel.yaml" ,python-ruamel.yaml-0.15)
("python-cryptography" ,python-cryptography-3.3.2)
("python-botocore" ,python-botocore-2.0.0dev155)))
(propagated-inputs `(,@(fold alist-delete
(package-propagated-inputs awscli)
'("python-botocore"))))
"02lq4zxnksx1ab8lyzbyl1lay884xbrxp77rbhn5mrfib9mqmvs0"))))
(native-inputs (list python-distro-1.5
python-docutils-0.15
python-awscrt-0.19.18
python-flit-core
python-prompt-toolkit-3.0.28
python-ruamel.yaml
python-cryptography
python-botocore-2.0.0dev155))
(inputs
(list groff
python-colorama-for-awscli
python-docutils-0.15
python-pyyaml
python-rsa))
(build-system pyproject-build-system)
(arguments
`(#:phases (modify-phases %standard-phases
(add-before 'build 'removed-vendored
(lambda* _
(for-each delete-file-recursively
'("awscli/botocore" "awscli/s3transfer"))
(symlink (string-append (assoc-ref %build-inputs
"python-botocore")
"/lib/python"
(python-version (assoc-ref
%build-inputs
"python"))
"/site-packages/botocore")
"awscli/botocore")
(symlink (string-append (assoc-ref %build-inputs
"python-s3transfer")
"/lib/python"
(python-version (assoc-ref
%build-inputs
"python"))
"/site-packages/s3transfer")
"awscli/s3transfer") #t))
(add-after 'install 'generate-completions
`(#:build-backend "backends.pep517"
#:phases (modify-phases %standard-phases
(add-after 'unpack 'use-cryptography-v41
(lambda _
(substitute* '("pyproject.toml")
(("cryptography>=3.3.2,<40.0.2") "cryptography>=3.3.2"))))
(add-after 'unpack 'fix-reference-to-groff
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "awscli/help.py"
(("if not self._exists_on_path\\('groff'\\):") "")
(("raise ExecutableNotFoundError\\('groff'\\)") "")
(("cmdline = \\['groff'")
(string-append "cmdline = ['"
(search-input-file inputs "bin/groff")
"'")))))
(add-after 'install 'install-completions
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(python-version (python-version (assoc-ref inputs
"python")))
(data (string-append out "/lib/python"
python-version
"/site-packages/awscli/data"))
(bash-completion (string-append out
"/share/bash-completion/completions"))
"/share/bash-completion/completions"))
(zsh-site-functions (string-append out
"/share/zsh/site-functions")))
(mkdir-p data)
(add-installed-pythonpath inputs outputs)
(invoke "python" "scripts/gen-ac-index"
"--index-location"
(string-append data "/ac.index"))
"/share/zsh/site-functions")))
(mkdir-p bash-completion)
(call-with-output-file (string-append bash-completion
"/aws")
@ -308,19 +312,21 @@ bindings for Python 3.")
(format port
(string-join (list "complete" "-C"
(string-append out
"/bin/aws_completer")
"/bin/aws_completer")
"aws")))))
(mkdir-p zsh-site-functions)
(rename-file (string-append out
"/bin/aws_zsh_completer.sh")
"/bin/aws_zsh_completer.sh")
(string-append zsh-site-functions "/_aws"))
#t))))
;; FIXME: Tests currently fail
#:tests? #f))
(home-page "https://aws.amazon.com/cli/")
(synopsis "Command line client for AWS v2")
(description "AWS CLI v2 provides a unified command line interface to the
Amazon Web Services (AWS) API.")))
(description "AWS CLI provides a unified command line interface to the
Amazon Web Services (AWS) API.")
(license license:asl2.0)))
(define-public python-jmespath-0.10
(package
@ -344,30 +350,6 @@ Amazon Web Services (AWS) API.")))
(base32
"14nz51cqlnxmgfqqilxyvjwwa5xfivdvlm0d0b1qzgcgwdm7an0f"))))))
(define-public python-ruamel.yaml-0.15
(package
(inherit python-ruamel.yaml)
(name "python-ruamel.yaml")
(version "0.15.100")
(source (origin
(method url-fetch)
(uri (pypi-uri "ruamel.yaml" version))
(sha256
(base32
"1r5j9n2jdq48z0k4bdia1f7krn8f2x3y49i9ba9iks2rg83g6hlf"))))))
(define-public python-cryptography-3.3.2
(package
(inherit python-cryptography)
(name "python-cryptography")
(version "3.3.2")
(source (origin
(method url-fetch)
(uri (pypi-uri "cryptography" version))
(sha256
(base32
"1vcvw4lkw1spiq322pm1256kail8nck6bbgpdxx3pqa905wd6q2s"))))))
(define-public python-awscrt
(package
(name "python-awscrt")
@ -379,8 +361,30 @@ Amazon Web Services (AWS) API.")))
(base32
"1cmfkcv2zzirxsb989vx1hvna9nv24pghcvypl0zaxsjphv97mka"))))
(build-system python-build-system)
(native-inputs `(("cmake" ,cmake)))
(propagated-inputs `(("python-boto3" ,python-boto3)))
(arguments
'(#:tests? #f))
(native-inputs `(,cmake ,gcc-toolchain-10))
; (propagated-inputs `(("python-boto3" ,python-boto3)))
(home-page "https://github.com/awslabs/aws-crt-python")
(synopsis "Common runtime for AWS Python projects")
(description "Common runtime for AWS Python projects")
(license license:asl2.0)))
(define-public python-awscrt-0.19.18
(package
(name "python-awscrt")
(version "0.19.18")
(source (origin
(method url-fetch)
(uri (pypi-uri "awscrt" version))
(sha256
(base32
"17f8j3n9zsywad48pnq1mz6r9i9y7jdcaliy7zm85q5yivynw2rm"))))
(build-system pyproject-build-system)
(arguments
'(#:tests? #f))
(native-inputs `(,cmake))
; (propagated-inputs `(("python-boto3" ,python-boto3)))
(home-page "https://github.com/awslabs/aws-crt-python")
(synopsis "Common runtime for AWS Python projects")
(description "Common runtime for AWS Python projects")
@ -404,6 +408,8 @@ Amazon Web Services (AWS) API.")))
"0lr98h80fgs6kplv52y92pcf1ba4041zq26wdfsfjkg84py9q83a"))))
(propagated-inputs `(("python-awscrt" ,python-awscrt)
("python-jmespath" ,python-jmespath-0.10)
("python-urllib3" ,python-urllib3)
("python-dateutil" ,python-dateutil)
,@(package-propagated-inputs python-awscrt))))))
(define-public python-htmlark

View File

@ -27,14 +27,8 @@
#:use-module (guix git-download)
#:use-module (guix build-system go)
#:use-module (guix build-system trivial)
#:use-module (rekahsoft-gnu packages golang))
(define (search-rekahsoft-gnu-patches patch)
(parameterize ((%patch-path (map (lambda (directory)
(string-append directory
"/rekahsoft-gnu/packages/patches"))
%load-path)))
(search-patches patch)))
#:use-module (rekahsoft-gnu packages golang)
#:use-module (rekahsoft-gnu utils))
;; TODO: Uses vendored dependencies
(define-public terraform-0.13

29
rekahsoft-gnu/utils.scm Normal file
View File

@ -0,0 +1,29 @@
;; (C) Copyright Collin J. Doering 2023
;;
;; This program 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.
;;
;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
;; File: util.scm
;; Author: Collin J. Doering <collin.doering@rekahsoft.ca>
;; Date: Dec 30, 2023
(define-module (rekahsoft-gnu utils)
#:use-module (gnu packages)
#:export (search-rekahsoft-gnu-patches))
(define (search-rekahsoft-gnu-patches patch)
(parameterize ((%patch-path (map (lambda (directory)
(string-append directory
"/rekahsoft-gnu/packages/patches"))
%load-path)))
(search-patches patch)))