1 |
commit: 6a534da500cb95c692993d6348a31d62ec8a152b |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 3 18:33:08 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 3 18:33:08 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6a534da5 |
7 |
|
8 |
Warn for questionable layout.conf manifest-hashes |
9 |
|
10 |
--- |
11 |
pym/portage/repository/config.py | 24 +++++++++++++++++++++++- |
12 |
1 files changed, 23 insertions(+), 1 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
15 |
index 779d432..713494c 100644 |
16 |
--- a/pym/portage/repository/config.py |
17 |
+++ b/pym/portage/repository/config.py |
18 |
@@ -3,6 +3,7 @@ |
19 |
|
20 |
import io |
21 |
import logging |
22 |
+import warnings |
23 |
import sys |
24 |
import re |
25 |
|
26 |
@@ -15,7 +16,8 @@ try: |
27 |
except ImportError: |
28 |
from ConfigParser import SafeConfigParser, ParsingError |
29 |
from portage import os |
30 |
-from portage.const import USER_CONFIG_PATH, REPO_NAME_LOC |
31 |
+from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH, |
32 |
+ REPO_NAME_LOC, USER_CONFIG_PATH) |
33 |
from portage.env.loaders import KeyValuePairFileLoader |
34 |
from portage.util import normalize_path, writemsg, writemsg_level, shlex_split |
35 |
from portage.localization import _ |
36 |
@@ -385,6 +387,26 @@ class RepoConfigLoader(object): |
37 |
manifest_hashes = layout_data.get('manifest-hashes') |
38 |
if manifest_hashes is not None: |
39 |
manifest_hashes = frozenset(manifest_hashes.upper().split()) |
40 |
+ if MANIFEST2_REQUIRED_HASH not in manifest_hashes: |
41 |
+ warnings.warn(("Repository named '%s' has a " |
42 |
+ "'manifest-hashes' setting that does not contain " |
43 |
+ "the '%s' hash which is required by this " |
44 |
+ "portage version. You will have to upgrade portage " |
45 |
+ "if you want to generate valid manifests for this " |
46 |
+ "repository: %s" % (repo.name, |
47 |
+ MANIFEST2_REQUIRED_HASH, |
48 |
+ layout_filename))) |
49 |
+ unsupported_hashes = manifest_hashes.difference( |
50 |
+ MANIFEST2_HASH_FUNCTIONS) |
51 |
+ if unsupported_hashes: |
52 |
+ warnings.warn(("Repository named '%s' has a " |
53 |
+ "'manifest-hashes' setting that contains one " |
54 |
+ "or more hash types '%s' which are not supported by " |
55 |
+ "this portage version. You will have to upgrade " |
56 |
+ "portage if you want to generate valid manifests for " |
57 |
+ "this repository: %s" % (repo.name, |
58 |
+ " ".join(sorted(unsupported_hashes)), |
59 |
+ layout_filename))) |
60 |
repo.manifest_hashes = manifest_hashes |
61 |
|
62 |
repo.cache_is_authoritative = layout_data.get('authoritative-cache', 'false').lower() == 'true' |