Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Brandon Maier <brandon.maier@collins.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v3 1/4] package/bats-support: new package
Date: Sun, 5 May 2024 11:21:40 +0200	[thread overview]
Message-ID: <ZjdPpKQw4Z1sKwi9@landeda> (raw)
In-Reply-To: <20240503020000.3168109-1-brandon.maier@collins.com>

Brandon, All,

On 2024-05-03 01:59 +0000, Brandon Maier via buildroot spake thusly:
> 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>
> ---
[--SNIP--]
> diff --git a/package/Config.in b/package/Config.in
> index 38e9c94198..f1da714418 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"

While this looks like the thing to do, including the bats sub-packages
from here is sub-optimal. Indeed, when all the series is applied, the
menuconfig will look something like:

    [ ] bats-assert (NEW)
    [*] bats
    [ ]   bats-file (NEW)
    [ ]   bats-support (NEW)

This is not very nice-looking.

Instead, I've moved the 'source' statements to the bats-core package
itself (elided for brevity; check the actual package for exact code):

    config BR2_PACKAGE_BATS_CORE
        bool "bats-core"

    if BR2_PACKAGE_BATS_CORE

    source "package/bats-assert/Config.in"
    source "package/bats-file/Config.in"
    source "package/bats-support/Config.in"

    endif

Now the menuconfig looks nicer:

    [*] bats
    [ ]   bats-assert (NEW)
    [ ]   bats-file (NEW)
    [ ]   bats-support (NEW)

As a consequence of the includes now being guarded by the if-endif
conditional block, the dependency on bats-core is no longer needed on
each package, so I also dropped it.

Series applied to master with this little cleanup, thanks!

Regards,
Yann E. MORIN.

>  	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..765e08ffce
> --- /dev/null
> +++ b/package/bats-support/bats-support.mk
> @@ -0,0 +1,18 @@
> +################################################################################
> +#
> +# 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) -d -m 0755 $(TARGET_DIR)/usr/lib/bats/bats-support/src
> +	$(INSTALL) -m 0755 $(@D)/*.bash -t $(TARGET_DIR)/usr/lib/bats/bats-support
> +	$(INSTALL) -m 0755 $(@D)/src/*.bash -t $(TARGET_DIR)/usr/lib/bats/bats-support/src
> +endef
> +
> +$(eval $(generic-package))
> -- 
> 2.44.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2024-05-05  9:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 21:08 [Buildroot] [PATCH 1/4] package/bats-core: bump to version 1.11.0 Brandon Maier via buildroot
2024-04-12 21:08 ` [Buildroot] [PATCH 2/4] package/bats-support: add bats support library Brandon Maier via buildroot
2024-04-12 21:08 ` [Buildroot] [PATCH 3/4] package/bats-assert: add bats-assert library Brandon Maier via buildroot
2024-04-12 21:08 ` [Buildroot] [PATCH 4/4] package/bats-file: add bats-file library Brandon Maier via buildroot
2024-04-25 19:58 ` [Buildroot] [PATCH v2 1/4] package/bats-core: bump to version 1.11.0 Brandon Maier via buildroot
2024-05-01 21:09   ` Thomas Petazzoni via buildroot
2024-05-03  1:59   ` [Buildroot] [PATCH v3 1/4] package/bats-support: new package Brandon Maier via buildroot
2024-05-03  1:59     ` [Buildroot] [PATCH v3 2/4] package/bats-assert: " Brandon Maier via buildroot
2024-05-03  1:59     ` [Buildroot] [PATCH v3 3/4] package/bats-file: " Brandon Maier via buildroot
2024-05-03  2:00     ` [Buildroot] [PATCH v3 4/4] support/testing: add bats runtime test Brandon Maier via buildroot
2024-05-05  9:21     ` Yann E. MORIN [this message]
2024-04-25 19:58 ` [Buildroot] [PATCH v2 2/4] package/bats-support: add bats support library Brandon Maier via buildroot
2024-05-01 21:13   ` Thomas Petazzoni via buildroot
2024-05-03  2:01     ` [Buildroot] [External] " Maier, Brandon L Collins via buildroot
2024-04-25 19:58 ` [Buildroot] [PATCH v2 3/4] package/bats-assert: add bats-assert library Brandon Maier via buildroot
2024-04-25 19:58 ` [Buildroot] [PATCH v2 4/4] package/bats-file: add bats-file library Brandon Maier via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjdPpKQw4Z1sKwi9@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=brandon.maier@collins.com \
    --cc=buildroot@buildroot.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox