Zac already reviewed a patch that moves most of bsdflags mangling from python side to sh side, by using mtree(1) command to save and restore the flags (also fixing a few other issues like stripping and Set[UG]ID permissions handling work as intended). With the attached patch, the python side will use py-freebsd module (dev-python/py-freebsd) instead of the custom bsdchflags implementation (the module is maintained and supported by an upstream FreeBSD developer), together with the new st_flags attribute in stat objects (in upstream Python sources for a while now if I remember correctly).
This is probably to be left for 2.1.3 to a least as it requires to add py-freebsd to dependencies, and bsdchflags won't need to be built anymore.
Created attachment 100629 [details, diff]
Thanks, the mtree patch is in trunk r4863 and the 2.1.2 branch r4864.
Apparently the py-freebsd patch makes the preinst/postinst mtree stuff unnecessary, but the mtree stuff in prepall will still be needed. I guess I'll merge the py-freebsd stuff into trunk sometime before the first 2.1.3_pre release. Are you sure that you don't want the py-freebsd stuff in 2.1.2? Are there any technical issues preventing it, such as backward compatibility?
After thinking about the mtree patch some more, I'm wondering if it's possible for the postinst mtree command to change the flags on existing directories in ways that you didn't intend.
Well, starting from the fact that no directory should have immutable flag anyway, and I somehow don't like the current way portage handle that (effectively bypassing the immutable flag set on directories), mtree might just reset the flags to none as they supposed to be.
It's not a 100% perfect implementation but it's not that bad either, it actually solves a few issues with the previous implementation, too.
And this patch using py-freebsd does not replace the mtree(1), as without mtree(1) usage, the installed files will have no flags at all... the py-freebsd usage instead removes the code currently handled by mtree from the python side (making exceptions really exceptional cases) and removing the need for having a custom module implemented to access chflags.
These two patches are complementary basically.
And the main reason for not having this in 2.1.2, while having mtree(1) there is that I'd like 2.1.2 being the latest version available for 6.1 profile, adding sandbox dependency on the next version for 6.2 profile.
The mtree patch has been released in 2.1.2_rc1-r1.
In svn r5870 py-freebsd replaces our old chflags module.
This has been released in 2.1.3_rc1.