diff mbox series

[bug#61680,v2] gnu: podman: Add 'docker' alias script as 'docker' output

Message ID 20230223065633.51256-1-zongyuan.li@c0x0o.me
State New
Headers show
Series [bug#61680,v2] gnu: podman: Add 'docker' alias script as 'docker' output | expand

Commit Message

Zongyuan Li Feb. 23, 2023, 6:56 a.m. UTC
Introduces a output named 'docker' in podman package. This
output provides a 'docker' alias for podman. Since their
cmd interface are identical, this simple script just act
the same as 'alias docker=podman', with some additional
checks and notification.

Changes since v1:

    * Add more details in commit messages
    * Revert style format
    * Add output-synopsis for 'docker' output

* gnu/packages/containers.scm: New 'docker' output for podman
---
 gnu/packages/containers.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

--
2.37.1 (Apple Git-137.1)

Comments

Ludovic Courtès March 2, 2023, 6:35 p.m. UTC | #1
Hi,

Zongyuan Li <zongyuan.li@c0x0o.me> skribis:

> Introduces a output named 'docker' in podman package. This
> output provides a 'docker' alias for podman. Since their
> cmd interface are identical, this simple script just act
> the same as 'alias docker=podman', with some additional
> checks and notification.
>
> Changes since v1:
>
>     * Add more details in commit messages
>     * Revert style format
>     * Add output-synopsis for 'docker' output
>
> * gnu/packages/containers.scm: New 'docker' output for podman

Regarding the commit log, please check ‘git log’ and the “Submitting
Patches” of the manual for convention.  We can tweak that for you if you
want, but basically it’s about describe what has changed, not why.

>  gnu/packages/containers.scm | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/containers.scm b/gnu/packages/containers.scm
> index 272b67c38d..50dfa88421 100644
> --- a/gnu/packages/containers.scm
> +++ b/gnu/packages/containers.scm
> @@ -327,6 +327,9 @@ (define-public podman
>         (file-name (git-file-name name version))))
>
>      (build-system gnu-build-system)
> +    (outputs '("out" "docker"))
> +    (properties
> +      `((output-synopsis "docker" "docker alias for podman")))

Are there downsides to having the ‘docker’ command directly in “out”?

I would prefer that because it’d be more easily discovered.

>      (arguments
>       (list
>        #:make-flags
> @@ -349,7 +352,7 @@ (define-public podman
>                  (invoke "make" "localsystem")
>                  (invoke "make" "remotesystem"))))
>            (add-after 'unpack 'fix-hardcoded-paths
> -            (lambda _
> +            (lambda* (#:key outputs #:allow-other-keys)
>                (substitute* (find-files "libpod" "\\.go")
>                  (("exec.LookPath[(][\"]slirp4netns[\"][)]")
>                   (string-append "exec.LookPath(\""
> @@ -365,7 +368,14 @@ (define-public podman
>                  (("/usr/local/libexec/cni")
>                   (string-append #$(this-package-input "cni-plugins")
>                                  "/bin"))
> -                (("/usr/bin/crun") (which "crun")))))
> +                (("/usr/bin/crun") (which "crun")))
> +              (substitute* "docker"
> +                (("/usr/bin/podman") (string-append (assoc-ref outputs "out")
> +                                                    "/bin/podman")))))
> +          (add-after 'install 'install-docker
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (let* ((docker (assoc-ref outputs "docker")))
> +                (install-file "docker" (string-append docker "/bin")) #t)))

No need for a trailing #t.

Thanks,
Ludo’.
Zongyuan Li March 3, 2023, 6:30 a.m. UTC | #2
Hi,

Thanks for the review, Ludovic

> On Mar 3, 2023, at 02:35, Ludovic Courtès <ludo@gnu.org> wrote:
>
> Regarding the commit log, please check ‘git log’ and the “Submitting
> Patches” of the manual for convention.  We can tweak that for you if you
> want, but basically it’s about describe what has changed, not why.


I will try to fix it in next version, but I’m ok if you want to tweak that.

> Are there downsides to having the ‘docker’ command directly in “out”?
>
> I would prefer that because it’d be more easily discovered.

‘docker’ alias in podman will conflict with the real docker package.
If user wants both podman and docker package installed on their
system, it’s better to put alias in a seperate output.

> No need for a trailing #t.

ACK

Li
diff mbox series

Patch

diff --git a/gnu/packages/containers.scm b/gnu/packages/containers.scm
index 272b67c38d..50dfa88421 100644
--- a/gnu/packages/containers.scm
+++ b/gnu/packages/containers.scm
@@ -327,6 +327,9 @@  (define-public podman
        (file-name (git-file-name name version))))

     (build-system gnu-build-system)
+    (outputs '("out" "docker"))
+    (properties
+      `((output-synopsis "docker" "docker alias for podman")))
     (arguments
      (list
       #:make-flags
@@ -349,7 +352,7 @@  (define-public podman
                 (invoke "make" "localsystem")
                 (invoke "make" "remotesystem"))))
           (add-after 'unpack 'fix-hardcoded-paths
-            (lambda _
+            (lambda* (#:key outputs #:allow-other-keys)
               (substitute* (find-files "libpod" "\\.go")
                 (("exec.LookPath[(][\"]slirp4netns[\"][)]")
                  (string-append "exec.LookPath(\""
@@ -365,7 +368,14 @@  (define-public podman
                 (("/usr/local/libexec/cni")
                  (string-append #$(this-package-input "cni-plugins")
                                 "/bin"))
-                (("/usr/bin/crun") (which "crun")))))
+                (("/usr/bin/crun") (which "crun")))
+              (substitute* "docker"
+                (("/usr/bin/podman") (string-append (assoc-ref outputs "out")
+                                                    "/bin/podman")))))
+          (add-after 'install 'install-docker
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((docker (assoc-ref outputs "docker")))
+                (install-file "docker" (string-append docker "/bin")) #t)))
           (add-after 'install 'install-completions
             (lambda _
               (invoke "make" "install.completions"