All package files even not owned by root should be removed, so make sure
that those checks return success while being root.
This fixes package removal for polkit, that had /etc/polkit/rules.d
files owned by the polkitd user.
The previous code was checking incorrectly if the file had the write
bit set, and this is wrong because a package could have files with
only the read bit set (0444).
With xbps-rindex(8) -c/-r being multithreaded, the memory usage was
insanely high in the build server, with peaks of almost 4GB (this depends
on the file size being processed and number of threads).
Process the file in small chunks instead to compute the SHA256 hash.
The repodata archive wasn't group writable, resulting in a new archive
created from scratch if the fd wasn't writable.
repodata archives are now created with 0664 mode, this way its main group
also can write to it.
This effectively checks that all pkgs in a transaction to be installed
or updated, have not unmatched shared libraries, which might happen with
pkgs that had major soname bumps.
This implementation slow downs xbps_transaction_prepare() 2x, due to
the use of xbps_pkgdb_get_pkg_metadata(). A new pkgdb format is required
that adds the pkg shlib-provides objects to pkgdb, avoiding the need
to use xbps_pkgdb_get_pkg_metadata().
- xbps_repo_open() accepts a third argument (bool) to acquire a POSIX file
lock on the repository archive.
- xbps_repo_close() accepts a second argument (bool) to release a POSIX file
lock on the repository archive.
This avoids the issue of multiple xbps-rindex(8) processes being blocked
even for different repositories on the same architecture, resulting in
unnecessary contention.