Rather than using a random buffer from stack or heap, and decide
what size to use, create a private memory mapped object...
This simplifies the code in lib/verifysig.c and xbps-create.
- if the user wants to add a package which is older than the
one in the index, xbps-rindex will check if the package
reverts the one on the index. If so the package will be added
regardless of its version
- if the user wants to add a package which is newer than the
one on the index, xbps-rindex will check if the package on the
index reverts the one the user wants to add. If so the package
will be skipped regardless of its version.
xz -9 is very expensive in terms of CPU and memory usage, and also
memory usage for decompression. Thus we stick to default of -6 for
xz. For gzip and bzip2, -9 is ok.
This avoids the need to manually add them to the {INSTALL,REMOVE}.msg
files in binary packages, and saves some bytes in the repository archive
and binary packages.
Idea by @dominikh.
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 is magnituds faster than before; some results:
$ for f in 1 2 3; do time xbps-rindex -r /var/cache/xbps/ &>/dev/null; done
real 0m0.624s
user 0m2.163s
sys 0m0.032s
real 0m0.590s
user 0m2.159s
sys 0m0.023s
real 0m0.584s
user 0m2.144s
sys 0m0.039s
$ for f in 1 2 3; do time LD_PRELOAD=$PWD/lib/libxbps.so.2.0.0 ./bin/xbps-rindex/xbps-rindex -r /var/cache/xbps &>/dev/null; done
real 0m0.037s
user 0m0.030s
sys 0m0.010s
real 0m0.036s
user 0m0.032s
sys 0m0.007s
real 0m0.037s
user 0m0.035s
sys 0m0.006s
$
- 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.