1 |
commit: f7cb68a8d05fa555cc52ac7117ad50456060129b |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jul 15 01:05:03 2017 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 30 03:51:19 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f7cb68a8 |
7 |
|
8 |
repoman: New linechecks module, uri |
9 |
|
10 |
.../pym/repoman/modules/linechecks/uri/__init__.py | 21 +++++++++++++++ |
11 |
repoman/pym/repoman/modules/linechecks/uri/uri.py | 30 ++++++++++++++++++++++ |
12 |
2 files changed, 51 insertions(+) |
13 |
|
14 |
diff --git a/repoman/pym/repoman/modules/linechecks/uri/__init__.py b/repoman/pym/repoman/modules/linechecks/uri/__init__.py |
15 |
new file mode 100644 |
16 |
index 000000000..a7731e3cc |
17 |
--- /dev/null |
18 |
+++ b/repoman/pym/repoman/modules/linechecks/uri/__init__.py |
19 |
@@ -0,0 +1,21 @@ |
20 |
+# Copyright 2015-2016 Gentoo Foundation |
21 |
+# Distributed under the terms of the GNU General Public License v2 |
22 |
+ |
23 |
+doc = """Uri plug-in module for repoman LineChecks. |
24 |
+Performs HOMEPAGE variable checks on ebuilds.""" |
25 |
+__doc__ = doc[:] |
26 |
+ |
27 |
+ |
28 |
+module_spec = { |
29 |
+ 'name': 'do', |
30 |
+ 'description': doc, |
31 |
+ 'provides':{ |
32 |
+ 'httpsuri-check': { |
33 |
+ 'name': "httpsuri", |
34 |
+ 'sourcefile': "uri", |
35 |
+ 'class': "UriUseHttps", |
36 |
+ 'description': doc, |
37 |
+ }, |
38 |
+ } |
39 |
+} |
40 |
+ |
41 |
|
42 |
diff --git a/repoman/pym/repoman/modules/linechecks/uri/uri.py b/repoman/pym/repoman/modules/linechecks/uri/uri.py |
43 |
new file mode 100644 |
44 |
index 000000000..1a0afe682 |
45 |
--- /dev/null |
46 |
+++ b/repoman/pym/repoman/modules/linechecks/uri/uri.py |
47 |
@@ -0,0 +1,30 @@ |
48 |
+ |
49 |
+import re |
50 |
+ |
51 |
+from repoman.modules.linechecks.base import LineCheck |
52 |
+ |
53 |
+ |
54 |
+class UriUseHttps(LineCheck): |
55 |
+ """Check that we use https:// for known good sites.""" |
56 |
+ repoman_check_name = 'uri.https' |
57 |
+ _SITES = ( |
58 |
+ '([-._a-zA-Z0-9]*\.)?apache\.org', |
59 |
+ '((alioth|packages(\.qa)?|people|www)\.)?debian\.org', |
60 |
+ # Most FDO sites support https, but not all (like tango). |
61 |
+ # List the most common ones here for now. |
62 |
+ '((anongit|bugs|cgit|dri|patchwork|people|specifications|www|xcb|xorg)\.)?freedesktop\.org', |
63 |
+ '((bugs|dev|wiki|www)\.)?gentoo\.org', |
64 |
+ '((wiki)\.)?github\.(io|com)', |
65 |
+ 'savannah\.(non)?gnu\.org', |
66 |
+ '((gcc|www)\.)?gnu\.org', |
67 |
+ 'curl\.haxx\.se', |
68 |
+ '((bugzilla|git|mirrors|patchwork|planet|www(\.wiki)?)\.)?kernel\.org', |
69 |
+ '((bugs|wiki|www)\.)?linuxfoundation\.org', |
70 |
+ '((docs|pypi|www)\.)?python\.org', |
71 |
+ '(sf|sourceforge)\.net', |
72 |
+ '(www\.)?(enlightenment|sourceware|x)\.org', |
73 |
+ ) |
74 |
+ # Try to anchor the end of the URL so we don't get false positives |
75 |
+ # with http://github.com.foo.bar.com/. Unlikely, but possible. |
76 |
+ re = re.compile(r'.*\bhttp://(%s)(\s|["\'/]|$)' % r'|'.join(_SITES)) |
77 |
+ error = 'URI_HTTPS' |