commit: 970476a56456e2ac3613a51056b71e581ceba27d Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> AuthorDate: Wed Aug 16 23:24:24 2017 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Tue Dec 5 18:24:49 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=970476a5
repoman: Initial adding file/module/API version repoman/pym/repoman/config.py | 7 +++++-- repoman/pym/repoman/main.py | 3 +++ repoman/pym/repoman/modules/linechecks/assignment/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/config.py | 2 +- repoman/pym/repoman/modules/linechecks/depend/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/deprecated/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/do/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/eapi/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/emake/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/helpers/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/nested/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/patches/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/phases/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/portage/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/quotes/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/uri/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/use/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/useless/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/whitespace/__init__.py | 3 ++- repoman/pym/repoman/modules/linechecks/workaround/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/depend/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/directories/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/eapi/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/ebuild/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/eclasses/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/fetch/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/keywords/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/manifest/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/metadata/__init__.py | 3 ++- repoman/pym/repoman/modules/scan/module.py | 9 ++++++--- repoman/pym/repoman/modules/scan/options/__init__.py | 3 ++- repoman/pym/repoman/qa_data.py | 4 ++-- repoman/pym/repoman/repos.py | 2 +- repoman/pym/repoman/scanner.py | 3 ++- 35 files changed, 76 insertions(+), 38 deletions(-) diff --git a/repoman/pym/repoman/config.py b/repoman/pym/repoman/config.py index f98130db3..dbf75237c 100644 --- a/repoman/pym/repoman/config.py +++ b/repoman/pym/repoman/config.py @@ -142,8 +142,11 @@ def load_config(conf_dirs, file_extensions=None, valid_versions=None): if config: if config['version'] not in valid_versions: - raise ConfigError("Invalid file version: %s in: %s\nPlease upgrade repoman: current valid versions: %s" - % (config['version'], filename, valid_versions)) + raise ConfigError( + "Invalid file version: %s in: %s\nPlease upgrade to " + ">=app-portage/repoman-%s, current valid API versions: %s" + % (config['version'], filename, + config['repoman_version'], valid_versions)) result = merge_config(result, config) return result diff --git a/repoman/pym/repoman/main.py b/repoman/pym/repoman/main.py index c1e3b99fe..81e2ff61e 100755 --- a/repoman/pym/repoman/main.py +++ b/repoman/pym/repoman/main.py @@ -47,10 +47,12 @@ os.umask(0o22) LOGLEVEL = logging.WARNING portage.util.initialize_logger(LOGLEVEL) +VALID_VERSIONS = [1,] def repoman_main(argv): config_root = os.environ.get("PORTAGE_CONFIGROOT") repoman_settings = portage.config(config_root=config_root, local_config=False) + repoman_settings.valid_versions = VALID_VERSIONS if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \ repoman_settings.get('TERM') == 'dumb' or \ @@ -92,6 +94,7 @@ def repoman_main(argv): config_root, portdir, portdir_overlay, repoman_settings, vcs_settings, options, qadata) repoman_settings = repo_settings.repoman_settings + repoman_settings.valid_versions = VALID_VERSIONS # Now set repo_settings vcs_settings.repo_settings = repo_settings diff --git a/repoman/pym/repoman/modules/linechecks/assignment/__init__.py b/repoman/pym/repoman/modules/linechecks/assignment/__init__.py index 6223baa9f..b95a25a74 100644 --- a/repoman/pym/repoman/modules/linechecks/assignment/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/assignment/__init__.py @@ -22,6 +22,7 @@ module_spec = { 'class': "Eapi3EbuildAssignment", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/config.py b/repoman/pym/repoman/modules/linechecks/config.py index 0044afe79..52a9a786b 100644 --- a/repoman/pym/repoman/modules/linechecks/config.py +++ b/repoman/pym/repoman/modules/linechecks/config.py @@ -66,7 +66,7 @@ class LineChecksConfig(object): self.infopaths = infopaths elif not self.infopaths: logging.error("LineChecksConfig; Error: No linechecks.yaml files defined") - configs = load_config(self.infopaths, 'yaml') + configs = load_config(self.infopaths, 'yaml', self.repo_settings.repoman_settings.valid_versions) if configs == {}: logging.error("LineChecksConfig: Failed to load a valid 'linechecks.yaml' file at paths: %s", self.infopaths) return False diff --git a/repoman/pym/repoman/modules/linechecks/depend/__init__.py b/repoman/pym/repoman/modules/linechecks/depend/__init__.py index e564948c5..2ea95347e 100644 --- a/repoman/pym/repoman/modules/linechecks/depend/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/depend/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "ImplicitRuntimeDeps", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/deprecated/__init__.py b/repoman/pym/repoman/modules/linechecks/deprecated/__init__.py index 8c5f61d49..258683345 100644 --- a/repoman/pym/repoman/modules/linechecks/deprecated/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/deprecated/__init__.py @@ -41,6 +41,7 @@ module_spec = { 'class': "InheritDeprecated", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/do/__init__.py b/repoman/pym/repoman/modules/linechecks/do/__init__.py index a56204794..dc5af701c 100644 --- a/repoman/pym/repoman/modules/linechecks/do/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/do/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "EbuildNonRelativeDosym", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/eapi/__init__.py b/repoman/pym/repoman/modules/linechecks/eapi/__init__.py index e598fdfe3..31993df20 100644 --- a/repoman/pym/repoman/modules/linechecks/eapi/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/eapi/__init__.py @@ -46,6 +46,7 @@ module_spec = { 'class': "Eapi4GoneVars", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/emake/__init__.py b/repoman/pym/repoman/modules/linechecks/emake/__init__.py index 2e930dae8..cecdc5fcf 100644 --- a/repoman/pym/repoman/modules/linechecks/emake/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/emake/__init__.py @@ -22,6 +22,7 @@ module_spec = { 'class': "WantAutoDefaultValue", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py index b80a83ecf..205cc32c2 100644 --- a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "EbuildHeader", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/helpers/__init__.py b/repoman/pym/repoman/modules/linechecks/helpers/__init__.py index e2d12afe4..0f41f0136 100644 --- a/repoman/pym/repoman/modules/linechecks/helpers/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/helpers/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "NoOffsetWithHelpers", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/nested/__init__.py b/repoman/pym/repoman/modules/linechecks/nested/__init__.py index 8eeeccbac..6c8a70a52 100644 --- a/repoman/pym/repoman/modules/linechecks/nested/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/nested/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "EbuildNestedDie", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/patches/__init__.py b/repoman/pym/repoman/modules/linechecks/patches/__init__.py index 67434f911..4fe0fcf5e 100644 --- a/repoman/pym/repoman/modules/linechecks/patches/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/patches/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "EbuildPatches", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py index 476443b25..b3228c0f7 100644 --- a/repoman/pym/repoman/modules/linechecks/phases/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py @@ -29,6 +29,7 @@ module_spec = { 'class': "SrcUnpackPatches", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py index d390c6054..b9a84b507 100644 --- a/repoman/pym/repoman/modules/linechecks/portage/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py @@ -22,6 +22,7 @@ module_spec = { 'class': "PortageInternalVariableAssignment", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py index 6043ab20c..894ef58d2 100644 --- a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py @@ -22,6 +22,7 @@ module_spec = { 'class': "EbuildQuotedA", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/uri/__init__.py b/repoman/pym/repoman/modules/linechecks/uri/__init__.py index a7731e3cc..e19617257 100644 --- a/repoman/pym/repoman/modules/linechecks/uri/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/uri/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "UriUseHttps", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/use/__init__.py b/repoman/pym/repoman/modules/linechecks/use/__init__.py index e5665d2d8..e97b0d61d 100644 --- a/repoman/pym/repoman/modules/linechecks/use/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/use/__init__.py @@ -16,6 +16,7 @@ module_spec = { 'class': "BuiltWithUse", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/useless/__init__.py b/repoman/pym/repoman/modules/linechecks/useless/__init__.py index acc4479f5..5cf978137 100644 --- a/repoman/pym/repoman/modules/linechecks/useless/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/useless/__init__.py @@ -22,6 +22,7 @@ module_spec = { 'class': "EbuildUselessDodoc", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py b/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py index ded690ed7..716c5129c 100644 --- a/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py @@ -22,6 +22,7 @@ module_spec = { 'class': "EbuildBlankLine", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/linechecks/workaround/__init__.py b/repoman/pym/repoman/modules/linechecks/workaround/__init__.py index 0b5aa70c8..425085a5c 100644 --- a/repoman/pym/repoman/modules/linechecks/workaround/__init__.py +++ b/repoman/pym/repoman/modules/linechecks/workaround/__init__.py @@ -22,6 +22,7 @@ module_spec = { 'class': "NoAsNeeded", 'description': doc, }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/depend/__init__.py b/repoman/pym/repoman/modules/scan/depend/__init__.py index bd6905c0b..c3cc0ddeb 100644 --- a/repoman/pym/repoman/modules/scan/depend/__init__.py +++ b/repoman/pym/repoman/modules/scan/depend/__init__.py @@ -28,6 +28,7 @@ module_spec = { }, 'module_runsIn': ['ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/directories/__init__.py b/repoman/pym/repoman/modules/scan/directories/__init__.py index 18ca086ce..276bc7ae9 100644 --- a/repoman/pym/repoman/modules/scan/directories/__init__.py +++ b/repoman/pym/repoman/modules/scan/directories/__init__.py @@ -45,6 +45,7 @@ module_spec = { }, 'module_runsIn': ['ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/eapi/__init__.py b/repoman/pym/repoman/modules/scan/eapi/__init__.py index f6306b3e1..94759fdd7 100644 --- a/repoman/pym/repoman/modules/scan/eapi/__init__.py +++ b/repoman/pym/repoman/modules/scan/eapi/__init__.py @@ -25,6 +25,7 @@ module_spec = { }, 'module_runsIn': ['ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/ebuild/__init__.py b/repoman/pym/repoman/modules/scan/ebuild/__init__.py index 1d8ec1941..328a0d626 100644 --- a/repoman/pym/repoman/modules/scan/ebuild/__init__.py +++ b/repoman/pym/repoman/modules/scan/ebuild/__init__.py @@ -55,6 +55,7 @@ module_spec = { }, 'module_runsIn': ['ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/eclasses/__init__.py b/repoman/pym/repoman/modules/scan/eclasses/__init__.py index 9b1f203ce..234ef9fca 100644 --- a/repoman/pym/repoman/modules/scan/eclasses/__init__.py +++ b/repoman/pym/repoman/modules/scan/eclasses/__init__.py @@ -44,6 +44,7 @@ module_spec = { }, 'module_runsIn': ['ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/fetch/__init__.py b/repoman/pym/repoman/modules/scan/fetch/__init__.py index d1b4f8d0e..30db3f529 100644 --- a/repoman/pym/repoman/modules/scan/fetch/__init__.py +++ b/repoman/pym/repoman/modules/scan/fetch/__init__.py @@ -29,6 +29,7 @@ module_spec = { }, 'module_runsIn': ['pkgs', 'ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/keywords/__init__.py b/repoman/pym/repoman/modules/scan/keywords/__init__.py index 88ea5aca9..d4c1281bc 100644 --- a/repoman/pym/repoman/modules/scan/keywords/__init__.py +++ b/repoman/pym/repoman/modules/scan/keywords/__init__.py @@ -29,6 +29,7 @@ module_spec = { }, 'module_runsIn': ['pkgs', 'ebuilds', 'final'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/manifest/__init__.py b/repoman/pym/repoman/modules/scan/manifest/__init__.py index 94f0a1f35..9e05c5288 100644 --- a/repoman/pym/repoman/modules/scan/manifest/__init__.py +++ b/repoman/pym/repoman/modules/scan/manifest/__init__.py @@ -26,6 +26,7 @@ module_spec = { }, 'module_runsIn': ['pkgs'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/metadata/__init__.py b/repoman/pym/repoman/modules/scan/metadata/__init__.py index 2d111b4e0..fccde99b5 100644 --- a/repoman/pym/repoman/modules/scan/metadata/__init__.py +++ b/repoman/pym/repoman/modules/scan/metadata/__init__.py @@ -84,6 +84,7 @@ module_spec = { }, 'module_runsIn': ['ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/modules/scan/module.py b/repoman/pym/repoman/modules/scan/module.py index ba720386c..fc0c66ccb 100644 --- a/repoman/pym/repoman/modules/scan/module.py +++ b/repoman/pym/repoman/modules/scan/module.py @@ -10,6 +10,7 @@ import yaml from portage.module import InvalidModuleName, Modules from portage.util import stack_lists +from repoman.config import ConfigError MODULES_PATH = os.path.dirname(__file__) # initial development debug info @@ -20,7 +21,7 @@ class ModuleConfig(object): '''Holds the scan modules configuration information and creates the ordered list of modulles to run''' - def __init__(self, configpaths): + def __init__(self, configpaths, valid_versions=None): '''Module init @param configpaths: ordered list of filepaths to load @@ -37,13 +38,13 @@ class ModuleConfig(object): self.ebuilds_loop = [] self.final_loop = [] self.modules_forced = ['ebuild', 'mtime'] - self.load_configs() + self.load_configs(valid_versions=valid_versions) for loop in ['pkgs', 'ebuilds', 'final']: logging.debug("ModuleConfig; Processing loop %s", loop) setattr(self, '%s_loop' % loop, self._determine_list(loop)) self.linechecks = stack_lists(c['linechecks_modules'].split() for c in self._configs) - def load_configs(self, configpaths=None): + def load_configs(self, configpaths=None, valid_versions=None): '''load the config files in order @param configpaths: ordered list of filepaths to load @@ -62,6 +63,8 @@ class ModuleConfig(object): except IOError as error: logging,error("Failed to load file: %s", inputfile) logging.exception(error) + if configs[-1]['version'] not in valid_versions: + raise ConfigError("Invalid file version: %s in: %s\nPlease upgrade repoman" % (configs['version'], path)) logging.debug("ModuleConfig; completed : %s", path) logging.debug("ModuleConfig; new _configs: %s", configs) self._configs = configs diff --git a/repoman/pym/repoman/modules/scan/options/__init__.py b/repoman/pym/repoman/modules/scan/options/__init__.py index d62e75274..ffce474e5 100644 --- a/repoman/pym/repoman/modules/scan/options/__init__.py +++ b/repoman/pym/repoman/modules/scan/options/__init__.py @@ -24,6 +24,7 @@ module_spec = { }, 'module_runsIn': ['ebuilds'], }, - } + }, + 'version': 1, } diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py index e361dd62e..9c415154e 100644 --- a/repoman/pym/repoman/qa_data.py +++ b/repoman/pym/repoman/qa_data.py @@ -29,14 +29,14 @@ class QAData(object): self.no_exec = None - def load_repo_config(self, repopaths, options): + def load_repo_config(self, repopaths, options, valid_versions): '''Load the repository repoman qa_data.yml config @param repopaths: list of strings, The path of the repository being scanned This could be a parent repository using the repoman_masters layout.conf variable ''' - qadata = load_config([os.path.join(path,'qa_data.yaml') for path in repopaths], 'yaml') + qadata = load_config([os.path.join(path,'qa_data.yaml') for path in repopaths], 'yaml', valid_versions) if qadata == {}: logging.error("QAData: Failed to load a valid 'qa_data.yaml' file at paths: %s", repopaths) return False diff --git a/repoman/pym/repoman/repos.py b/repoman/pym/repoman/repos.py index 275dc862a..2454a1f69 100644 --- a/repoman/pym/repoman/repos.py +++ b/repoman/pym/repoman/repos.py @@ -53,7 +53,7 @@ class RepoSettings(object): logging.debug("RepoSettings: init(); load qadata") # load the repo specific configuration self.qadata = qadata - if not self.qadata.load_repo_config(self.masters_list, options): + if not self.qadata.load_repo_config(self.masters_list, options, repoman_settings.valid_versions): logging.error("Aborting...") sys.exit(1) logging.debug("RepoSettings: qadata loaded: %s", qadata.no_exec) diff --git a/repoman/pym/repoman/scanner.py b/repoman/pym/repoman/scanner.py index d61e50131..f203011e4 100644 --- a/repoman/pym/repoman/scanner.py +++ b/repoman/pym/repoman/scanner.py @@ -116,7 +116,8 @@ class Scanner(object): # Initialize the ModuleConfig class here # TODO Add layout.conf masters repository.yml config to the list to load/stack - self.moduleconfig = ModuleConfig(self.repo_settings.masters_list) + self.moduleconfig = ModuleConfig(self.repo_settings.masters_list, + self.repo_settings.repoman_settings.valid_versions) checks = {} # The --echangelog option causes automatic ChangeLog generation,