Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/options/
Date: Sun, 31 Jan 2016 20:03:53
Message-Id: 1454185523.b2aed300f9d0f06a735c9759e7714308b3dfefd8.dolsen@gentoo
1 commit: b2aed300f9d0f06a735c9759e7714308b3dfefd8
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 4 07:55:55 2016 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 30 20:25:23 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b2aed300
7
8 repoman: Create a new Options class plugin
9
10 This handles an options.force bypass using the is_forced() from withing the plugin system.
11
12 pym/repoman/modules/scan/options/__init__.py | 24 ++++++++++++++++++++++++
13 pym/repoman/modules/scan/options/options.py | 22 ++++++++++++++++++++++
14 pym/repoman/scanner.py | 10 ++--------
15 3 files changed, 48 insertions(+), 8 deletions(-)
16
17 diff --git a/pym/repoman/modules/scan/options/__init__.py b/pym/repoman/modules/scan/options/__init__.py
18 new file mode 100644
19 index 0000000..2d3d9d2
20 --- /dev/null
21 +++ b/pym/repoman/modules/scan/options/__init__.py
22 @@ -0,0 +1,24 @@
23 +# Copyright 2015-2016 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +doc = """Options plug-in module for repoman.
27 +Performs option related actions on ebuilds."""
28 +__doc__ = doc[:]
29 +
30 +
31 +module_spec = {
32 + 'name': 'options',
33 + 'description': doc,
34 + 'provides':{
35 + 'options-module': {
36 + 'name': "options",
37 + 'sourcefile': "options",
38 + 'class': "Options",
39 + 'description': doc,
40 + 'functions': ['is_forced'],
41 + 'func_desc': {
42 + },
43 + },
44 + }
45 +}
46 +
47
48 diff --git a/pym/repoman/modules/scan/options/options.py b/pym/repoman/modules/scan/options/options.py
49 new file mode 100644
50 index 0000000..b592884
51 --- /dev/null
52 +++ b/pym/repoman/modules/scan/options/options.py
53 @@ -0,0 +1,22 @@
54 +
55 +
56 +class Options(object):
57 +
58 + def __init__(self, **kwargs):
59 + self.options = kwargs.get('options')
60 +
61 + def is_forced(self, **kwargs):
62 + if self.options.force:
63 + # The dep_check() calls are the most expensive QA test. If --force
64 + # is enabled, there's no point in wasting time on these since the
65 + # user is intent on forcing the commit anyway.
66 + return {'continue': True}
67 + return {'continue': False}
68 +
69 + @property
70 + def runInPkgs(self):
71 + return (False, [])
72 +
73 + @property
74 + def runInEbuilds(self):
75 + return (True, [self.is_forced])
76
77 diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
78 index 78ff053..2625de4 100644
79 --- a/pym/repoman/scanner.py
80 +++ b/pym/repoman/scanner.py
81 @@ -291,6 +291,8 @@ class Scanner(object):
82 ('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
83 ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
84 ('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
85 + # Options.is_forced() is used to bypass further checks
86 + ('options', 'Options'),
87 ]:
88 if mod[0]:
89 mod_class = MODULE_CONTROLLER.get_class(mod[0])
90 @@ -318,14 +320,6 @@ class Scanner(object):
91 if y_ebuild_continue:
92 continue
93
94 - # Syntax Checks
95 -
96 - if self.options.force:
97 - # The dep_check() calls are the most expensive QA test. If --force
98 - # is enabled, there's no point in wasting time on these since the
99 - # user is intent on forcing the commit anyway.
100 - continue
101 -
102 relevant_profiles = []
103 for keyword, arch, groups in dynamic_data['arches']:
104 if arch not in self.profiles: