public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Richard Purdie" <richard.purdie@linuxfoundation.org>
To: Sinan Kaya <okaya@kernel.org>, openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [meta-oe][PATCH v2] procps: split into binary subpackages
Date: Tue, 01 Dec 2020 10:37:34 +0000	[thread overview]
Message-ID: <2d6b4cd69ed05454b7936f0a3a1c320db1c56558.camel@linuxfoundation.org> (raw)
In-Reply-To: <20201201034326.11447-1-okaya@kernel.org>

On Tue, 2020-12-01 at 03:43 +0000, Sinan Kaya wrote:
> This change allows you to pull individual binaries into the
> target without including the entire suite.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> ---
>  meta/recipes-extended/procps/procps_3.3.16.bb | 51 +++++++++++++++++--
>  1 file changed, 48 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-extended/procps/procps_3.3.16.bb b/meta/recipes-extended/procps/procps_3.3.16.bb
> index 2810ebd285a..1b62ae33f5c 100644
> --- a/meta/recipes-extended/procps/procps_3.3.16.bb
> +++ b/meta/recipes-extended/procps/procps_3.3.16.bb
> @@ -50,15 +50,13 @@ do_install_append () {
>  
>  CONFFILES_${PN} = "${sysconfdir}/sysctl.conf"
>  
> -bindir_progs = "free pkill pmap pgrep pwdx skill snice top uptime w"
> +bindir_progs = "free pkill pmap pgrep pwdx skill slabtop snice tload top uptime vmstat w"
>  base_bindir_progs += "kill pidof ps watch"
>  base_sbindir_progs += "sysctl"
>  
>  ALTERNATIVE_PRIORITY = "200"
>  ALTERNATIVE_PRIORITY[pidof] = "150"
>  
> -ALTERNATIVE_${PN} = "${bindir_progs} ${base_bindir_progs} ${base_sbindir_progs}"
> -
>  ALTERNATIVE_${PN}-doc = "kill.1 uptime.1"
>  ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
>  ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
> @@ -69,8 +67,55 @@ python __anonymous() {
>  
>      for prog in d.getVar('base_sbindir_progs').split():
>          d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog))
> +
> +    for prog in d.getVar('bindir_progs').split():
> +        d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('bindir'), prog))
>  }
>  
>  # 'ps' isn't suitable for use as a security tool so whitelist this CVE.
>  # https://bugzilla.redhat.com/show_bug.cgi?id=1575473#c3
>  CVE_CHECK_WHITELIST += "CVE-2018-1121"
> +
> +python __anonymous () {
> +    packages = []
> +    for prog in d.getVar('bindir_progs').split():
> +        pkg = "procps-%s" % prog.replace("_", "-")
> +        packages.append(pkg)
> +        d.setVar("RDEPENDS_%s" % pkg, "procps-lib")
> +        d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))
> +        if not d.getVar("FILES_%s" % pkg):
> +                d.setVar("FILES_%s" % pkg, "${bindir}/%s*" % prog)
> +    for prog in d.getVar('base_sbindir_progs').split():
> +        pkg = "procps-%s" % prog.replace("_", "-")
> +        packages.append(pkg)
> +        d.setVar("RDEPENDS_%s" % pkg, "procps-lib")
> +        d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))
> +        if not d.getVar("FILES_%s" % pkg):
> +                d.setVar("FILES_%s" % pkg, "${base_sbindir}/%s*" % prog)
> +    for prog in d.getVar('base_bindir_progs').split():
> +        pkg = "procps-%s" % prog.replace("_", "-")
> +        packages.append(pkg)
> +        d.setVar("RDEPENDS_%s" % pkg, "procps-lib")
> +        d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))
> +        if not d.getVar("FILES_%s" % pkg):
> +                d.setVar("FILES_%s" % pkg, "${base_bindir}/%s*" % prog)
> +    pkg = "procps-man"
> +    packages.append(pkg)
> +    if not d.getVar("FILES_%s" % pkg):
> +            d.setVar("FILES_%s" % pkg, "${mandir}/*")
> +    pkg = "procps-lib"
> +    packages.append(pkg)
> +    if not d.getVar("FILES_%s" % pkg):
> +            d.setVar("FILES_%s" % pkg, "${libdir}/*")
> +    pkg = "procps-sysctl"
> +    d.appendVar("FILES_%s" % pkg, " ${sysconfdir}/sysctl.conf")
> +
> +    d.setVar("PROCPS_PACKAGES", " ".join(packages))
> +}
> +# "procps" is a metapackage which pulls in all procps binaries
> +PACKAGES += "${PROCPS_PACKAGES}"
> +PROVIDES += "${PROCPS_PACKAGES}"
> +FILES_${PN} = ""
> +ALLOW_EMPTY_${PN} = "1"
> +RRECOMMENDS_${PN} += "${PROCPS_PACKAGES}"

I am starting to get a little worried about the direction these patches
are heading in. How much of the system are we going to split into
individual package per binaries?

At some point the packages stop becoming useful and you have to
consider whather package management is the best way to build these
rootfs since I doubt you're enabling package management in the end
result anyway given the size gains you're aiming for?

I'd like to understand and discuss the end goal here before we merge
too many large chunks of custom python like the above?

An alternative may be to create a library function which can be
optionally enabled for recipes as this code and the other code you sent
does look similar, at least superficially...

Cheers,

Richard





  reply	other threads:[~2020-12-01 10:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  3:43 [meta-oe][PATCH v2] procps: split into binary subpackages Sinan Kaya
2020-12-01 10:37 ` Richard Purdie [this message]
2020-12-01 11:29   ` [OE-core] " Otavio Salvador
2020-12-01 14:15     ` Richard Purdie
2020-12-01 14:30       ` Otavio Salvador
2020-12-01 14:39         ` Sinan Kaya
2020-12-01 15:07           ` Richard Purdie
2020-12-01 16:49             ` Sinan Kaya

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=2d6b4cd69ed05454b7936f0a3a1c320db1c56558.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=okaya@kernel.org \
    --cc=openembedded-core@lists.openembedded.org \
    /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