dblink: case insensitive support for bug #524236

This adds a dblink._contents attribute with methods that provide
an interface for contents operations with "implicit" case handling.
The new methods are implemented in a separate
ContentsCaseSensitivityManager class, in order to avoid adding more
bloat to vartree.py.

X-Gentoo-Bug: 524236
X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=524236
Acked-by: Brian Dolbec <dolsen@gentoo.org>
FEATURES=case-insensitive-fs for bug #524236

When case-insensitive-fs is enabled in FEATURES, the dblink.isowner
method, _owners_db class, and ConfigProtect class will be
case-insensitive. This causes the collision-protect and unmerge code
to behave correctly for a case-insensitive file system. If the file
system is case-insensitive but case-preserving, then case is preserved
in the CONTENTS data of installed packages.

X-Gentoo-Bug: 524236
X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=524236
Acked-by: Brian Dolbec <dolsen@gentoo.org>
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>
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.

X-Gentoo-Bug: 490732
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=490732