diff mbox series

[2/4] package/bats-support: add bats support library

Message ID 20240412210850.17265-2-brandon.maier@collins.com
State Superseded
Headers show
Series [1/4] package/bats-core: bump to version 1.11.0 | expand

Commit Message

Brandon Maier April 12, 2024, 9:08 p.m. UTC
This library provides support functions needed by the bats-assert and
bats-file libraries.

This library does not provide an installer. Manually install the files
under /usr/lib/bats/bats-support which is what the Arch Linux package
does[1]. This makes the library loadable using `bats_load_library`[2].

[1] https://gitlab.archlinux.org/archlinux/packaging/packages/bats-support/-/blob/main/PKGBUILD?ref_type=heads
[2] https://bats-core.readthedocs.io/en/stable/writing-tests.html#bats-load-library-load-system-wide-libraries

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
 DEVELOPERS                             |  1 +
 package/Config.in                      |  1 +
 package/bats-support/Config.in         |  8 ++++++++
 package/bats-support/bats-support.hash |  5 +++++
 package/bats-support/bats-support.mk   | 17 +++++++++++++++++
 5 files changed, 32 insertions(+)
 create mode 100644 package/bats-support/Config.in
 create mode 100644 package/bats-support/bats-support.hash
 create mode 100644 package/bats-support/bats-support.mk
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff..846dc987a4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -540,6 +540,7 @@  F:	package/ncdu/
 N:	Brandon Maier <brandon.maier@collins.com>
 F:	board/freescale/ls1046a-frwy/
 F:	configs/ls1046a-frwy_defconfig
+F:	package/bats-support/
 F:	package/python-pysensors/
 F:	package/qoriq-fm-ucode/
 F:	package/unifdef/
diff --git a/package/Config.in b/package/Config.in
index 1935077f0f..eef0ccc588 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -170,6 +170,7 @@  endmenu
 menu "Development tools"
 	source "package/avocado/Config.in"
 	source "package/bats-core/Config.in"
+	source "package/bats-support/Config.in"
 	source "package/binutils/Config.in"
 	source "package/bitwise/Config.in"
 	source "package/bsdiff/Config.in"
diff --git a/package/bats-support/Config.in b/package/bats-support/Config.in
new file mode 100644
index 0000000000..24b49cee1d
--- /dev/null
+++ b/package/bats-support/Config.in
@@ -0,0 +1,8 @@ 
+config BR2_PACKAGE_BATS_SUPPORT
+	bool "bats-support"
+	depends on BR2_PACKAGE_BATS_CORE # runtime
+	help
+	  bats-support is a supporting library providing common
+	  functions to test helper libraries written for Bats.
+
+	  https://github.com/bats-core/bats-support
diff --git a/package/bats-support/bats-support.hash b/package/bats-support/bats-support.hash
new file mode 100644
index 0000000000..847f39e7c7
--- /dev/null
+++ b/package/bats-support/bats-support.hash
@@ -0,0 +1,5 @@ 
+# Locally calculated
+sha256  7815237aafeb42ddcc1b8c698fc5808026d33317d8701d5ec2396e9634e2918f  bats-support-0.3.0.tar.gz
+
+# License files
+sha256  36ffd9dc085d529a7e60e1276d73ae5a030b020313e6c5408593a6ae2af39673  LICENSE
diff --git a/package/bats-support/bats-support.mk b/package/bats-support/bats-support.mk
new file mode 100644
index 0000000000..840aa52046
--- /dev/null
+++ b/package/bats-support/bats-support.mk
@@ -0,0 +1,17 @@ 
+################################################################################
+#
+# bats-support
+#
+################################################################################
+
+BATS_SUPPORT_VERSION = 0.3.0
+BATS_SUPPORT_SITE = $(call github,bats-core,bats-support,v$(BATS_SUPPORT_VERSION))
+BATS_SUPPORT_LICENSE = CC0-1.0
+BATS_SUPPORT_LICENSE_FILES = LICENSE
+
+define BATS_SUPPORT_INSTALL_TARGET_CMDS
+	install -Dm 0644 $(@D)/*.bash -t "$(TARGET_DIR)/usr/lib/bats/bats-support"
+	install -Dm 0644 $(@D)/src/*.bash -t "$(TARGET_DIR)/usr/lib/bats/bats-support/src"
+endef
+
+$(eval $(generic-package))