portage/sync/modules/cvs/__init__.py: fix missed parameter change in CheckSyncConfig

Test and fix supplied by Mike Gilbert <floppym>.
dblink._protect: disable config protect for identical files (531854)

Since commit 02417188225758b1822d176abd8902a92300a371, config
protection was triggered for identical files if
config-protect-if-modified was not enabled in FEATURES. Fix it
to skip config protection in this case.

Fixes: 024171882257 ("CONFIG_PROTECT: protect symlinks, bug #485598")
X-Gentoo-Bug: 531854
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531854
Acked-by: Brian Dolbec <dolsen@gentoo.org>
portage/sync/controller.py: Make a repo.postsync.d directory

This then runs per-repo postsync hooks only on scripts in the repo.postsync.d directory.
This also maintains compatibility with existing scripts in the postsync.d dir or other
sub-directories.
Both postsync.d directories support subdirectories.
Scripts are run in sorted order.
Install a verbose example repo.postsync.d script

Brian Dolbec <dolsen@gentoo.org>: Move the example to repo.postsync.d.
Remove the final hook run else section for the new independant repo.postsync.d directory.
Reword comments for the changes.
bin/ebuild: fix --color=n for bug #531690

When the NOCOLOR variable is overridden in portage.settings, it's
necessary to call the config.backup_changes method in order for the
change to persist through config.reset calls.

X-Gentoo-Bug: 531690
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531690
Acked-by: Brian Dolbec <dolsen@gentoo.org>
portage/sync/controller.py: Remove a debug print() missed

Fixes commit: a3991f7727be0eb973aad1b120d248a0739be453
Author: Brian Dolbec <dolsen@gentoo.org> (Sat 06 Dec 2014 02:54:36 PM PST)
Subject: portage/sync/controller.py: Make a repo.postsync.d directory
Prefer GNU ar when unpacking .deb packages.

PMS reference:
deb packages (*.deb). Ebuilds must ensure that the deb2targz program
is installed on those platforms where the GNU binutils ar program is
not available and the installed ar program is incompatible with GNU
archives. Otherwise, ebuilds must ensure that GNU binutils is
installed.
sync: allow overriding sync-umask for the repository
sync: allow overriding sync-user for the repository
sync: ensure sync_{umask,user} is respected when creating repo
Split @selected into @selected-packages and @selected-sets

Split the big @selected set into separate @selected-packages for plain
packages and @selected-sets for subsets. The @selected set is still
provided as compatibility wrapper for both, though the new sets are
preferred for more flexibility.
Display emerge search results incrementally (412471)

This makes emerge --search / --searchdesc display individual search
results as soon as they become available. A search._iter_search method
is split out from the search.execute method, and the search.output
method operates on that. The spinner is now disabled, but the spinner
code remains, in case we later decide to enable it optionally.

X-Gentoo-Bug: 412471
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=412471
Add egencache --update-pkg-desc-index action.

This adds an egencache --update-pkg-desc-index action which generates
a plain-text index of package names, versions, and descriptions. The
index can then be used to optimize emerge --search / --searchdesc
actions.

X-Gentoo-Bug: 525718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=525718
Add IndexStreamIterator and MultiIterGroupBy.

This IndexStreamIterator class can be used together with the
pkg_desc_index_line_read function to read an index file incrementally
as a stream.

The MultiIterGroupBy class can be used to iterate over multiple
IndexStreamIterator instances at once, incrementally grouping results
for a particular package from multiple indices, while limiting the
amount of any given index that must be in memory at once.

Both of these classes are used by the  IndexedPortdb class in the next
patch of this series.

X-Gentoo-Bug: 525718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=525718
Add IndexedPortdb class.

The IndexedPortdb class uses pkg_desc_index to optimize searchs for
package names and descriptions. If the package description index is
missing from a particular repository, then all metadata for that
repository is obtained using the normal pordbapi.aux_get method.

This class only implements a subset of portdbapi functionality that is
useful for searching pkg_desc_index incrementally. For this reason,
the cp_all method returns an ordered iterator instead of a list, so
that search results can be displayed incrementally.

X-Gentoo-Bug: 525718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=525718
Add IndexedVardb class.

Searching of installed packages is optimized to take advantage of
vardbdbapi._aux_cache, which is backed by vdb_metadata.pickle.
This class only implements a subset of vardbapi functionality that is
useful for searching incrementally. For this reason, the cp_all method
returns an ordered iterator instead of a list, so that search results
can be displayed incrementally.

X-Gentoo-Bug: 525718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=525718
Add emerge --search-index option.

The new emerge --search-index option, which is enabled by default,
causes pkg_desc_index to be used for search optimization. The search
index needs to be regenerated by egencache after changes are made to
a repository (see the --update-pkg-desc-index action).

For users that would like to modify ebuilds in a repository without
running egencache afterwards, emerge --search-index=n can be used to
get non-indexed search. Alternatively, the user could simply remove
the stale index file, in order to disable the search index for a
particular repository.

In order to conserve memory, indices are read as streams, and
MultiIterGroupBy is used to group results from IndexedPortdb and
IndexedVardb. Stream-oriented search also makes it possible to
display search results incrementally (for bug #412471).

X-Gentoo-Bug: 525718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=525718
Log changes between vdb_metadata.pickle updates

This adds add support to generate a vdb_metadata_delta.json file
which tracks package merges / unmerges that occur between updates to
vdb_metadata.pickle. IndexedVardb can use the delta together with
vdb_metadata.pickle to reconstruct a complete view of /var/db/pkg,
so that it can avoid expensive listdir calls in /var/db/pkg/*.
Note that vdb_metadata.pickle is only updated periodically, in
order to avoid excessive re-writes of a large file.

In order to test the performance gains from this patch, you need to
generate /var/cache/edb/vdb_metadata_delta.json first, which will
happen automatically if you run 'emerge -p anything' with root
privileges.
search: optimize desc search with _first_cp
bin/phase-helpers.shL Fix unpack() for deb2targz .xz types

Issue reported by: mva in irc

>>> Unpacking source...
>>> Unpacking 2gis_4.14.11-0trusty1+shv139+r191_amd64.deb to /var/tmp/portage/app-misc/2gis-4.14.11.139.191/work
deb2targz: converting '2gis_4.14.11-0trusty1+shv139+r191_amd64.deb' ...
deb2targz: skipping section 'debian-binary'
deb2targz: skipping section 'control.tar.gz'
deb2targz: wrote '2gis_4.14.11-0trusty1+shv139+r191_amd64.tar.xz'
mv: cannot stat ‘2gis_4.14.11-0trusty1+shv139+r191_amd64.tar.gz’: No such file or directory