From 4d04809a324c5af27a91f1f188ab3c6556bd625a Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 7 Sep 2022 10:51:56 +0200
Subject: [PATCH 1/3] buildah: add recipe for buildah v1.26

This recipe was imported from meta-virtualization/master, revision
13839c7b135f94803534d67271b953a1b152699e. A backport to kirkstone was
proposed[1] but it might not be deemed resonable[2] for a stable branch.

[1] https://lists.yoctoproject.org/g/meta-virtualization/message/7596
[2] https://lists.yoctoproject.org/g/meta-virtualization/message/7603

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../recipes-containers/buildah/buildah_git.bb | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 meta-oniro-staging/recipes-containers/buildah/buildah_git.bb

diff --git a/meta-oniro-staging/recipes-containers/buildah/buildah_git.bb b/meta-oniro-staging/recipes-containers/buildah/buildah_git.bb
new file mode 100644
index 00000000..024e82c1
--- /dev/null
+++ b/meta-oniro-staging/recipes-containers/buildah/buildah_git.bb
@@ -0,0 +1,57 @@
+HOMEPAGE = "https://buildah.io"
+SUMMARY = "A tool that facilitates building OCI container images."
+DESCRIPTION = "A tool that facilitates building OCI container images."
+
+# Apache-2.0 for containerd
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/github.com/containers/buildah/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
+
+S = "${WORKDIR}/git"
+
+BUILDAH_VERSION = "1.26"
+SRCREV_buildah = "0a9d6e6eaef2e2e7936313d449a4e226022eb865"
+
+PV = "${BUILDAH_VERSION}"
+
+inherit go
+inherit goarch
+inherit pkgconfig
+
+GO_IMPORT = "github.com/containers/buildah"
+GO_INSTALL = "${GO_IMPORT}"
+GO_WORKDIR = "${GO_INSTALL}"
+GOBUILDFLAGS += "-mod vendor"
+
+SRC_URI = " \
+    git://github.com/containers/buildah;branch=release-${BUILDAH_VERSION};name=buildah;protocol=https \
+    "
+
+DEPENDS = "libdevmapper btrfs-tools gpgme"
+RDEPENDS:${PN} = "cgroup-lite fuse-overlayfs libdevmapper podman"
+RDEPENDS:${PN}-dev = "bash perl"
+
+do_compile:prepend() {
+    cd ${S}/src/github.com/containers/buildah
+}
+
+go_do_compile() {
+        export TMPDIR="${GOTMPDIR}"
+        if [ -n "${GO_INSTALL}" ]; then
+                if [ -n "${GO_LINKSHARED}" ]; then
+                        ${GO} install ${GOBUILDFLAGS} ./cmd/buildah
+                        ${GO} install ${GOBUILDFLAGS} ./tests/imgtype/imgtype.go
+                        ${GO} install ${GOBUILDFLAGS} ./tests/copy/copy.go
+                        rm -rf ${B}/bin
+                fi
+                ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} ./cmd/buildah
+                ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} ./tests/imgtype/imgtype.go
+                ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} ./tests/copy/copy.go
+        fi
+}
+
+do_install:append() {
+    dest_dir=${D}/${sysconfdir}/containers
+    mkdir -p ${dest_dir}
+    install -m 666 ${S}/src/github.com/containers/buildah/docs/samples/registries.conf ${dest_dir}/buildah.registries.conf.sample
+    install -m 666 ${S}/src/github.com/containers/buildah/tests/policy.json ${dest_dir}/buildah.policy.json.sample
+}
-- 
GitLab


From 4865171fabfb622ad65e65c05b41a2d0bf853cc7 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 7 Sep 2022 10:56:02 +0200
Subject: [PATCH 2/3] catatonit: Integrate version 0.1.7

This is useful for podman system tests.

The recipe was proposed for meta-virtualization kirkstone[1] but it
might not be deemed resonable[2] for a stable branch.

