aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-15 01:05:03 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:19 -0700
commitf7cb68a8d05fa555cc52ac7117ad50456060129b (patch)
tree942f5f46afd86797d6b5c76035db5d2adf3a0609
parentrepoman: New linechecks module, quotes (diff)
downloadportage-f7cb68a8d05fa555cc52ac7117ad50456060129b.tar.gz
portage-f7cb68a8d05fa555cc52ac7117ad50456060129b.tar.bz2
portage-f7cb68a8d05fa555cc52ac7117ad50456060129b.zip
repoman: New linechecks module, uri
-rw-r--r--repoman/pym/repoman/modules/linechecks/uri/__init__.py21
-rw-r--r--repoman/pym/repoman/modules/linechecks/uri/uri.py30
2 files changed, 51 insertions, 0 deletions
diff --git a/repoman/pym/repoman/modules/linechecks/uri/__init__.py b/repoman/pym/repoman/modules/linechecks/uri/__init__.py
new file mode 100644
index 000000000..a7731e3cc
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/uri/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Uri plug-in module for repoman LineChecks.
+Performs HOMEPAGE variable checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'do',
+ 'description': doc,
+ 'provides':{
+ 'httpsuri-check': {
+ 'name': "httpsuri",
+ 'sourcefile': "uri",
+ 'class': "UriUseHttps",
+ 'description': doc,
+ },
+ }
+}
+
diff --git a/repoman/pym/repoman/modules/linechecks/uri/uri.py b/repoman/pym/repoman/modules/linechecks/uri/uri.py
new file mode 100644
index 000000000..1a0afe682
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/uri/uri.py
@@ -0,0 +1,30 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class UriUseHttps(LineCheck):
+ """Check that we use https:// for known good sites."""
+ repoman_check_name = 'uri.https'
+ _SITES = (
+ '([-._a-zA-Z0-9]*\.)?apache\.org',
+ '((alioth|packages(\.qa)?|people|www)\.)?debian\.org',
+ # Most FDO sites support https, but not all (like tango).
+ # List the most common ones here for now.
+ '((anongit|bugs|cgit|dri|patchwork|people|specifications|www|xcb|xorg)\.)?freedesktop\.org',
+ '((bugs|dev|wiki|www)\.)?gentoo\.org',
+ '((wiki)\.)?github\.(io|com)',
+ 'savannah\.(non)?gnu\.org',
+ '((gcc|www)\.)?gnu\.org',
+ 'curl\.haxx\.se',
+ '((bugzilla|git|mirrors|patchwork|planet|www(\.wiki)?)\.)?kernel\.org',
+ '((bugs|wiki|www)\.)?linuxfoundation\.org',
+ '((docs|pypi|www)\.)?python\.org',
+ '(sf|sourceforge)\.net',
+ '(www\.)?(enlightenment|sourceware|x)\.org',
+ )
+ # Try to anchor the end of the URL so we don't get false positives
+ # with http://github.com.foo.bar.com/. Unlikely, but possible.
+ re = re.compile(r'.*\bhttp://(%s)(\s|["\'/]|$)' % r'|'.join(_SITES))
+ error = 'URI_HTTPS'