From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 52C26139083 for ; Wed, 6 Dec 2017 00:16:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 88661E1148; Wed, 6 Dec 2017 00:16:44 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 56CD5E1148 for ; Wed, 6 Dec 2017 00:16:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5792C33BF24 for ; Wed, 6 Dec 2017 00:16:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B3CEDAE7C for ; Wed, 6 Dec 2017 00:16:40 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1512519207.816fddfef045b9507fb076c6465f9cd08b79a3a6.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/uri/ X-VCS-Repository: proj/portage X-VCS-Files: repoman/pym/repoman/modules/linechecks/uri/__init__.py repoman/pym/repoman/modules/linechecks/uri/uri.py X-VCS-Directories: repoman/pym/repoman/modules/linechecks/uri/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 816fddfef045b9507fb076c6465f9cd08b79a3a6 X-VCS-Branch: repoman Date: Wed, 6 Dec 2017 00:16:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: cb10ad6f-b8c5-4059-9ab8-afd7d5fe137c X-Archives-Hash: 69287f52f8ad98d742f0554d4ed762c1 commit: 816fddfef045b9507fb076c6465f9cd08b79a3a6 Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 15 01:05:03 2017 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Wed Dec 6 00:13:27 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=816fddfe repoman: New linechecks module, uri .../pym/repoman/modules/linechecks/uri/__init__.py | 21 +++++++++++++++ repoman/pym/repoman/modules/linechecks/uri/uri.py | 30 ++++++++++++++++++++++ 2 files changed, 51 insertions(+) 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'