diff mbox series

[v2] b4: add recipe

Message ID 20230523164843.1816160-1-tgamblin@baylibre.com
State New
Headers show
Series [v2] b4: add recipe | expand

Commit Message

Trevor Gamblin May 23, 2023, 4:48 p.m. UTC
b4 is a tool for handling email-based patch workflows. It is being
added to help modernize the patchtest tooling, but due to the state of
meta-patchtest and the possibility that others may find it useful, add
it to oe-core instead of that layer.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-devtools/b4/b4_0.12.2.bb         | 35 +++++++++++++++++++
 ...skip-tests-requiring-git-filter-repo.patch | 30 ++++++++++++++++
 meta/recipes-devtools/b4/files/run-ptest      |  3 ++
 5 files changed, 70 insertions(+)
 create mode 100644 meta/recipes-devtools/b4/b4_0.12.2.bb
 create mode 100644 meta/recipes-devtools/b4/files/0001-test_ez-skip-tests-requiring-git-filter-repo.patch
 create mode 100644 meta/recipes-devtools/b4/files/run-ptest
diff mbox series

Patch

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index e99fbe4aef..72145a0a38 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -52,6 +52,7 @@  RECIPE_MAINTAINER:pn-autoconf = "Robert Yang <liezhi.yang@windriver.com>"
 RECIPE_MAINTAINER:pn-autoconf-archive = "Robert Yang <liezhi.yang@windriver.com>"
 RECIPE_MAINTAINER:pn-automake = "Robert Yang <liezhi.yang@windriver.com>"
 RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>"
+RECIPE_MAINTAINER:pn-b4 = "Trevor Gamblin <tgamblin@baylibre.com>"
 RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>"
 RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>"
 RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez <alejandro@enedino.org>"
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index da9153b998..2c9fb3433d 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -7,6 +7,7 @@  PTESTS_FAST = "\
     acl \
     apr-util \
     attr \
+    b4 \
     babeltrace \
     babeltrace2 \
     bc \
diff --git a/meta/recipes-devtools/b4/b4_0.12.2.bb b/meta/recipes-devtools/b4/b4_0.12.2.bb
new file mode 100644
index 0000000000..f222a8b2e5
--- /dev/null
+++ b/meta/recipes-devtools/b4/b4_0.12.2.bb
@@ -0,0 +1,35 @@ 
+SUMMARY = "B4 workflow tools"
+DESCRIPTION = "A tool to work with public-inbox and patch archives"
+HOMEPAGE = "https://git.kernel.org/pub/scm/utils/b4/b4.git/"
+LICENSE = "GPL-2.0-or-later"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+SRC_URI[sha256sum] = "b6f4afd78bf78a28055b389f0909792b1c7805fb3557f5d71efbda3682aabe6e"
+
+inherit python_setuptools_build_meta ptest
+
+SRC_URI += "git://git.kernel.org/pub/scm/utils/b4/b4.git;branch=stable-0.12.y;protocol=https \
+            file://run-ptest \
+            file://0001-test_ez-skip-tests-requiring-git-filter-repo.patch \
+"
+
+SRCREV = "0529d7ae380c46f8006892d8fffb563326e2d131"
+
+RDEPENDS:${PN} += " \
+        ${PYTHON_PN}-mailbox \
+        ${PYTHON_PN}-requests \
+"
+
+RDEPENDS:${PN}-ptest += " \
+        git \
+        ${PYTHON_PN}-pytest \
+        ${PYTHON_PN}-unittest-automake-output \
+"
+
+S = "${WORKDIR}/git"
+
+do_install_ptest() {
+      install -d ${D}${PTEST_PATH}/tests
+      cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-devtools/b4/files/0001-test_ez-skip-tests-requiring-git-filter-repo.patch b/meta/recipes-devtools/b4/files/0001-test_ez-skip-tests-requiring-git-filter-repo.patch
new file mode 100644
index 0000000000..579c31d090
--- /dev/null
+++ b/meta/recipes-devtools/b4/files/0001-test_ez-skip-tests-requiring-git-filter-repo.patch
@@ -0,0 +1,30 @@ 
+From 5b77018e0d5648f519345a682752df91d99a6a09 Mon Sep 17 00:00:00 2001
+From: Trevor Gamblin <tgamblin@baylibre.com>
+Date: Tue, 23 May 2023 11:09:07 -0400
+Subject: [PATCH] test_ez: skip tests requiring git-filter-repo
+
+git-filter-repo isn't available and is difficult to properly add as a
+recipe, so skip b4 ptests that require it to be installed.
+
+Upstream-Status: Inappropriate (oe-specific)
+
+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
+---
+ tests/test_ez.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tests/test_ez.py b/tests/test_ez.py
+index 1b02e7b..059c84c 100644
+--- a/tests/test_ez.py
++++ b/tests/test_ez.py
+@@ -32,6 +32,7 @@ def prepdir(gitdir):
+      ['log', '--format=%ae%n%s%n%b---', 'HEAD~4..'], 'trailers-thread-with-followups-and-tripledash',
+      None),
+ ])
++@pytest.mark.skip(reason="no git-filter-repo")
+ def test_trailers(sampledir, prepdir, mboxf, bundlef, rep, trargs, compareargs, compareout, b4cfg):
+     if b4cfg:
+         b4.MAIN_CONFIG.update(b4cfg)
+-- 
+2.40.1
+
diff --git a/meta/recipes-devtools/b4/files/run-ptest b/meta/recipes-devtools/b4/files/run-ptest
new file mode 100644
index 0000000000..b63c4de0d9
--- /dev/null
+++ b/meta/recipes-devtools/b4/files/run-ptest
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+pytest -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}'