[bug#61682,v3,1/1] gnu: buildah: Add 'buildah' package
Commit Message
gnu: buildah: Add 'buildah' package
Introduce new 'buildah' package
* gnu/packages/containers.scm: New 'buildah' package
---
gnu/packages/containers.scm | 73 +++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
--
2.37.1 (Apple Git-137.1)
Comments
Am Freitag, dem 24.03.2023 um 10:14 +0000 schrieb Zongyuan Li:
> gnu: buildah: Add 'buildah' package
>
> Introduce new 'buildah' package
>
> * gnu/packages/containers.scm: New 'buildah' package
> ---
> gnu/packages/containers.scm | 73
> +++++++++++++++++++++++++++++++++++++
> 1 file changed, 73 insertions(+)
>
> diff --git a/gnu/packages/containers.scm
> b/gnu/packages/containers.scm
> index b316588ea2..c20bcdaba3 100644
> --- a/gnu/packages/containers.scm
> +++ b/gnu/packages/containers.scm
> @@ -406,3 +406,76 @@ (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.1")
> + (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
> +
> "1mcqkz68fjccdla1bgxw57w268a586brm6x28fcm6x425ah0w07h"))))
> + (build-system go-build-system)
> + (arguments
> + (list #:import-path
> "github.com/containers/buildah/cmd/buildah"
> + #:unpack-path "github.com/containers/buildah"
> + ; Some dependencies require go-1.18 to build
> + #:go go-1.18
> + #:tests? #f
#:tests? #f always needs an explanation
> + #:build-flags
> + ; These information is constructed in 'buildah'
> Makefile.
> + #~(list (string-append "-ldflags=-X main.GitCommit="
> +
> "faf0d4fcbaede00f4e615dc5cc2ccc816f240cfe"
I think we should either look towards dropping this flag, or
alternatively let-bind the git commit and use it in the version and
origin as well.
> + " -X main.cniVersion=v1.1.2"))
> + #:install-source? #f
> + #:phases
> + #~(modify-phases %standard-phases
> + (add-after 'unpack 'prepare-install-docs
> + (lambda* (#:key unpack-path #:allow-other-keys)
> + (substitute* (string-append "src/"
> + unpack-path
> + "/docs/Makefile")
> + (("../tests/tools/build/go-md2man")
> + (which "go-md2man")))
> + (substitute* (string-append "src/"
> + unpack-path
> + "/docs/Makefile")
> + (("/usr/local") (string-append #$output)))))
> + (add-after 'build 'build-docs
> + (lambda* (#:key unpack-path #:allow-other-keys)
> + (let*
> + ((doc-path (string-append "src/" unpack-path
> "/docs")))
> + (invoke "make" "-C" doc-path))))
> + (add-after 'install 'install-docs
> + (lambda* (#:key unpack-path #:allow-other-keys)
> + (let*
> + ((doc-path (string-append "src/" unpack-path
> "/docs")))
> + (invoke "make" "-C" doc-path "install")))))))
> + (inputs (list btrfs-progs
> + cni-plugins
> + conmon
> + eudev
> + glib
> + gpgme
> + libassuan
> + libseccomp
> + lvm2
> + runc))
> + (native-inputs
> + (list go-github-com-go-md2man
> + gnu-make
> + pkg-config))
> + (synopsis
> + "Facilitates building Open Container Initiative (OCI) container
> images")
Simplify to "Build Open Container Initiative images"
> + (description
> + "Buildah is an open source, Linux-based tool used to build Open
> Container
Drop open source and Linux-based, they're meaningless filler.
> +Initiative (OCI)-compatible containers. With Buildah, you can use
Use @acronym{OCI, Open Container Initiative}. Avoid invoking the
department of redundancy department, also known as the redundant
acronym syndrome syndrome.
> your
> +favorite tools to create efficient container images from an existing
> base image
> +or from scratch using an empty image.")
This second sentence is still as empty as the first time I reviewed it.
Consider dropping it as well.
Cheers
Tests of buildah requires root user to run. Is there any way for us to do that?
Thanks
Am Samstag, dem 25.03.2023 um 09:15 +0000 schrieb Zongyuan Li:
> Tests of buildah requires root user to run. Is there any way for us
> to do that?
Can we try with fakeroot or something?
> On Mar 25, 2023, at 18:46, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:
>
> Can we try with fakeroot or something?
I did some research on source code, and find following code under buildah tests:
> func failTestIfNotRoot(t *testing.T) {
> u, err := user.Current()
> if err != nil {
> t.Log("Could not determine user. Running without root may cause tests to fail")
> } else if u.Uid != "0" {
> t.Fatal("tests will fail unless run as root")
> }
> }
There’s an hard coded uid. I haven’t seen any way to workaround it. Do we have any
facility to run ‘check’ phase under an isolated environment(eg. container)?
Thanks
@@ -406,3 +406,76 @@ (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.1")
+ (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
+ "1mcqkz68fjccdla1bgxw57w268a586brm6x28fcm6x425ah0w07h"))))
+ (build-system go-build-system)
+ (arguments
+ (list #:import-path "github.com/containers/buildah/cmd/buildah"
+ #:unpack-path "github.com/containers/buildah"
+ ; Some dependencies require go-1.18 to build
+ #:go go-1.18
+ #:tests? #f
+ #:build-flags
+ ; These information is constructed in 'buildah' Makefile.
+ #~(list (string-append "-ldflags=-X main.GitCommit="
+ "faf0d4fcbaede00f4e615dc5cc2ccc816f240cfe"
+ " -X main.cniVersion=v1.1.2"))
+ #:install-source? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'prepare-install-docs
+ (lambda* (#:key unpack-path #:allow-other-keys)
+ (substitute* (string-append "src/"
+ unpack-path
+ "/docs/Makefile")
+ (("../tests/tools/build/go-md2man")
+ (which "go-md2man")))
+ (substitute* (string-append "src/"
+ unpack-path
+ "/docs/Makefile")
+ (("/usr/local") (string-append #$output)))))
+ (add-after 'build 'build-docs
+ (lambda* (#:key unpack-path #:allow-other-keys)
+ (let*
+ ((doc-path (string-append "src/" unpack-path "/docs")))
+ (invoke "make" "-C" doc-path))))
+ (add-after 'install 'install-docs
+ (lambda* (#:key unpack-path #:allow-other-keys)
+ (let*
+ ((doc-path (string-append "src/" unpack-path "/docs")))
+ (invoke "make" "-C" doc-path "install")))))))
+ (inputs (list btrfs-progs
+ cni-plugins
+ conmon
+ eudev
+ glib
+ gpgme
+ libassuan
+ libseccomp
+ lvm2
+ runc))
+ (native-inputs
+ (list go-github-com-go-md2man
+ gnu-make
+ pkg-config))
+ (synopsis
+ "Facilitates building Open Container Initiative (OCI) container images")
+ (description
+ "Buildah is an open source, Linux-based tool used to build Open Container
+Initiative (OCI)-compatible containers. With Buildah, you can use your
+favorite tools to create efficient container images from an existing base image
+or from scratch using an empty image.")
+ (home-page "https://buildah.io")
+ (license license:asl2.0)))