* [PATCH] package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook
@ 2026-07-08 9:56 AshishKumar Mishra
2026-07-08 10:02 ` [OE-core] " Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: AshishKumar Mishra @ 2026-07-08 9:56 UTC (permalink / raw)
To: openembedded-core; +Cc: AshishKumar Mishra
This patch hardcode the emit_pkgdata to run last and adds a new hook
PACKAGE_POSTPROCESS_FUNCS to package.bbclass which
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
One of use case driving this patch is SELinux context labeling
There can be other user defined usage if the hook is available
Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
---
meta/classes-global/package.bbclass | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass
index 30accaeaa9..c53b5c2d3d 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 \
@@ -472,8 +473,7 @@ PACKAGEFUNCS += " \
package_do_shlibs \
package_do_pkgconfig \
read_shlibdeps \
- package_depchains \
- emit_pkgdata"
+ package_depchains"
python do_package () {
# Change the following version to cause sstate to invalidate the package
@@ -564,14 +564,24 @@ python do_package () {
for file in files:
pkgfiles[pkg].append(walkroot + os.sep + file)
+ #
+ # We want emit_pkgdata to run last, after everything
+ # This is becuase any layer which adds its custom function
+ # to PACKAGEFUNCS using += would get executed after emit_pkgdata
+ #
for f in (d.getVar('PACKAGEFUNCS') or '').split():
bb.build.exec_func(f, d)
+ for f in (d.getVar('PACKAGE_POSTPROCESS_FUNCS') or '').split():
+ bb.build.exec_func(f, d)
+
+ bb.build.exec_func("emit_pkgdata", d)
+
oe.qa.exit_if_errors(d)
}
do_package[dirs] = "${SHLIBSWORKDIR} ${D}"
-do_package[vardeps] += "${PACKAGE_PREPROCESS_FUNCS} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}"
+do_package[vardeps] += "${PACKAGE_PREPROCESS_FUNCS} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${PACKAGE_POSTPROCESS_FUNCS} ${@gen_packagevar(d)}"
addtask package after do_install
SSTATETASKS += "do_package"
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [OE-core] [PATCH] package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook
2026-07-08 9:56 [PATCH] package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook AshishKumar Mishra
@ 2026-07-08 10:02 ` Richard Purdie
2026-07-14 5:03 ` AshishKumar Mishra
0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2026-07-08 10:02 UTC (permalink / raw)
To: emailaddress.ashish, openembedded-core
On Wed, 2026-07-08 at 15:26 +0530, Ashish Mishra via
lists.openembedded.org wrote:
> This patch hardcode the emit_pkgdata to run last and adds a new hook
> PACKAGE_POSTPROCESS_FUNCS to package.bbclass which
>
> 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
>
> One of use case driving this patch is SELinux context labeling
> There can be other user defined usage if the hook is available
>
> Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
> ---
> meta/classes-global/package.bbclass | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes-global/package.bbclass b/meta/classes-
> global/package.bbclass
> index 30accaeaa9..c53b5c2d3d 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 \
> @@ -472,8 +473,7 @@ PACKAGEFUNCS += " \
> package_do_shlibs \
> package_do_pkgconfig \
> read_shlibdeps \
> - package_depchains \
> - emit_pkgdata"
> + package_depchains"
>
> python do_package () {
> # Change the following version to cause sstate to invalidate the
> package
> @@ -564,14 +564,24 @@ python do_package () {
> for file in files:
> pkgfiles[pkg].append(walkroot + os.sep + file)
>
> + #
> + # We want emit_pkgdata to run last, after everything
> + # This is becuase any layer which adds its custom function
> + # to PACKAGEFUNCS using += would get executed after
> emit_pkgdata
> + #
> for f in (d.getVar('PACKAGEFUNCS') or '').split():
> bb.build.exec_func(f, d)
>
> + for f in (d.getVar('PACKAGE_POSTPROCESS_FUNCS') or '').split():
> + bb.build.exec_func(f, d)
> +
> + bb.build.exec_func("emit_pkgdata", d)
> +
> oe.qa.exit_if_errors(d)
Just put emit_pkgdata here and then you don't need
PACKAGE_POSTPROCESS_FUNCS at all, you can just append to PACAGEFUNCS?
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-14 5:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 9:56 [PATCH] package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook AshishKumar Mishra
2026-07-08 10:02 ` [OE-core] " Richard Purdie
2026-07-14 5:03 ` AshishKumar Mishra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox