FetchIterator: support PORTAGE_CHECKSUM_FILTER
authorZac Medico <zmedico@gentoo.org>
Thu, 10 Jan 2013 07:54:26 +0000 (23:54 -0800)
committerZac Medico <zmedico@gentoo.org>
Thu, 10 Jan 2013 07:54:26 +0000 (23:54 -0800)
pym/portage/_emirrordist/FetchIterator.py

index 58044ac890aa5adbc753c5a95e86700394c884c2..16a0b04c9de0ef9d4b803261480a4372b139e5ef 100644 (file)
@@ -2,6 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 
 from portage import os
+from portage.checksum import (_apply_hash_filter,
+       _filter_unaccelarated_hashes, _hash_filter)
 from portage.dep import use_reduce
 from portage.exception import PortageException
 from .FetchTask import FetchTask
@@ -28,6 +30,11 @@ class FetchIterator(object):
                file_failures = self._config.file_failures
                restrict_mirror_exemptions = self._config.restrict_mirror_exemptions
 
+               hash_filter = _hash_filter(
+                       portdb.settings.get("PORTAGE_CHECKSUM_FILTER", ""))
+               if hash_filter.transparent:
+                       hash_filter = None
+
                for cp in self._iter_every_cp():
 
                        for tree in portdb.porttrees:
@@ -125,6 +132,12 @@ class FetchIterator(object):
                                                        continue
                                                file_owners[filename] = cpv
 
+                                               file_digests = \
+                                                       _filter_unaccelarated_hashes(file_digests)
+                                               if hash_filter is not None:
+                                                       file_digests = _apply_hash_filter(
+                                                               file_digests, hash_filter)
+
                                                yield FetchTask(cpv=cpv,
                                                        background=True,
                                                        digests=file_digests,