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/modules/scan/options/, pym/repoman/
Date: Mon, 07 Mar 2016 21:53:28
Message-Id: 1457385671.2290fc1382ac8051f595187bda03dc25fcb3b6fb.dolsen@gentoo
1 commit: 2290fc1382ac8051f595187bda03dc25fcb3b6fb
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: Mon Mar 7 21:21:11 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2290fc13
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 | 18 ++++++++++++++++++
14 pym/repoman/scanner.py | 10 ++--------
15 3 files changed, 44 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..c2546d6
51 --- /dev/null
52 +++ b/pym/repoman/modules/scan/options/options.py
53 @@ -0,0 +1,18 @@
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 runInEbuilds(self):
71 + return (True, [self.is_forced])
72
73 diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
74 index 78ff053..2625de4 100644
75 --- a/pym/repoman/scanner.py
76 +++ b/pym/repoman/scanner.py
77 @@ -291,6 +291,8 @@ class Scanner(object):
78 ('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
79 ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
80 ('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
81 + # Options.is_forced() is used to bypass further checks
82 + ('options', 'Options'),
83 ]:
84 if mod[0]:
85 mod_class = MODULE_CONTROLLER.get_class(mod[0])
86 @@ -318,14 +320,6 @@ class Scanner(object):
87 if y_ebuild_continue:
88 continue
89
90 - # Syntax Checks
91 -
92 - if self.options.force:
93 - # The dep_check() calls are the most expensive QA test. If --force
94 - # is enabled, there's no point in wasting time on these since the
95 - # user is intent on forcing the commit anyway.
96 - continue
97 -
98 relevant_profiles = []
99 for keyword, arch, groups in dynamic_data['arches']:
100 if arch not in self.profiles: