Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH RFC 1/3] package/pkg-generic.mk: support hooks and tables in virtual packages
Date: Thu, 31 Oct 2019 21:15:01 +0100	[thread overview]
Message-ID: <20191031201501.GA2553@scaer> (raw)
In-Reply-To: <20191030132759.8643-2-unixmania@gmail.com>

Carlos, All,

On 2019-10-30 10:27 -0300, unixmania at gmail.com spake thusly:
> From: Carlos Santos <unixmania@gmail.com>
> 
> Virtual packages are not built but it's useful to allow them to have
> permission/device/user tables and target-finalize/rootfs-pre-cmd hooks.

Agreed, that would be nice to deduplicate such things.

> With this change we don't need to replicate date as currently done in

What do you mean by "date"?

> eudev and systemd user tables or test if the package is selected to add
> a target-finalize hook as in luainterpreter.
> 
> Signed-off-by: Carlos Santos <unixmania@gmail.com>
> ---
>  package/pkg-generic.mk | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index 893faba22a..7b3f1646ae 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -930,6 +930,7 @@ $$($(2)_TARGET_DIRCLEAN):		PKG=$(2)
>  # Compute the name of the Kconfig option that correspond to the
>  # package being enabled. We handle three cases: the special Linux
>  # kernel case, the bootloaders case, and the normal packages case.
> +# Virtual packages are handled separately (see below).
>  ifeq ($(1),linux)
>  $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
>  else ifneq ($$(filter boot/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/boot/%),$(pkgdir)),)
> @@ -1118,6 +1119,22 @@ ifneq ($$($(2)_HELP_CMDS),)
>  HELP_PACKAGES += $(2)
>  endif
>  
> +# Virtual packages are not built but it's useful to allow them to have
> +# permission/device/user tables and target-finalize/rootfs-pre-cmd hooks.
> +else ifeq ($$(BR2_PACKAGE_HAS_$(2)),y) # $(2)_KCONFIG_VAR

Actually, I think that virtual packages should instead also be "nornal"
packages, so that they use the standard code path. By "normal" package,
I mean they should also have a BR2_PACKAGE_FOO option in addition to the
BR2_PACKAGE_HAS_FOO option.

For example, we already have one virtual package that is both normal and
virtual: the skeleton package has both BR2_PACKAGE_HAS_SKELETON and
BR2_PACKAGE_SKELETON.

pkg-virtual.mk is probably the place to make that systematic, something
like:

    BR2_PACKAGE_$(2) = $$(BR2_PACKAGE_HAS_$(2))

... so that virtual packages do not have to all repeat the variable...

Unless there is a big road-block that prevents virtual package to be
treated as normal packages...

Regards,
Yann E. MORIN.

> +ifneq ($$($(2)_PERMISSIONS),)
> +PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep)
> +endif
> +ifneq ($$($(2)_DEVICES),)
> +PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep)
> +endif
> +ifneq ($$($(2)_USERS),)
> +PACKAGES_USERS += $$($(2)_USERS)$$(sep)
> +endif
> +TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS)
> +ROOTFS_PRE_CMD_HOOKS += $$($(2)_ROOTFS_PRE_CMD_HOOKS)
> +
>  endif # $(2)_KCONFIG_VAR
>  endef # inner-generic-package
>  
> -- 
> 2.18.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/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.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2019-10-31 20:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 13:27 [Buildroot] [PATCH RFC 0/3] support hooks and tables in virtual packages unixmania at gmail.com
2019-10-30 13:27 ` [Buildroot] [PATCH RFC 1/3] package/pkg-generic.mk: " unixmania at gmail.com
2019-10-31 20:15   ` Yann E. MORIN [this message]
2019-10-31 21:47     ` Carlos Santos
2019-11-02 23:42       ` Carlos Santos
2020-08-30 16:11   ` Arnout Vandecappelle
2019-10-30 13:27 ` [Buildroot] [PATCH RFC 2/3] packages/luainterpreter: remove target-finalize hack unixmania at gmail.com
2020-08-30 16:11   ` Arnout Vandecappelle
2019-10-30 13:27 ` [Buildroot] [PATCH RFC 3/3] packages/{eudev, systemd}: move commoun users to package/udev unixmania at gmail.com
2020-08-30 16:12   ` Arnout Vandecappelle

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=20191031201501.GA2553@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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