git: a1bafc8ceb32 - main - sysutils/podman: update to 4.5.1

From: Doug Rabson <dfr_at_FreeBSD.org>
Date: Mon, 12 Jun 2023 10:10:14 UTC
The branch main has been updated by dfr:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a1bafc8ceb32b7ac669cf47d4763fc7eff407f63

commit a1bafc8ceb32b7ac669cf47d4763fc7eff407f63
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2023-06-04 13:22:54 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2023-06-12 10:07:49 +0000

    sysutils/podman: update to 4.5.1
    
    Approved-by:    dch
---
 sysutils/podman/Makefile                           |  9 +++--
 sysutils/podman/distinfo                           |  6 +--
 .../podman/files/patch-libpod_container__api.go    | 19 ----------
 sysutils/podman/files/podman.in                    | 43 ++++++++++++++++++++++
 sysutils/podman/pkg-message                        |  8 ++++
 sysutils/podman/pkg-plist                          |  6 +++
 6 files changed, 65 insertions(+), 26 deletions(-)

diff --git a/sysutils/podman/Makefile b/sysutils/podman/Makefile
index 271647a2cf49..ec13bac51382 100644
--- a/sysutils/podman/Makefile
+++ b/sysutils/podman/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	podman
 DISTVERSIONPREFIX=	v
-DISTVERSION=	4.4.2
-PORTREVISION=	1
+DISTVERSION=	4.5.1
 CATEGORIES=	sysutils
 
 MAINTAINER=	dfr@FreeBSD.org
@@ -20,8 +19,10 @@ RUN_DEPENDS=	conmon:sysutils/conmon \
 		ocijail:sysutils/ocijail
 
 USES=		gmake go:no_targets pkgconfig python:3.7+,build shebangfix
+USE_RC_SUBR=	podman
 
 SHEBANG_FILES=	${WRKSRC}/hack/markdown-preprocess
+MAKE_ARGS=	SHELL=${LOCALBASE}/bin/bash
 
 # Parallel builds are flaky due to some kind of file race in the
 # markdown-preprocess phase of the docs build.
@@ -35,8 +36,8 @@ INSTALL_TARGET=	install install.completions
 
 # Temporary until https://github.com/containers/podman/pull/16422 lands
 do-install:
-	${GMAKE} -C ${WRKSRC} DESTDIR=${STAGEDIR} GO=${GO_CMD} install
-	${GMAKE} -C ${WRKSRC} DESTDIR=${STAGEDIR} GO=${GO_CMD} install.completions
+	${GMAKE} -C ${WRKSRC} ${MAKE_ARGS} DESTDIR=${STAGEDIR} GO=${GO_CMD} install
+	${GMAKE} -C ${WRKSRC} ${MAKE_ARGS} DESTDIR=${STAGEDIR} GO=${GO_CMD} install.completions
 	${RM} ${STAGEDIR}${PREFIX}/lib/tmpfiles.d/podman.conf
 
 .include <bsd.port.mk>
diff --git a/sysutils/podman/distinfo b/sysutils/podman/distinfo
index 3fb40bc89c3d..2682cd62e28e 100644
--- a/sysutils/podman/distinfo
+++ b/sysutils/podman/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1678027489
-SHA256 (containers-podman-v4.4.2_GH0.tar.gz) = 59cec158438efa8a3e651b19e150d9afd90f7e3f07c30605a997e18b8c54b67c
-SIZE (containers-podman-v4.4.2_GH0.tar.gz) = 14401422
+TIMESTAMP = 1685884846
+SHA256 (containers-podman-v4.5.1_GH0.tar.gz) = ee2c8b02b7fe301057f0382637b995a9c6c74e8d530692d6918e4c509ade6e39
+SIZE (containers-podman-v4.5.1_GH0.tar.gz) = 17425208
diff --git a/sysutils/podman/files/patch-libpod_container__api.go b/sysutils/podman/files/patch-libpod_container__api.go
deleted file mode 100644
index b6573d8a5467..000000000000
--- a/sysutils/podman/files/patch-libpod_container__api.go
+++ /dev/null
@@ -1,19 +0,0 @@
---- libpod/container_api.go.orig	2023-02-23 15:59:21 UTC
-+++ libpod/container_api.go
-@@ -788,10 +788,12 @@ func (c *Container) Cleanup(ctx context.Context) error
- 
- 	// make sure all the container processes are terminated if we are running without a pid namespace.
- 	hasPidNs := false
--	for _, i := range c.config.Spec.Linux.Namespaces {
--		if i.Type == spec.PIDNamespace {
--			hasPidNs = true
--			break
-+	if c.config.Spec.Linux != nil {
-+		for _, i := range c.config.Spec.Linux.Namespaces {
-+			if i.Type == spec.PIDNamespace {
-+				hasPidNs = true
-+				break
-+			}
- 		}
- 	}
- 	if !hasPidNs {
diff --git a/sysutils/podman/files/podman.in b/sysutils/podman/files/podman.in
new file mode 100755
index 000000000000..89c5a95d4a8f
--- /dev/null
+++ b/sysutils/podman/files/podman.in
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# Podman startup script - start all containers with restart policy set to always.
+
+# PROVIDE: podman
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following to /etc/rc.conf[.local] to enable this service
+#
+# podman_enable:	Set to NO by default.
+#			Set it to YES to restart containers after restart
+# podman_flags:		Extra flags for podman command (e.g. to set logging level)
+#
+
+. /etc/rc.subr
+
+name=podman
+rcvar=${name}_enable
+
+: ${podman_enable:=NO}
+: ${podman_flags:="--noout"}
+
+podman=%%PREFIX%%/bin/${name}
+start_cmd="podman_start"
+stop_cmd="podman_stop"
+restart_cmd="podman_stop && podman_start"
+
+podman_start()
+{
+    ${podman} ${podman_flags} start --all --filter restart-policy=always
+}
+
+podman_stop()
+{
+    list=$(${podman} container ls --filter restart-policy=always -q)
+    if [ -n "${list}" ]; then
+        ${podman} ${podman_flags} stop ${list}
+    fi
+}
+
+load_rc_config ${name}
+run_rc_command "$1"
diff --git a/sysutils/podman/pkg-message b/sysutils/podman/pkg-message
index 30efe34d4a9c..15ff22867c14 100644
--- a/sysutils/podman/pkg-message
+++ b/sysutils/podman/pkg-message
@@ -2,3 +2,11 @@ The FreeBSD port of the podman container engine is experimental and should be
 used for evaluation and testing purposes only.
 
 $ sudo podman run --rm docker.io/dougrabson/hello
+
+podman can restart containers after a host is rebooted. To enable this, use:
+
+$ sudo sysrc podman_enable=YES
+
+and start the container with a restart policy:
+
+$ sudo podman run -d --restart=always myimage
diff --git a/sysutils/podman/pkg-plist b/sysutils/podman/pkg-plist
index 66d6957c1929..6ed5aee4644f 100644
--- a/sysutils/podman/pkg-plist
+++ b/sysutils/podman/pkg-plist
@@ -107,6 +107,8 @@ share/man/man1/podman-machine-init.1.gz
 share/man/man1/podman-machine-inspect.1.gz
 share/man/man1/podman-machine-list.1.gz
 share/man/man1/podman-machine-ls.1.gz
+share/man/man1/podman-machine-os-apply.1.gz
+share/man/man1/podman-machine-os.1.gz
 share/man/man1/podman-machine-rm.1.gz
 share/man/man1/podman-machine-set.1.gz
 share/man/man1/podman-machine-ssh.1.gz
@@ -132,6 +134,7 @@ share/man/man1/podman-network-ls.1.gz
 share/man/man1/podman-network-prune.1.gz
 share/man/man1/podman-network-reload.1.gz
 share/man/man1/podman-network-rm.1.gz
+share/man/man1/podman-network-update.1.gz
 share/man/man1/podman-network.1.gz
 share/man/man1/podman-pause.1.gz
 share/man/man1/podman-play-kube.1.gz
@@ -165,6 +168,7 @@ share/man/man1/podman-run.1.gz
 share/man/man1/podman-save.1.gz
 share/man/man1/podman-search.1.gz
 share/man/man1/podman-secret-create.1.gz
+share/man/man1/podman-secret-exists.1.gz
 share/man/man1/podman-secret-inspect.1.gz
 share/man/man1/podman-secret-ls.1.gz
 share/man/man1/podman-secret-rm.1.gz
@@ -210,5 +214,7 @@ share/man/man1/podman-volume-unmount.1.gz
 share/man/man1/podman-volume.1.gz
 share/man/man1/podman-wait.1.gz
 share/man/man1/podman.1.gz
+share/man/man5/quadlet.5.gz
+share/man/man5/podman-systemd.unit.5.gz
 share/zsh/site-functions/_podman
 share/zsh/site-functions/_podman-remote