def load_checks_info(self, infopaths=None): """load the config files in order @param infopaths: ordered list of filepaths to load """ if infopaths: self.infopaths = infopaths elif not self.infopaths: logging.error( "LineChecksConfig; Error: No linechecks.yaml files defined") 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 logging.debug("LineChecksConfig: linechecks.yaml configs: %s", configs) self.info_config = configs self.errors = self.info_config["errors"] self.usex_supported_eapis = self.info_config.get( "usex_supported_eapis", []) self.in_iuse_supported_eapis = self.info_config.get( "in_iuse_supported_eapis", []) self.eclass_info_experimental_inherit = self.info_config.get( "eclass_info_experimental_inherit", []) self.get_libdir_supported_eapis = self.in_iuse_supported_eapis self.eclass_eapi_functions = { "usex": lambda eapi: eapi not in self.usex_supported_eapis, "in_iuse": lambda eapi: eapi not in self.in_iuse_supported_eapis, "get_libdir": lambda eapi: eapi not in self.get_libdir_supported_eapis, } # eclasses that export ${ECLASS}_src_(compile|configure|install) self.eclass_export_functions = self.info_config.get( "eclass_export_functions", []) self.eclass_info_experimental_inherit = self.info_config.get( "eclass_info_experimental_inherit", {}) # These are "eclasses are the whole ebuild" type thing. try: self.eclass_info_experimental_inherit["eutils"][ "exempt_eclasses"] = self.eclass_export_functions except KeyError: pass try: self.eclass_info_experimental_inherit["multilib"][ "exempt_eclasses"] = self.eclass_export_functions + [ "autotools", "libtool", "multilib-minimal", ] except KeyError: pass
def load_checks_info(self, infopaths=None): '''load the config files in order @param infopaths: ordered list of filepaths to load ''' if infopaths: self.infopaths = infopaths elif not self.infopaths: logging.error("LineChecksConfig; Error: No linechecks.yaml files defined") 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 logging.debug("LineChecksConfig: linechecks.yaml configs: %s", configs) self.info_config = configs self.errors = self.info_config['errors'] self.usex_supported_eapis = self.info_config.get('usex_supported_eapis', []) self.in_iuse_supported_eapis = self.info_config.get('in_iuse_supported_eapis', []) self.eclass_info_experimental_inherit = self.info_config.get('eclass_info_experimental_inherit', []) self.get_libdir_supported_eapis = self.in_iuse_supported_eapis self.eclass_eapi_functions = { "usex": lambda eapi: eapi not in self.usex_supported_eapis, "in_iuse": lambda eapi: eapi not in self.in_iuse_supported_eapis, "get_libdir": lambda eapi: eapi not in self.get_libdir_supported_eapis, } # eclasses that export ${ECLASS}_src_(compile|configure|install) self.eclass_export_functions = self.info_config.get('eclass_export_functions', []) self.eclass_info_experimental_inherit = self.info_config.get('eclass_info_experimental_inherit', {}) # These are "eclasses are the whole ebuild" type thing. try: self.eclass_info_experimental_inherit['eutils']['exempt_eclasses'] = self.eclass_export_functions except KeyError: pass try: self.eclass_info_experimental_inherit['multilib']['exempt_eclasses'] = self.eclass_export_functions + [ 'autotools', 'libtool', 'multilib-minimal'] except KeyError: pass
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 ''' # add our base qahelp repository_modules = options.experimental_repository_modules == 'y' if _not_installed: cnfdir = os.path.realpath(os.path.join(os.path.dirname( os.path.dirname(os.path.dirname(__file__))), 'cnf/qa_data')) else: cnfdir = os.path.join(portage.const.EPREFIX or '/', 'usr/share/repoman/qa_data') repomanpaths = [os.path.join(cnfdir, _file_) for _file_ in os.listdir(cnfdir)] logging.debug("QAData: cnfdir: %s, repomanpaths: %s", cnfdir, repomanpaths) if repository_modules: repopaths = [os.path.join(path,'qa_data.yaml') for path in repopaths] elif _not_installed: repopaths = [os.path.realpath(os.path.join(os.path.dirname( os.path.dirname(os.path.dirname(__file__))), 'cnf/repository/qa_data.yaml'))] else: repopaths = [os.path.join(portage.const.EPREFIX or '/', 'usr/share/repoman/repository/qa_data.yaml')] infopaths = repomanpaths + repopaths qadata = load_config(infopaths, None, valid_versions) if qadata == {}: logging.error("QAData: Failed to load a valid 'qa_data.yaml' file at paths: %s", infopaths) return False self.max_desc_len = qadata.get('max_description_length', 80) self.allowed_filename_chars = qadata.get("allowed_filename_chars", "a-zA-Z0-9._-+:") self.qahelp = qadata["qahelp"] logging.debug("qa_help primary keys: %s", sorted(self.qahelp)) self.qacats = [] for x in sorted(self.qahelp): for y in sorted(self.qahelp[x]): self.qacats.append('.'.join([x, y])) self.qacats.sort() self.qawarnings = set(qadata.get('qawarnings', [])) if options.experimental_inherit == 'y': # This is experimental, so it's non-fatal. self.qawarnings.add("inherit.missing") self.missingvars = qadata.get("missingvars", []) logging.debug("QAData: missingvars: %s", self.missingvars) self.allvars = set(x for x in portage.auxdbkeys if not x.startswith("UNUSED_")) self.allvars.update(Package.metadata_keys) self.allvars = sorted(self.allvars) for x in self.missingvars: x += ".missing" if x not in self.qacats: logging.warning('QAData: * missingvars values need to be added to qahelp ("%s")' % x) self.qacats.append(x) self.qawarnings.add(x) self.valid_restrict = frozenset(qadata.get("valid_restrict", [])) self.suspect_rdepend = frozenset(qadata.get("suspect_rdepend", [])) self.suspect_virtual = qadata.get("suspect_virtual", {}) self.ruby_deprecated = frozenset(qadata.get("ruby_deprecated", [])) # file.executable self.no_exec = frozenset(qadata.get("no_exec_files", [])) logging.debug("QAData: completed loading file: %s", repopaths) return True
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 ''' # add our base qahelp repository_modules = options.experimental_repository_modules == 'y' if _not_installed: cnfdir = os.path.realpath( os.path.join( os.path.dirname(os.path.dirname( os.path.dirname(__file__))), 'cnf/qa_data')) else: cnfdir = os.path.join(portage.const.EPREFIX or '/', 'usr/share/repoman/qa_data') repomanpaths = [ os.path.join(cnfdir, _file_) for _file_ in os.listdir(cnfdir) ] logging.debug("QAData: cnfdir: %s, repomanpaths: %s", cnfdir, repomanpaths) if repository_modules: repopaths = [ os.path.join(path, 'qa_data.yaml') for path in repopaths ] elif _not_installed: repopaths = [ os.path.realpath( os.path.join( os.path.dirname( os.path.dirname(os.path.dirname(__file__))), 'cnf/repository/qa_data.yaml')) ] else: repopaths = [ os.path.join(portage.const.EPREFIX or '/', 'usr/share/repoman/repository/qa_data.yaml') ] infopaths = repomanpaths + repopaths qadata = load_config(infopaths, None, valid_versions) if qadata == {}: logging.error( "QAData: Failed to load a valid 'qa_data.yaml' file at paths: %s", infopaths) return False self.max_desc_len = qadata.get('max_description_length', 80) self.allowed_filename_chars = qadata.get("allowed_filename_chars", "a-zA-Z0-9._-+:") self.qahelp = qadata["qahelp"] logging.debug("qa_help primary keys: %s", sorted(self.qahelp)) self.qacats = [] for x in sorted(self.qahelp): for y in sorted(self.qahelp[x]): self.qacats.append('.'.join([x, y])) self.qacats.sort() self.qawarnings = set(qadata.get('qawarnings', [])) if options.experimental_inherit == 'y': # This is experimental, so it's non-fatal. self.qawarnings.add("inherit.missing") self.missingvars = qadata.get("missingvars", []) logging.debug("QAData: missingvars: %s", self.missingvars) self.allvars = set(x for x in portage.auxdbkeys if not x.startswith("UNUSED_")) self.allvars.update(Package.metadata_keys) self.allvars = sorted(self.allvars) for x in self.missingvars: x += ".missing" if x not in self.qacats: logging.warning( 'QAData: * missingvars values need to be added to qahelp ("%s")' % x) self.qacats.append(x) self.qawarnings.add(x) self.valid_restrict = frozenset(qadata.get("valid_restrict", [])) self.suspect_rdepend = frozenset(qadata.get("suspect_rdepend", [])) self.suspect_virtual = qadata.get("suspect_virtual", {}) self.ruby_deprecated = frozenset(qadata.get("ruby_deprecated", [])) # file.executable self.no_exec = frozenset(qadata.get("no_exec_files", [])) logging.debug("QAData: completed loading file: %s", repopaths) return True