1 |
commit: 71ed484f67919a13f97bfa4e0e9a251119df0c99 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jun 2 06:43:19 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Mon Jun 2 06:43:19 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=71ed484f |
7 |
|
8 |
repoman/main.py: Split out some small ebuild checks functions |
9 |
|
10 |
Create new checks/ebuilds/misc.py file |
11 |
Add bad_split_check(). |
12 |
Add pkg_invalid(). |
13 |
|
14 |
--- |
15 |
pym/repoman/checks/ebuilds/misc.py | 54 ++++++++++++++++++++++++++++++++++++++ |
16 |
pym/repoman/main.py | 29 ++++---------------- |
17 |
2 files changed, 59 insertions(+), 24 deletions(-) |
18 |
|
19 |
diff --git a/pym/repoman/checks/ebuilds/misc.py b/pym/repoman/checks/ebuilds/misc.py |
20 |
new file mode 100644 |
21 |
index 0000000..c1edd2c |
22 |
--- /dev/null |
23 |
+++ b/pym/repoman/checks/ebuilds/misc.py |
24 |
@@ -0,0 +1,54 @@ |
25 |
+ |
26 |
+'''repoman/checks/ebuilds/misc.py |
27 |
+Miscelaneous ebuild check functions''' |
28 |
+ |
29 |
+import re |
30 |
+ |
31 |
+import portage |
32 |
+ |
33 |
+ |
34 |
+pv_toolong_re = re.compile(r'[0-9]{19,}') |
35 |
+ |
36 |
+ |
37 |
+def bad_split_check(xpkg, y_ebuild, pkgdir, qatracker): |
38 |
+ '''Checks for bad category/package splits. |
39 |
+ |
40 |
+ @param xpkg: the pacakge being checked |
41 |
+ @param y_ebuild: string of the ebuild name being tested |
42 |
+ @param pkgdir: string: path |
43 |
+ @param qatracker: QATracker instance |
44 |
+ ''' |
45 |
+ myesplit = portage.pkgsplit(y_ebuild) |
46 |
+ |
47 |
+ is_bad_split = myesplit is None or myesplit[0] != xpkg.split("/")[-1] |
48 |
+ |
49 |
+ if is_bad_split: |
50 |
+ is_pv_toolong = pv_toolong_re.search(myesplit[1]) |
51 |
+ is_pv_toolong2 = pv_toolong_re.search(myesplit[2]) |
52 |
+ |
53 |
+ if is_pv_toolong or is_pv_toolong2: |
54 |
+ qatracker.add_error("ebuild.invalidname", |
55 |
+ xpkg + "/" + y_ebuild + ".ebuild") |
56 |
+ return True |
57 |
+ elif myesplit[0] != pkgdir: |
58 |
+ print(pkgdir, myesplit[0]) |
59 |
+ qatracker.add_error("ebuild.namenomatch", |
60 |
+ xpkg + "/" + y_ebuild + ".ebuild") |
61 |
+ return True |
62 |
+ return False |
63 |
+ |
64 |
+ |
65 |
+def pkg_invalid(pkg, qatracker): |
66 |
+ '''Checks for invalid packages |
67 |
+ |
68 |
+ @param pkg: _emerge.Package instance |
69 |
+ @param qatracker: QATracker instance |
70 |
+ @return boolean: |
71 |
+ ''' |
72 |
+ if pkg.invalid: |
73 |
+ for k, msgs in pkg.invalid.items(): |
74 |
+ for msg in msgs: |
75 |
+ qatracker.add_error(k, |
76 |
+ "%s: %s" % (ebuild.relative_path, msg)) |
77 |
+ return True |
78 |
+ return False |
79 |
|
80 |
diff --git a/pym/repoman/main.py b/pym/repoman/main.py |
81 |
index 9db52c0..c680752 100755 |
82 |
--- a/pym/repoman/main.py |
83 |
+++ b/pym/repoman/main.py |
84 |
@@ -51,6 +51,7 @@ from repoman.checks.ebuilds.fetches import FetchChecks |
85 |
from repoman.checks.ebuilds.isebuild import IsEbuild |
86 |
from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors |
87 |
from repoman.checks.ebuilds.manifests import Manifests |
88 |
+from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid |
89 |
from repoman.checks.ebuilds.pkgmetadata import PkgMetadata |
90 |
from repoman.ebuild import Ebuild |
91 |
from repoman.errors import err |
92 |
@@ -76,8 +77,6 @@ util.initialize_logger() |
93 |
|
94 |
commitmessage = None |
95 |
|
96 |
-pv_toolong_re = re.compile(r'[0-9]{19,}') |
97 |
- |
98 |
bad = create_color_func("BAD") |
99 |
|
100 |
live_eclasses = portage.const.LIVE_ECLASSES |
101 |
@@ -368,32 +367,14 @@ for xpkg in effective_scanlist: |
102 |
# ebuild not added to vcs |
103 |
qatracker.add_error("ebuild.notadded", |
104 |
xpkg + "/" + y_ebuild + ".ebuild") |
105 |
- myesplit = portage.pkgsplit(y_ebuild) |
106 |
- |
107 |
- is_bad_split = myesplit is None or myesplit[0] != xpkg.split("/")[-1] |
108 |
- |
109 |
- if is_bad_split: |
110 |
- is_pv_toolong = pv_toolong_re.search(myesplit[1]) |
111 |
- is_pv_toolong2 = pv_toolong_re.search(myesplit[2]) |
112 |
|
113 |
- if is_pv_toolong or is_pv_toolong2: |
114 |
- qatracker.add_error("ebuild.invalidname", |
115 |
- xpkg + "/" + y_ebuild + ".ebuild") |
116 |
- continue |
117 |
- elif myesplit[0] != pkgdir: |
118 |
- print(pkgdir, myesplit[0]) |
119 |
- qatracker.add_error("ebuild.namenomatch", |
120 |
- xpkg + "/" + y_ebuild + ".ebuild") |
121 |
+################## |
122 |
+ if bad_split_check(xpkg, y_ebuild, pkgdir, qatracker): |
123 |
continue |
124 |
- |
125 |
+################### |
126 |
pkg = pkgs[y_ebuild] |
127 |
- |
128 |
- if pkg.invalid: |
129 |
+ if pkg_invalid(pkg, qatracker): |
130 |
allvalid = False |
131 |
- for k, msgs in pkg.invalid.items(): |
132 |
- for msg in msgs: |
133 |
- qatracker.add_error(k, |
134 |
- "%s: %s" % (ebuild.relative_path, msg)) |
135 |
continue |
136 |
|
137 |
myaux = pkg._metadata |