aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-10 21:40:40 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:15 -0700
commitaa852351f3e37390f06ad284a0bdf123267bd818 (patch)
tree7ed6159c36b245f716db443201dfcd31d768838d
parentrepoman: scanner.py: Update module loading to use masters_list (diff)
downloadportage-aa852351f3e37390f06ad284a0bdf123267bd818.tar.gz
portage-aa852351f3e37390f06ad284a0bdf123267bd818.tar.bz2
portage-aa852351f3e37390f06ad284a0bdf123267bd818.zip
repoman: qa_data.py: Make it use masters stacking
Update logging message with 'QAData: ' prefix Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
-rw-r--r--repoman/pym/repoman/qa_data.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index fed556628..2ccea1996 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -28,21 +28,31 @@ class QAData(object):
self.no_exec = None
- def load_repo_config(self, repopath, options):
+ def load_repo_config(self, repopaths, options):
'''Load the repository repoman qa_data.yml config
- @param repopath: string, The path of the repository being scanned
+ @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
'''
- filepath = os.path.join(repopath, 'metadata/repoman/qa_data.yml')
- logging.debug("QAData: reading file: %s", filepath)
- try:
- with open(filepath, 'r') as qadata_file:
- qadata = yaml.safe_load(qadata_file.read())
- except IOError as error:
- logging.error("Failed to load 'qa_data.yml' file at path: %s", filepath)
- logging.eception(error)
+ qadata = {}
+ for path in repopaths:
+ filepath = os.path.join(path, 'qa_data.yaml')
+ logging.debug("QAData: reading file: %s", filepath)
+ try:
+ with open(filepath, 'r') as qadata_file:
+ new_qadata = yaml.safe_load(qadata_file.read())
+ logging.debug("QAData: updating qadata with new values from: %s", filepath)
+ qadata.update(new_qadata)
+ except FileNotFoundError:
+ # skip a master that may not have our file
+ logging.debug("QAData: File not found at path: %s", filepath)
+ except IOError as error:
+ logging.error("QAData: Failed to load 'qa_data.yaml' file at path: %s", filepath)
+ logging.exception(error)
+ return False
+ if qadata == {}:
+ logging.error("QAData: Failed to load a valid 'qa_data.yaml' file at paths: %s", repopaths)
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._-+:")
@@ -69,7 +79,7 @@ class QAData(object):
for x in self.missingvars:
x += ".missing"
if x not in self.qacats:
- logging.warning('* missingvars values need to be added to qahelp ("%s")' % x)
+ logging.warning('QAData: * missingvars values need to be added to qahelp ("%s")' % x)
self.qacats.append(x)
self.qawarnings.add(x)