From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id F1EE71388BF for ; Wed, 6 Jan 2016 04:22:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 475B421C02C; Wed, 6 Jan 2016 04:21:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 06B3E21C006 for ; Wed, 6 Jan 2016 04:21:57 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F37C5340A69 for ; Wed, 6 Jan 2016 04:21:55 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5BAB9E5E for ; Wed, 6 Jan 2016 04:21:52 +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: <1452053304.59a03a85d16e779c0cd6b03d1b5f5505c7054a89.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/options/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/modules/scan/options/__init__.py pym/repoman/modules/scan/options/options.py pym/repoman/scanner.py X-VCS-Directories: pym/repoman/modules/scan/options/ pym/repoman/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 59a03a85d16e779c0cd6b03d1b5f5505c7054a89 X-VCS-Branch: repoman Date: Wed, 6 Jan 2016 04:21:52 +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: 2ffafeac-dd3b-44fa-8b6e-3c88a68424ec X-Archives-Hash: 25ce23a243071a992eba04d513f0608a commit: 59a03a85d16e779c0cd6b03d1b5f5505c7054a89 Author: Brian Dolbec gentoo org> AuthorDate: Mon Jan 4 07:55:55 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Wed Jan 6 04:08:24 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=59a03a85 repoman: Create a new options plugin This handles an options.force bypass using the is_forced() from withing the plugin system. pym/repoman/modules/scan/options/__init__.py | 23 +++++++++++++++++++++++ pym/repoman/modules/scan/options/options.py | 22 ++++++++++++++++++++++ pym/repoman/scanner.py | 10 ++-------- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/pym/repoman/modules/scan/options/__init__.py b/pym/repoman/modules/scan/options/__init__.py new file mode 100644 index 0000000..8424058 --- /dev/null +++ b/pym/repoman/modules/scan/options/__init__.py @@ -0,0 +1,23 @@ +# Copyright 2015-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +doc = """Options plug-in module for repoman. +Performs option related actions on ebuilds.""" +__doc__ = doc[:] + + +module_spec = { + 'name': 'options', + 'description': doc, + 'provides':{ + 'options-module': { + 'name': "options", + 'class': "Options", + 'description': doc, + 'functions': ['is_forced'], + 'func_desc': { + }, + }, + } +} + diff --git a/pym/repoman/modules/scan/options/options.py b/pym/repoman/modules/scan/options/options.py new file mode 100644 index 0000000..b592884 --- /dev/null +++ b/pym/repoman/modules/scan/options/options.py @@ -0,0 +1,22 @@ + + +class Options(object): + + def __init__(self, **kwargs): + self.options = kwargs.get('options') + + def is_forced(self, **kwargs): + if self.options.force: + # The dep_check() calls are the most expensive QA test. If --force + # is enabled, there's no point in wasting time on these since the + # user is intent on forcing the commit anyway. + return {'continue': True} + return {'continue': False} + + @property + def runInPkgs(self): + return (False, []) + + @property + def runInEbuilds(self): + return (True, [self.is_forced]) diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py index b6d2441..809b8db 100644 --- a/pym/repoman/scanner.py +++ b/pym/repoman/scanner.py @@ -292,6 +292,8 @@ class Scanner(object): ('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'), ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'), ('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'), + # Options.is_forced() is used to bypass further checks + ('options', 'Options'), ('profile', 'ProfileDependsChecks'), ]: if mod[0]: mod_class = MODULE_CONTROLLER.get_class(mod[0]) @@ -322,14 +324,6 @@ class Scanner(object): print("**** finished plugin loop, continuing...") - # Syntax Checks - - if self.options.force: - # The dep_check() calls are the most expensive QA test. If --force - # is enabled, there's no point in wasting time on these since the - # user is intent on forcing the commit anyway. - continue - relevant_profiles = [] for keyword, arch, groups in dynamic_data['arches']: if arch not in self.profiles: