dep_zapdeps: avoid use.mask/force changes (515584)

This patch causes dep_zapdeps to check which USE flags cause a match
to fail, and uses that information to prioritize choices that do not
require changes to use.mask or use.force.

X-Gentoo-Bug: 515584
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515584
Acked-by: Brian Dolbec <dolsen@gentoo.org>
Introduce eqatag to output proper machine-readable QA logs

The eqatag command syntax conforms to pre-GLEP describing
install-qa-check.d. The qa.log file format strictly conforms to YAML for
easy machine parsing.
Update the QA checks to new eqatag API
Remove __eqalog & __eqawarnlog

Replaced by eqatag.
emerge: check for writable /var/db/pkg (490732)

If there are packages to be merged or unmerge, then bail out early
if /var/db/pkg is not writable (in order to avoid a fatal EROFS error
which would otherwise occur later on). Behavior remains unchanged for
--pretend mode. For --ask mode, it will bail out just after the last
relevant --ask prompt.

In contrast to the writeable_check module, which operates on files just
before they are merged, the new vardbapi.writable check is performed
before anything has been built (much earlier).

X-Gentoo-Bug: 490732
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=490732
Acked-by: Brian Dolbec <dolsen@gentoo.org>
Add emerge --with-test-deps option for bug #520652

For packages matched by arguments, this option will pull in dependencies
that are conditional on the "test" USE flag, even if FEATURES=test is not
enabled for the matched packages. The state of the "test" USE flag is not
affected by this option. It only changes the effective dependencies
which are processed by the depgraph._add_pkg_deps method.

X-Gentoo-Bug: 520652
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=520652
Acked-by: Alexander Berntsen <bernalex@gentoo.org>
emerge: check for writable PKGDIR (490732)

If there are packages to be merged and "buildpkg" or "buildsyspkg" is
enabled, then bail out early if PKGDIR is not writable (in order to
avoid a fatal EROFS error which would otherwise occur later on).
Behavior remains unchanged for --pretend, --fetchonly and
--fetch-all-uri. For --ask, it will bail out just after the last
relevant --ask prompt.

X-Gentoo-Bug: 490732
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=490732
Acked-by: Alexander Berntsen <bernalex@gentoo.org>
_slot_operator_update_probe: memoize use_reduce (529660)

Memoize the results of use_reduce calls inside
_slot_operator_update_probe, in order to improve performance. With
memoization, 'emerge -puvDN @world' on one of my computers takes
22.4% less time, and results in 13.5% fewer use_reduce calls.

X-Gentoo-Bug: 529660
X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=529660
Acked-by: Brian Dolbec <dolsen@gentoo.org>
_select_pkg_highest_available: selective cache invalidation (530010)

Implement selective invalidation of cache for the
depgraph._select_pkg_highest_available method, so that the entire cache
is not discarded whenever a package is added to the graph. On one of my
computers with this patch, 'emerge -puvDN @world' takes 15% less time,
and results in 58% fewer _select_pkg_highest_available_imp calls.

X-Gentoo-Bug: 530010
X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=530010
Acked-by: Alexander Berntsen <bernalex@gentoo.org>