1 |
Use get_valid_checksum_keys() function instead of accessing hashfunc_map |
2 |
directly throughout the Portage. |
3 |
--- |
4 |
pym/portage/_emirrordist/FetchTask.py | 2 +- |
5 |
pym/portage/dbapi/bintree.py | 4 ++-- |
6 |
pym/portage/eclass_cache.py | 2 +- |
7 |
pym/portage/manifest.py | 4 ++-- |
8 |
pym/portage/package/ebuild/fetch.py | 10 +++++----- |
9 |
5 files changed, 11 insertions(+), 11 deletions(-) |
10 |
|
11 |
diff --git a/pym/portage/_emirrordist/FetchTask.py b/pym/portage/_emirrordist/FetchTask.py |
12 |
index 64de67582..203b8c213 100644 |
13 |
--- a/pym/portage/_emirrordist/FetchTask.py |
14 |
+++ b/pym/portage/_emirrordist/FetchTask.py |
15 |
@@ -574,7 +574,7 @@ class FetchTask(CompositeTask): |
16 |
else: |
17 |
for hash_name in self.digests: |
18 |
if hash_name != "size" and \ |
19 |
- hash_name in portage.checksum.hashfunc_map: |
20 |
+ hash_name in portage.checksum.get_valid_checksum_keys(): |
21 |
return hash_name |
22 |
|
23 |
return None |
24 |
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py |
25 |
index ae9e7caa2..12c3d3e51 100644 |
26 |
--- a/pym/portage/dbapi/bintree.py |
27 |
+++ b/pym/portage/dbapi/bintree.py |
28 |
@@ -7,7 +7,7 @@ __all__ = ["bindbapi", "binarytree"] |
29 |
|
30 |
import portage |
31 |
portage.proxy.lazyimport.lazyimport(globals(), |
32 |
- 'portage.checksum:hashfunc_map,perform_multiple_checksums,' + \ |
33 |
+ 'portage.checksum:get_valid_checksum_keys,perform_multiple_checksums,' + \ |
34 |
'verify_all,_apply_hash_filter,_hash_filter', |
35 |
'portage.dbapi.dep_expand:dep_expand', |
36 |
'portage.dep:dep_getkey,isjustname,isvalidatom,match_from_list', |
37 |
@@ -1546,7 +1546,7 @@ class binarytree(object): |
38 |
if metadata is None: |
39 |
return digests |
40 |
|
41 |
- for k in hashfunc_map: |
42 |
+ for k in get_valid_checksum_keys(): |
43 |
v = metadata.get(k) |
44 |
if not v: |
45 |
continue |
46 |
diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py |
47 |
index 2988d25d6..d2d9e2710 100644 |
48 |
--- a/pym/portage/eclass_cache.py |
49 |
+++ b/pym/portage/eclass_cache.py |
50 |
@@ -48,7 +48,7 @@ class hashed_path(object): |
51 |
# we don't care to allow .mD5 as an alias for .md5 |
52 |
raise AttributeError(attr) |
53 |
hashname = attr.upper() |
54 |
- if hashname not in checksum.hashfunc_map: |
55 |
+ if hashname not in checksum.get_valid_checksum_keys(): |
56 |
raise AttributeError(attr) |
57 |
val = checksum.perform_checksum(self.location, hashname)[0] |
58 |
setattr(self, attr, val) |
59 |
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py |
60 |
index 7278e21c1..28a77ba87 100644 |
61 |
--- a/pym/portage/manifest.py |
62 |
+++ b/pym/portage/manifest.py |
63 |
@@ -13,7 +13,7 @@ import warnings |
64 |
|
65 |
import portage |
66 |
portage.proxy.lazyimport.lazyimport(globals(), |
67 |
- 'portage.checksum:hashfunc_map,perform_multiple_checksums,' + \ |
68 |
+ 'portage.checksum:get_valid_checksum_keys,perform_multiple_checksums,' + \ |
69 |
'verify_all,_apply_hash_filter,_filter_unaccelarated_hashes', |
70 |
'portage.repository.config:_find_invalid_path_char', |
71 |
'portage.util:write_atomic,writemsg_level', |
72 |
@@ -154,7 +154,7 @@ class Manifest(object): |
73 |
|
74 |
self.hashes.update(hashes.intersection(MANIFEST2_HASH_FUNCTIONS)) |
75 |
self.hashes.difference_update(hashname for hashname in \ |
76 |
- list(self.hashes) if hashname not in hashfunc_map) |
77 |
+ list(self.hashes) if hashname not in get_valid_checksum_keys()) |
78 |
self.hashes.add("size") |
79 |
self.hashes.add(MANIFEST2_REQUIRED_HASH) |
80 |
for t in MANIFEST2_IDENTIFIERS: |
81 |
diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py |
82 |
index 8755b7522..5c4b74446 100644 |
83 |
--- a/pym/portage/package/ebuild/fetch.py |
84 |
+++ b/pym/portage/package/ebuild/fetch.py |
85 |
@@ -29,7 +29,7 @@ portage.proxy.lazyimport.lazyimport(globals(), |
86 |
|
87 |
from portage import OrderedDict, os, selinux, shutil, _encodings, \ |
88 |
_shell_quote, _unicode_encode |
89 |
-from portage.checksum import (hashfunc_map, perform_md5, verify_all, |
90 |
+from portage.checksum import (get_valid_checksum_keys, perform_md5, verify_all, |
91 |
_filter_unaccelarated_hashes, _hash_filter, _apply_hash_filter) |
92 |
from portage.const import BASH_BINARY, CUSTOM_MIRRORS_FILE, \ |
93 |
GLOBAL_CONFIG_PATH |
94 |
@@ -551,6 +551,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, |
95 |
distdir_writable = can_fetch and not fetch_to_ro |
96 |
failed_files = set() |
97 |
restrict_fetch_msg = False |
98 |
+ valid_hashes = frozenset(get_valid_checksum_keys()) |
99 |
+ valid_hashes.discard("size") |
100 |
|
101 |
for myfile in filedict: |
102 |
""" |
103 |
@@ -564,11 +566,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, |
104 |
orig_digests = mydigests.get(myfile, {}) |
105 |
|
106 |
if not (allow_missing_digests or listonly): |
107 |
- verifiable_hash_types = set(orig_digests).intersection(hashfunc_map) |
108 |
- verifiable_hash_types.discard("size") |
109 |
+ verifiable_hash_types = set(orig_digests).intersection(valid_hashes) |
110 |
if not verifiable_hash_types: |
111 |
- expected = set(hashfunc_map) |
112 |
- expected.discard("size") |
113 |
+ expected = set(valid_hashes) |
114 |
expected = " ".join(sorted(expected)) |
115 |
got = set(orig_digests) |
116 |
got.discard("size") |
117 |
-- |
118 |
2.12.0 |