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 B61651396D0 for ; Mon, 11 Sep 2017 21:43:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 289C61FC06A; Mon, 11 Sep 2017 21:43:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 EF9551FC06A for ; Mon, 11 Sep 2017 21:43:55 +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 771993417EF for ; Mon, 11 Sep 2017 21:43:54 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E081C9085 for ; Mon, 11 Sep 2017 21:43:51 +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: <1505146396.9f46eba88b7bcacdfde619ff4006b0bb850a39b6.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: 9f46eba88b7bcacdfde619ff4006b0bb850a39b6 X-VCS-Branch: repoman Date: Mon, 11 Sep 2017 21:43:51 +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: 1fa46604-0f74-4e03-a746-e603d4af3cc3 X-Archives-Hash: 7861cfd6db8ddb6bdf5a9c4a463b3ab6 commit: 9f46eba88b7bcacdfde619ff4006b0bb850a39b6 Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 15 01:05:03 2017 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Mon Sep 11 16:13:16 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9f46eba8 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'