Skip to contentSkip to conversation

package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook

PATCH In review AshishKumar Mishra 3 participants 5 messages Jun 18 – Jul 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.bbclass: add PACKAGE_POSTPROCESS_FUNCS hook

From: AshishKumar Mishra <[email protected]>

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

---
 meta/classes-global/package.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes-global/package.bbclass +2 -0
index 30accaeaa9..37e4469bc8 100644
@@ -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 () {
Signature · 1 line
2.43.0
#1 lore raw

Hi Team,

Can team take this for master-next branch
If team has any review comments, do let me know i can rework on that patch accordingly

Thanks ,
Ashish

#2 lore raw

Hi Team,

Request to consider this to be merged in master branch I can rework on this if team has any suggestion or any feedback

Thanks,
Ashish

#3 lore raw
In reply to AshishKumar Mishra
Quoted 20 lines · Ashish Mishra via lists.openembedded.org

From: AshishKumar Mishra <[email protected]>

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

Quoted 3 lines

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

The trouble is that this is only going to work as long as it is only your use case using this function name. As soon as someone else decides their function should be last, it will break your use case.

I guess we could hardcode the emit_pkgdata which would give you access to the end of the list of functions?

Cheers,

Richard