[1] https://lists.yoctoproject.org/g/meta-virtualization/message/7597
[2] https://lists.yoctoproject.org/g/meta-virtualization/message/7603

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../catatonit/catatonit_0.1.7.bb                 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 meta-oniro-staging/recipes-containers/catatonit/catatonit_0.1.7.bb

diff --git a/meta-oniro-staging/recipes-containers/catatonit/catatonit_0.1.7.bb b/meta-oniro-staging/recipes-containers/catatonit/catatonit_0.1.7.bb
new file mode 100644
index 00000000..da3973de
--- /dev/null
+++ b/meta-oniro-staging/recipes-containers/catatonit/catatonit_0.1.7.bb
@@ -0,0 +1,16 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: MIT
+
+SUMMARY = "A container init that is so simple it's effectively brain-dead."
+HOMEPAGE = "https://github.com/openSUSE/catatonit"
+DESCRIPTION = "${SUMMARY}"
+SECTION = "base"
+LICENSE = "GPL-3.0-or-later"
+LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464"
+
+SRC_URI = "git://github.com/openSUSE/${BPN};protocol=https;branch=main"
+SRCREV = "d8d72fea155c144ed3bf298a35a1aba5625a5656"
+S = "${WORKDIR}/git"
+
+inherit autotools
-- 
GitLab


From 6e63a66e306979e13f08fdb08351d87c038682c9 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 7 Sep 2022 10:59:12 +0200
Subject: [PATCH 3/3] podman: Add ptest support for system tests

The recipe was proposed for meta-virtualization kirkstone[1] but it
might not be deemed resonable[2] for a stable branch.

[1] https://lists.yoctoproject.org/g/meta-virtualization/message/7598
[2] https://lists.yoctoproject.org/g/meta-virtualization/message/7603

Fixes: https://gitlab.eclipse.org/eclipse/oniro-core/oniro/-/issues/21

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../podman/podman/run-ptest                   | 13 ++++++++
 .../podman/podman_git.bbappend                | 33 +++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 meta-oniro-staging/recipes-containers/podman/podman/run-ptest
 create mode 100644 meta-oniro-staging/recipes-containers/podman/podman_git.bbappend

diff --git a/meta-oniro-staging/recipes-containers/podman/podman/run-ptest b/meta-oniro-staging/recipes-containers/podman/podman/run-ptest
new file mode 100644
index 00000000..108ff451
--- /dev/null
+++ b/meta-oniro-staging/recipes-containers/podman/podman/run-ptest
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: MIT
+
+#
+# Podman system tests
+#
+
+# The system tests don't need any go related variables. Dummy-define them to
+# avoid useless warnings/errors.
+GOOS=undefined GO=true BUILDTAGS= make localsystem
diff --git a/meta-oniro-staging/recipes-containers/podman/podman_git.bbappend b/meta-oniro-staging/recipes-containers/podman/podman_git.bbappend
new file mode 100644
index 00000000..9646b9fa
--- /dev/null
+++ b/meta-oniro-staging/recipes-containers/podman/podman_git.bbappend
@@ -0,0 +1,33 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: MIT
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://run-ptest"
+
+inherit ptest
+
+do_install_ptest () {
+	cp ${S}/src/import/Makefile ${D}${PTEST_PATH}
+	install -d ${D}${PTEST_PATH}/test
+	cp -r ${S}/src/import/test/system ${D}${PTEST_PATH}/test
+
+	# Some compatibility links for the Makefile assumptions.
+	install -d ${D}${PTEST_PATH}/bin
+	ln -s ${bindir}/podman ${D}${PTEST_PATH}/bin/podman
+	ln -s ${bindir}/podman-remote ${D}${PTEST_PATH}/bin/podman-remote
+}
+
+RDEPENDS:${PN}-ptest += " \
+	bash \
+	bats \
+	buildah \
+	catatonit \
+	coreutils \
+	file \
+	gnupg \
+	jq \
+	make \
+	tar \
+"
-- 
GitLab