From 6a534da500cb95c692993d6348a31d62ec8a152b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 3 Oct 2011 11:33:08 -0700 Subject: Warn for questionable layout.conf manifest-hashes --- pym/portage/repository/config.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 779d432be..713494c86 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -3,6 +3,7 @@ import io import logging +import warnings import sys import re @@ -15,7 +16,8 @@ try: except ImportError: from ConfigParser import SafeConfigParser, ParsingError from portage import os -from portage.const import USER_CONFIG_PATH, REPO_NAME_LOC +from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH, + REPO_NAME_LOC, USER_CONFIG_PATH) from portage.env.loaders import KeyValuePairFileLoader from portage.util import normalize_path, writemsg, writemsg_level, shlex_split from portage.localization import _ @@ -385,6 +387,26 @@ class RepoConfigLoader(object): manifest_hashes = layout_data.get('manifest-hashes') if manifest_hashes is not None: manifest_hashes = frozenset(manifest_hashes.upper().split()) + if MANIFEST2_REQUIRED_HASH not in manifest_hashes: + warnings.warn(("Repository named '%s' has a " + "'manifest-hashes' setting that does not contain " + "the '%s' hash which is required by this " + "portage version. You will have to upgrade portage " + "if you want to generate valid manifests for this " + "repository: %s" % (repo.name, + MANIFEST2_REQUIRED_HASH, + layout_filename))) + unsupported_hashes = manifest_hashes.difference( + MANIFEST2_HASH_FUNCTIONS) + if unsupported_hashes: + warnings.warn(("Repository named '%s' has a " + "'manifest-hashes' setting that contains one " + "or more hash types '%s' which are not supported by " + "this portage version. You will have to upgrade " + "portage if you want to generate valid manifests for " + "this repository: %s" % (repo.name, + " ".join(sorted(unsupported_hashes)), + layout_filename))) repo.manifest_hashes = manifest_hashes repo.cache_is_authoritative = layout_data.get('authoritative-cache', 'false').lower() == 'true' -- cgit v1.2.3-1-g7c22