Subject: [bug#61682] [PATCH v2] gnu: buildah: Add 'buildah' package

From: Zongyuan Li <[email-masked]>
Date: Fri, 24 Feb 2023 07:12:55 +0000

Thanks your review! I will try to use go-build-system.

I noticed that ‘podman’ package also uses makefile. Maybe we could improve that later too?

Li

> On Feb 24, 2023, at 13:20, Liliana Marie Prikler <[email-masked]> wrote:
>
> Am Donnerstag, dem 23.02.2023 um 12:26 +0000 schrieb Zongyuan Li:
>> Introduce new 'buildah' package
>>
>> Changes since v1:
>>
>>    * fix phase-name typo in modify-phases
>>
>> * gnu/packages/containers.scm: New 'buildah' package
>> ---
>>  gnu/packages/containers.scm | 68
>> +++++++++++++++++++++++++++++++++++++
>>  1 file changed, 68 insertions(+)
>>
>> diff --git a/gnu/packages/containers.scm
>> b/gnu/packages/containers.scm
>> index 50dfa88421..3844e4e700 100644
>> --- a/gnu/packages/containers.scm
>> +++ b/gnu/packages/containers.scm
>> @@ -41,6 +41,7 @@ (define-module (gnu packages containers)
>>    #:use-module (gnu packages gnupg)
>>    #:use-module (gnu packages golang)
>>    #:use-module (gnu packages linux)
>> +  #:use-module (gnu packages perl)
>>    #:use-module (gnu packages python)
>>    #:use-module (gnu packages networking)
>>    #:use-module (gnu packages pkg-config)
>> @@ -406,3 +407,70 @@ (define-public podman
>>  volumes mounted into those containers, and pods made from groups of
>>  containers.")
>>      (license license:asl2.0)))
>> +
>> +(define-public buildah
>> +  (package
>> +    (name "buildah")
>> +    (version "1.29.0")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/containers/buildah")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +
>> "16kc19m5in819624c3np4aqb9hkjc93d34y4958jqy1k3p2p5rir"))))
>> +    (build-system gnu-build-system)
> As fun as it sounds to build Go stuff with just a Makefile, you have a
> lot of vendored code unaccounted for.
>> +    (arguments
>> +     (list #:make-flags #~(list #$(string-append "CC="
>> +                                                 (cc-for-target))
>> +                                (string-append "PREFIX="
>> +                                               #$output))
>> +           #:tests? #f
>> +           #:phases #~(modify-phases %standard-phases
>> +                        (delete 'configure)
>> +                        (add-after 'unpack 'set-env
>> +                          (lambda* (#:key inputs #:allow-other-keys)
>> +                            (setenv "HOME" "/tmp")))
>> +                        (add-after 'unpack 'avoid-building-tools
>> +                          (lambda _
>> +                            (substitute* "Makefile"
>> +                              (("^docs: install\\.tools")
>> +                               "docs:"))))
>> +                        (add-after 'unpack 'avoid-unnecessary-
>> targets
>> +                          (lambda _
>> +                            (substitute* "Makefile"
>> +                              (("^all: .*")
>> +                               "all: bin/buildah docs"))))
>> +                        (add-after 'unpack 'use-doc-tools
>> +                          (lambda _
>> +                            (substitute* "docs/Makefile"
>> +                              (("../tests/tools/build/go-md2man")
>> +                               (which "go-md2man")))))
>> +                        (add-after 'install 'install-completions
>> +                          (lambda _
>> +                            (invoke "make" "install.completions"
>> +                                    (string-append "PREFIX="
>> +                                                   #$output)))))))
>> +    (inputs (list btrfs-progs
>> +                  cni-plugins
>> +                  conmon
>> +                  eudev
>> +                  glib
>> +                  go-github-com-go-md2man
>> +                  gpgme
>> +                  libassuan
>> +                  libseccomp
>> +                  lvm2
>> +                  runc))
>> +    (native-inputs (list bats git go-1.18 perl pkg-config))
>> +    (synopsis
>> +     "Facilitates building Open Container Initiative (OCI) container
>> images")
> Try to stay short in your synopsis.
>> +    (description
>> +     "Buildah is an open source,
> Buzzword.
>> Linux-based tool used to build Open Container
>> +Initiative (OCI)-compatible containers.
> Perhaps use @abbrev?
>
>> With Buildah, you can use your
>> +favorite tools to create efficient container images from an existing
>> base image
> Can I use Guix to do that?
>
> Cheers