1 |
commit: 10badb74f85e62a89258f950a07b9ced82dc562a |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 5 18:16:44 2017 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 30 03:51:21 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=10badb74 |
7 |
|
8 |
repoman qa_data.py: Move the qahelp loading to a new /usr/share/repoman/qa_data directory |
9 |
|
10 |
This new directory can be installed to by third party add on modules that extend the checks. |
11 |
We can also in future use these file to get loaclized translations. |
12 |
|
13 |
repoman/cnf/qa_data/qa_data.yaml | 136 +++++++++++++++++++++++++++++++++++++++ |
14 |
repoman/pym/repoman/qa_data.py | 19 +++++- |
15 |
2 files changed, 152 insertions(+), 3 deletions(-) |
16 |
|
17 |
diff --git a/repoman/cnf/qa_data/qa_data.yaml b/repoman/cnf/qa_data/qa_data.yaml |
18 |
new file mode 100644 |
19 |
index 000000000..573cdb449 |
20 |
--- /dev/null |
21 |
+++ b/repoman/cnf/qa_data/qa_data.yaml |
22 |
@@ -0,0 +1,136 @@ |
23 |
+--- |
24 |
+# qa_help.yaml |
25 |
+ |
26 |
+# configuration file for the LineCheck plugins run via the multicheck |
27 |
+# scan module |
28 |
+ |
29 |
+# Repoman API version (do not edit) |
30 |
+version: 1 |
31 |
+# minimum |
32 |
+repoman_version: 2.3.3 |
33 |
+ |
34 |
+# qahelp: Primary QA help messages to describe the errors or warnings |
35 |
+# Dictionary |
36 |
+qahelp: |
37 |
+ Entries: |
38 |
+ IO_error: "Attempting to commit, and an IO error was encountered access the Entries file" |
39 |
+ changelog: |
40 |
+ ebuildadded: "An ebuild was added but the ChangeLog was not modified" |
41 |
+ missing: "Missing ChangeLog files" |
42 |
+ notadded: "ChangeLogs that exist but have not been added to cvs" |
43 |
+ dependency: |
44 |
+ bad: "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds)" |
45 |
+ badmasked: "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds)" |
46 |
+ badindev: "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in developing arch" |
47 |
+ badmaskedindev: "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in developing arch" |
48 |
+ badinexp: "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in experimental arch" |
49 |
+ badmaskedinexp: "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in experimental arch" |
50 |
+ badtilde: "Uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored)" |
51 |
+ missingslot: "RDEPEND matches more than one SLOT but does not specify a slot and/or use the := or :* slot operator" |
52 |
+ perlcore: "This ebuild directly depends on a package in perl-core; it should use the corresponding virtual instead." |
53 |
+ syntax: "Syntax error in dependency string (usually an extra/missing space/parenthesis)" |
54 |
+ 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)" |
55 |
+ badslotop: "RDEPEND contains ':=' slot operator under '||' dependency." |
56 |
+ DESCRIPTION: |
57 |
+ missing: "Ebuilds that have a missing or empty DESCRIPTION variable" |
58 |
+ toolong: "DESCRIPTION is over %d characters" |
59 |
+ digest: |
60 |
+ assumed: "Existing digest must be assumed correct (Package level only)" |
61 |
+ missing: "Some files listed in SRC_URI aren't referenced in the Manifest" |
62 |
+ unused: "Some files listed in the Manifest aren't referenced in SRC_URI" |
63 |
+ EAPI: |
64 |
+ definition: "EAPI definition does not conform to PMS section 7.3.1 (first non-comment, non-blank line)" |
65 |
+ deprecated: "Ebuilds that use features that are deprecated in the current EAPI" |
66 |
+ incompatible: "Ebuilds that use features that are only available with a different EAPI" |
67 |
+ unsupported: "Ebuilds that have an unsupported EAPI version (you must upgrade portage)" |
68 |
+ ebuild: |
69 |
+ absdosym: "This ebuild uses absolute target to dosym where relative symlink could be used instead" |
70 |
+ badheader: "This ebuild has a malformed header" |
71 |
+ invalidname: "Ebuild files with a non-parseable or syntactically incorrect name (or using 2.1 versioning extensions)" |
72 |
+ majorsyn: "This ebuild has a major syntax error that may cause the ebuild to fail partially or fully" |
73 |
+ minorsyn: "This ebuild has a minor syntax error that contravenes gentoo coding style" |
74 |
+ namenomatch: "Ebuild files that do not have the same name as their parent directory" |
75 |
+ notadded: "Ebuilds that exist but have not been added to the vcs" |
76 |
+ nesteddie: "Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild." |
77 |
+ output: "A simple sourcing of the ebuild produces output; this breaks ebuild policy." |
78 |
+ patches: "PATCHES variable should be a bash array to ensure white space safety" |
79 |
+ syntax: "Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure" |
80 |
+ file: |
81 |
+ executable: "Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need the executable bit" |
82 |
+ size: "Files in the files directory must be under 20 KiB" |
83 |
+ size-fatal: "Files in the files directory must be under 60 KiB" |
84 |
+ empty: "Empty file in the files directory" |
85 |
+ name: "File/dir name must be composed of only the following chars: %s " |
86 |
+ UTF8: "File is not UTF8 compliant" |
87 |
+ HOMEPAGE: |
88 |
+ missing: "Ebuilds that have a missing or empty HOMEPAGE variable" |
89 |
+ virtual: "Virtuals that have a non-empty HOMEPAGE variable" |
90 |
+ missingurischeme: "HOMEPAGE is missing an URI scheme" |
91 |
+ inherit: |
92 |
+ deprecated: "Ebuild inherits a deprecated eclass" |
93 |
+ missing: "Ebuild uses functions from an eclass but does not inherit it" |
94 |
+ unused: "Ebuild inherits an eclass but does not use it" |
95 |
+ IUSE: |
96 |
+ invalid: "This ebuild has a variable in IUSE that is not in the use.desc or its metadata.xml file" |
97 |
+ missing: "This ebuild has a USE conditional which references a flag that is not listed in IUSE" |
98 |
+ rubydeprecated: "The ebuild has set a ruby interpreter in USE_RUBY, that is not available as a ruby target anymore" |
99 |
+ java: |
100 |
+ eclassesnotused: "With virtual/jdk in DEPEND you must inherit a java eclass" |
101 |
+ KEYWORDS: |
102 |
+ dropped: "Ebuilds that appear to have dropped KEYWORDS for some arch" |
103 |
+ invalid: "This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found" |
104 |
+ missing: "Ebuilds that have a missing or empty KEYWORDS variable" |
105 |
+ stable: "Ebuilds that have been added directly with stable KEYWORDS" |
106 |
+ stupid: "Ebuilds that use KEYWORDS=-* instead of package.mask" |
107 |
+ LICENSE: |
108 |
+ deprecated: "This ebuild is listing a deprecated license." |
109 |
+ invalid: "This ebuild is listing a license that doesnt exist in portages license/ dir." |
110 |
+ missing: "Ebuilds that have a missing or empty LICENSE variable" |
111 |
+ syntax: "Syntax error in LICENSE (usually an extra/missing space/parenthesis)" |
112 |
+ virtual: "Virtuals that have a non-empty LICENSE variable" |
113 |
+ LIVEVCS: |
114 |
+ stable: "This ebuild is a live checkout from a VCS but has stable keywords." |
115 |
+ unmasked: "This ebuild is a live checkout from a VCS but has keywords and is not masked in the global package.mask." |
116 |
+ manifest: |
117 |
+ bad: "Manifest has missing or incorrect digests" |
118 |
+ metadata: |
119 |
+ bad: "Bad metadata.xml files" |
120 |
+ missing: "Missing metadata.xml files" |
121 |
+ warning: "Warnings in metadata.xml files" |
122 |
+ PDEPEND: |
123 |
+ suspect: "PDEPEND contains a package that usually only belongs in DEPEND." |
124 |
+ portage: |
125 |
+ internal: "The ebuild uses an internal Portage function or variable" |
126 |
+ PROPERTIES: |
127 |
+ syntax: "Syntax error in PROPERTIES (usually an extra/missing space/parenthesis)" |
128 |
+ RDEPEND: |
129 |
+ implicit: "RDEPEND is unset in the ebuild which triggers implicit RDEPEND=$DEPEND assignment (prior to EAPI 4)" |
130 |
+ suspect: "RDEPEND contains a package that usually only belongs in DEPEND." |
131 |
+ repo: |
132 |
+ eapi-banned: "The ebuild uses an EAPI which is banned by the repository's metadata/layout.conf settings" |
133 |
+ eapi-deprecated: "The ebuild uses an EAPI which is deprecated by the repository's metadata/layout.conf settings" |
134 |
+ RESTRICT: |
135 |
+ invalid: "This ebuild contains invalid RESTRICT values." |
136 |
+ syntax: "Syntax error in RESTRICT (usually an extra/missing space/parenthesis)" |
137 |
+ REQUIRED_USE: |
138 |
+ syntax: "Syntax error in REQUIRED_USE (usually an extra/missing space/parenthesis)" |
139 |
+ SLOT: |
140 |
+ invalid: "Ebuilds that have a missing or invalid SLOT variable value" |
141 |
+ SRC_URI: |
142 |
+ syntax: "Syntax error in SRC_URI (usually an extra/missing space/parenthesis)" |
143 |
+ mirror: "A uri listed in profiles/thirdpartymirrors is found in SRC_URI" |
144 |
+ upstream: |
145 |
+ workaround: "The ebuild works around an upstream bug, an upstream bug should be filed and tracked in bugs.gentoo.org" |
146 |
+ uri: |
147 |
+ https: "URI uses http:// but should use https://" |
148 |
+ usage: |
149 |
+ obsolete: "The ebuild makes use of an obsolete construct" |
150 |
+ variable: |
151 |
+ invalidchar: "A variable contains an invalid character that is not part of the ASCII character set" |
152 |
+ readonly: "Assigning a readonly variable" |
153 |
+ usedwithhelpers: "Ebuild uses D, ROOT, ED, EROOT or EPREFIX with helpers" |
154 |
+ virtual: |
155 |
+ suspect: "Ebuild contains a package that usually should be pulled via virtual/, not directly." |
156 |
+ wxwidgets: |
157 |
+ eclassnotused: "Ebuild DEPENDs on x11-libs/wxGTK without inheriting wxwidgets.eclass" |
158 |
+ |
159 |
|
160 |
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py |
161 |
index 11f00d897..f80ee5a1f 100644 |
162 |
--- a/repoman/pym/repoman/qa_data.py |
163 |
+++ b/repoman/pym/repoman/qa_data.py |
164 |
@@ -6,6 +6,7 @@ import os |
165 |
from _emerge.Package import Package |
166 |
|
167 |
# import our initialized portage instance |
168 |
+from repoman import _not_installed |
169 |
from repoman._portage import portage |
170 |
from repoman.config import load_config |
171 |
|
172 |
@@ -35,14 +36,26 @@ class QAData(object): |
173 |
This could be a parent repository using the |
174 |
repoman_masters layout.conf variable |
175 |
''' |
176 |
- qadata = load_config([os.path.join(path,'qa_data.yaml') for path in repopaths], 'yaml', valid_versions) |
177 |
+ # add our base qahelp |
178 |
+ if _not_installed: |
179 |
+ cnfdir = os.path.realpath(os.path.join(os.path.dirname( |
180 |
+ os.path.dirname(os.path.dirname(__file__))), 'cnf/qa_data')) |
181 |
+ else: |
182 |
+ cnfdir = os.path.join(portage.const.EPREFIX or '/', 'usr/share/repoman/qa_data') |
183 |
+ repomanpaths = [os.path.join(cnfdir, _file_) for _file_ in os.listdir(cnfdir)] |
184 |
+ logging.debug("QAData: cnfdir: %s, repomanpaths: %s", cnfdir, repomanpaths) |
185 |
+ repopaths = [os.path.join(path,'qa_data.yaml') for path in repopaths] |
186 |
+ infopaths = repomanpaths + repopaths |
187 |
+ |
188 |
+ qadata = load_config(infopaths, None, valid_versions) |
189 |
if qadata == {}: |
190 |
- logging.error("QAData: Failed to load a valid 'qa_data.yaml' file at paths: %s", repopaths) |
191 |
+ logging.error("QAData: Failed to load a valid 'qa_data.yaml' file at paths: %s", infopaths) |
192 |
return False |
193 |
self.max_desc_len = qadata.get('max_description_length', 80) |
194 |
self.allowed_filename_chars = qadata.get("allowed_filename_chars", "a-zA-Z0-9._-+:") |
195 |
|
196 |
- self.qahelp = qadata.get('qahelp', {}) |
197 |
+ self.qahelp = qadata["qahelp"] |
198 |
+ logging.debug("qa_help primary keys: %s", sorted(self.qahelp)) |
199 |
|
200 |
self.qacats = [] |
201 |
for x in sorted(self.qahelp): |