Openembedded Core Discussions
 help / color / mirror / Atom feed
From: AshishKumar Mishra <emailaddress.ashish@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: AshishKumar Mishra <emailaddress.ashish@gmail.com>
Subject: [OE-core][master][PATCH] package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook
Date: Thu, 18 Jun 2026 13:40:19 +0530	[thread overview]
Message-ID: <20260618081020.86040-1-emailaddress.ashish@gmail.com> (raw)

From: AshishKumar Mishra <emailaddress.ashish@gmail.com>

This patch adds a new hook point PACKAGE_POSTPROCESS_FUNCS to
package.bbclass, inserted into PACKAGEFUNCS immediately before
emit_pkgdata.

PACKAGE_PREPROCESS_FUNCS comes in picture before the per-package file split,
so at that point the final file lists are not yet available.
There is no existing hook that fires after the split with the ability to still
modify package scripts postinst

The primary use case driving this patch is SELinux context labeling
SELinux labels must be applied on the target via a postinst script
That script must know exactly which files are in the package but this is
only available after the split.
This hook enables a bbclass to auto-generate per-package postinst
scripts containing targeted chcon/restorecon calls
This helps while getting proper selinux context to files if package
is updated on target while incremental update scenarios

There can be other user defined usage if the hook is available
The change is small 2 lines and entirely non-breaking as the variable
defaults to "" so all existing builds are unaffected

Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
---
 meta/classes-global/package.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass
index 30accaeaa9..37e4469bc8 100644
--- a/meta/classes-global/package.bbclass
+++ b/meta/classes-global/package.bbclass
@@ -460,6 +460,7 @@ def gen_packagevar(d, pkgvars="PACKAGEVARS"):
 
 # Functions for setting up PKGD
 PACKAGE_PREPROCESS_FUNCS ?= ""
+PACKAGE_POSTPROCESS_FUNCS ?= ""
 # Functions which split PKGD up into separate packages
 PACKAGESPLITFUNCS ?= " \
                 package_do_split_locales \
@@ -473,6 +474,7 @@ PACKAGEFUNCS += " \
                 package_do_pkgconfig \
                 read_shlibdeps \
                 package_depchains \
+                ${PACKAGE_POSTPROCESS_FUNCS} \
                 emit_pkgdata"
 
 python do_package () {
-- 
2.43.0



             reply	other threads:[~2026-06-18  8:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18  8:10 AshishKumar Mishra [this message]
2026-06-19  6:33 ` [master][PATCH] package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook AshishKumar Mishra

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=20260618081020.86040-1-emailaddress.ashish@gmail.com \
    --to=emailaddress.ashish@gmail.com \
    --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