commit:     1a251341eb244cb84028f9e3892cefb283c04f36
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  5 18:16:44 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 00:43:47 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1a251341

repoman qa_data.py: Move the qahelp loading to a new /usr/share/repoman/qa_data 
directory

This new directory can be installed to by third party add on modules that 
extend the checks.
We can also in future use these file to get loaclized translations.

 repoman/cnf/qa_data/qa_data.yaml | 139 +++++++++++++++++++++++++++++++++++++++
 repoman/pym/repoman/qa_data.py   |  19 +++++-
 2 files changed, 155 insertions(+), 3 deletions(-)

diff --git a/repoman/cnf/qa_data/qa_data.yaml b/repoman/cnf/qa_data/qa_data.yaml
new file mode 100644
index 000000000..c9fa2c024
--- /dev/null
+++ b/repoman/cnf/qa_data/qa_data.yaml
@@ -0,0 +1,139 @@
+---
+# qa_help.yaml
+
+# configuration file for the LineCheck plugins run via the multicheck
+# scan module
+
+# Repoman API version (do not edit)
+version: 1
+# minimum
+repoman_version: 2.3.3
+
+# qahelp: Primary QA help messages to describe the errors or warnings
+# Dictionary
+qahelp:
+    Entries:
+        IO_error: "Attempting to commit, and an IO error was encountered 
access the Entries file"
+    changelog:
+        ebuildadded: "An ebuild was added but the ChangeLog was not modified"
+        missing: "Missing ChangeLog files"
+        notadded: "ChangeLogs that exist but have not been added to cvs"
+    dependency:
+        bad: "User-visible ebuilds with unsatisfied dependencies (matched 
against *visible* ebuilds)"
+        badmasked: "Masked ebuilds with unsatisfied dependencies (matched 
against *all* ebuilds)"
+        badindev: "User-visible ebuilds with unsatisfied dependencies (matched 
against *visible* ebuilds) in developing arch"
+        badmaskedindev: "Masked ebuilds with unsatisfied dependencies (matched 
against *all* ebuilds) in developing arch"
+        badinexp: "User-visible ebuilds with unsatisfied dependencies (matched 
against *visible* ebuilds) in experimental arch"
+        badmaskedinexp: "Masked ebuilds with unsatisfied dependencies (matched 
against *all* ebuilds) in experimental arch"
+        badtilde: "Uses the ~ dep operator with a non-zero revision part, 
which is useless (the revision is ignored)"
+        missingslot: "RDEPEND matches more than one SLOT but does not specify 
a slot and/or use the := or :* slot operator"
+        perlcore: "This ebuild directly depends on a package in perl-core; it 
should use the corresponding virtual instead."
+        syntax: "Syntax error in dependency string (usually an extra/missing 
space/parenthesis)"
+        unknown: "Ebuild has a dependency that refers to an unknown package 
(which may be valid if it is a blocker for a renamed/removed package, or is an 
alternative choice provided by an overlay)"
+        badslotop: "RDEPEND contains ':=' slot operator under '||' dependency."
+    DESCRIPTION:
+        missing: "Ebuilds that have a missing or empty DESCRIPTION variable"
+        toolong: "DESCRIPTION is over %d characters"
+    digest:
+        assumed: "Existing digest must be assumed correct (Package level only)"
+        missing: "Some files listed in SRC_URI aren't referenced in the 
Manifest"
+        unused: "Some files listed in the Manifest aren't referenced in 
SRC_URI"
+    EAPI:
+        definition: "EAPI definition does not conform to PMS section 7.3.1 
(first non-comment, non-blank line)"
+        deprecated: "Ebuilds that use features that are deprecated in the 
current EAPI"
+        incompatible: "Ebuilds that use features that are only available with 
a different EAPI"
+        unsupported: "Ebuilds that have an unsupported EAPI version (you must 
upgrade portage)"
+    ebuild:
+        absdosym: "This ebuild uses absolute target to dosym where relative 
symlink could be used instead"
+        badheader: "This ebuild has a malformed header"
+        invalidname: "Ebuild files with a non-parseable or syntactically 
incorrect name (or using 2.1 versioning extensions)"
+        majorsyn: "This ebuild has a major syntax error that may cause the 
ebuild to fail partially or fully"
+        minorsyn: "This ebuild has a minor syntax error that contravenes 
gentoo coding style"
+        namenomatch: "Ebuild files that do not have the same name as their 
parent directory"
+        notadded: "Ebuilds that exist but have not been added to the vcs"
+        nesteddie: "Placing 'die' inside ( ) prints an error, but doesn't stop 
the ebuild."
+        output: "A simple sourcing of the ebuild produces output; this breaks 
ebuild policy."
+        patches: "PATCHES variable should be a bash array to ensure white 
space safety"
+        syntax: "Error generating cache entry for ebuild; typically caused by 
ebuild syntax error or digest verification failure"
+    file:
+        executable: "Ebuilds, digests, metadata.xml, Manifest, and ChangeLog 
do not need the executable bit"
+        size: "Files in the files directory must be under 20 KiB"
+        size-fatal: "Files in the files directory must be under 60 KiB"
+        empty: "Empty file in the files directory"
+        name: "File/dir name must be composed of only the following chars: %s "
+        UTF8: "File is not UTF8 compliant"
+    HOMEPAGE:
+        missing: "Ebuilds that have a missing or empty HOMEPAGE variable"
+        virtual: "Virtuals that have a non-empty HOMEPAGE variable"
+        missingurischeme: "HOMEPAGE is missing an URI scheme"
+    inherit:
+        deprecated: "Ebuild inherits a deprecated eclass"
+        missing: "Ebuild uses functions from an eclass but does not inherit it"
+        unused: "Ebuild inherits an eclass but does not use it"
+    IUSE:
+        invalid: "This ebuild has a variable in IUSE that is not in the 
use.desc or its metadata.xml file"
+        missing: "This ebuild has a USE conditional which references a flag 
that is not listed in IUSE"
+        rubydeprecated: "The ebuild has set a ruby interpreter in USE_RUBY, 
that is not available as a ruby target anymore"
+    java:
+        eclassesnotused: "With virtual/jdk in DEPEND you must inherit a java 
eclass"
+    KEYWORDS:
+        dropped: "Ebuilds that appear to have dropped KEYWORDS for some arch"
+        invalid: "This ebuild contains KEYWORDS that are not listed in 
profiles/arch.list or for which no valid profile was found"
+        missing: "Ebuilds that have a missing or empty KEYWORDS variable"
+        stable: "Ebuilds that have been added directly with stable KEYWORDS"
+        stupid: "Ebuilds that use KEYWORDS=-* instead of package.mask"
+    LICENSE:
+        deprecated: "This ebuild is listing a deprecated license."
+        invalid: "This ebuild is listing a license that doesnt exist in 
portages license/ dir."
+        missing: "Ebuilds that have a missing or empty LICENSE variable"
+        syntax: "Syntax error in LICENSE (usually an extra/missing 
space/parenthesis)"
+        virtual: "Virtuals that have a non-empty LICENSE variable"
+    LIVEVCS:
+        stable: "This ebuild is a live checkout from a VCS but has stable 
keywords."
+        unmasked: "This ebuild is a live checkout from a VCS but has keywords 
and is not masked in the global package.mask."
+    manifest:
+        bad: "Manifest has missing or incorrect digests"
+    metadata:
+        bad: "Bad metadata.xml files"
+        missing: "Missing metadata.xml files"
+        warning: "Warnings in metadata.xml files"
+    PDEPEND:
+        suspect: "PDEPEND contains a package that usually only belongs in 
DEPEND."
+    portage:
+        internal: "The ebuild uses an internal Portage function or variable"
+    PROVIDE:
+        syntax: "Syntax error in PROVIDE (usually an extra/missing 
space/parenthesis)"
+    PROPERTIES:
+        syntax: "Syntax error in PROPERTIES (usually an extra/missing 
space/parenthesis)"
+    RDEPEND:
+        implicit: "RDEPEND is unset in the ebuild which triggers implicit 
RDEPEND=$DEPEND assignment (prior to EAPI 4)"
+        suspect: "RDEPEND contains a package that usually only belongs in 
DEPEND."
+    repo:
+        eapi-banned: "The ebuild uses an EAPI which is banned by the 
repository's metadata/layout.conf settings"
+        eapi-deprecated: "The ebuild uses an EAPI which is deprecated by the 
repository's metadata/layout.conf settings"
+    RESTRICT:
+        invalid: "This ebuild contains invalid RESTRICT values."
+        syntax: "Syntax error in RESTRICT (usually an extra/missing 
space/parenthesis)"
+    REQUIRED_USE:
+        syntax: "Syntax error in REQUIRED_USE (usually an extra/missing 
space/parenthesis)"
+    SLOT:
+        invalid: "Ebuilds that have a missing or invalid SLOT variable value"
+    SRC_URI:
+        syntax: "Syntax error in SRC_URI (usually an extra/missing 
space/parenthesis)"
+        mirror: "A uri listed in profiles/thirdpartymirrors is found in 
SRC_URI"
+    upstream:
+        workaround: "The ebuild works around an upstream bug, an upstream bug 
should be filed and tracked in bugs.gentoo.org"
+    uri:
+        https: "URI uses http:// but should use https://";
+    usage:
+        obsolete: "The ebuild makes use of an obsolete construct"
+    variable:
+        invalidchar: "A variable contains an invalid character that is not 
part of the ASCII character set"
+        readonly: "Assigning a readonly variable"
+        usedwithhelpers: "Ebuild uses D, ROOT, ED, EROOT or EPREFIX with 
helpers"
+        oldstyle: "The ebuild PROVIDEs an old-style virtual (see GLEP 37)"
+    virtual:
+        suspect: "Ebuild contains a package that usually should be pulled via 
virtual/, not directly."
+    wxwidgets:
+        eclassnotused: "Ebuild DEPENDs on x11-libs/wxGTK without inheriting 
wxwidgets.eclass"
+

diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index 11f00d897..f80ee5a1f 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -6,6 +6,7 @@ import os
 from _emerge.Package import Package
 
 # import our initialized portage instance
+from repoman import _not_installed
 from repoman._portage import portage
 from repoman.config import load_config
 
@@ -35,14 +36,26 @@ class QAData(object):
                                                 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', valid_versions)
+               # add our base qahelp
+               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)
+               repopaths = [os.path.join(path,'qa_data.yaml') for path in 
repopaths]
+               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", repopaths)
+                       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.get('qahelp', {})
+               self.qahelp = qadata["qahelp"]
+               logging.debug("qa_help primary keys: %s", sorted(self.qahelp))
 
                self.qacats = []
                for x in sorted(self.qahelp):

Reply via email to