Currently portage uses the bsd_chflags module, installed with portage itself, to manipulate the FreeBSD flags. That module is most an hack and fails when destination ROOT is on a non-flags-capable filesystem such as NFS. The attached patch, given the python patch at bug #94637, uses py-freebsd module (dev-python/py-freebsd, present in g/fbsd overlay) to achieve the same save/restore of flags but using a more pythonized way. To use that on portage it needs to change the dependency conditioned to libc_FreeBSD? ( dev-python/py-freebsd $new_version_of_python_with_94637 ). Then bsd_chflags can be dropped. Thanks in advance, Diego
Created attachment 60296 [details, diff] portage-2.0.51.22-nochflags.patch
Would it be possible to make some of those constants (st_flags & 0x0160016 and e[0] == 45) into human readable constants?
The flags constant is something i don't know how to describe, it was took from hasproblems() function in bsd_chflags module. As for 51, it's just the error code for operation not supported, maybe I can declare a constant OperationNotSupported == 51 and then use that?
51? I only see 45 in the patch. I checked the errno module and found that 45 corresponds with EL2NSYNC (Level 2 not synchronized) and that 51 corresponds with EL2HLT (Level 2 halted) but does that make sense? I'd really expect something like ENOSYS or EINVAL... What does `python -c 'import errno; print errno.errorcode["45"]'` give you there? Whatever it is, that's probably what should be used. So, what's the status on bug #94637 then?
though of something and wrote something else.. lately i'm being a bit confused, I know.
Created attachment 60844 [details, diff] 2.0.51.22-chflags.patch Updated patch
Created attachment 66075 [details, diff] 2.0.51.22-chflags.patch Removed out the broken stuff and make 'freebsd' references changed to 'bsdutils' (hoping that py-freebsd's API is the one that will be used by other modules, too).
Created attachment 66078 [details, diff] 2.0.51.22-chflags-bis.patch New patch this time trying to avoid the ugly if to check if a file is not writable. This way isNotWritable can also be extended in future to carry other checks for non-bsd flags.
Created attachment 69728 [details, diff] portage-2.0.53_rc2-stflags.patch Backing off from the idea of using py-freebsd, it turned out to be unpractical as it doesn't provide support for other systems like dragonfly, so spb's module is still the best shot. This patch just uses st_flags from stat() struct instead of using lgetflags, as python 2.4.1-r1 and will-be-2.4.2 supports that natively.
Okay never mind.