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/directories/, pym/repoman/
Date: Sun, 31 Jan 2016 20:03:44
Message-Id: 1454185523.c5bd7eacdac16ea2e4b56933f7c85334d51070d6.dolsen@gentoo
1 commit: c5bd7eacdac16ea2e4b56933f7c85334d51070d6
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 3 23:23:52 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=c5bd7eac
7
8 repoman: Migrate code to a new MtimeChecks class in directories plugin
9
10 pym/repoman/modules/scan/directories/__init__.py | 9 +++++++++
11 pym/repoman/modules/scan/directories/mtime.py | 24 ++++++++++++++++++++++++
12 pym/repoman/scanner.py | 5 +----
13 3 files changed, 34 insertions(+), 4 deletions(-)
14
15 diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
16 index bcc6eca..ec18d30 100644
17 --- a/pym/repoman/modules/scan/directories/__init__.py
18 +++ b/pym/repoman/modules/scan/directories/__init__.py
19 @@ -19,6 +19,15 @@ module_spec = {
20 'func_kwargs': {
21 },
22 },
23 + 'mtime-module': {
24 + 'name': "mtime",
25 + 'sourcefile': "mtime",
26 + 'class': "MtimeChecks",
27 + 'description': doc,
28 + 'functions': ['check'],
29 + 'func_kwargs': {
30 + },
31 + },
32 }
33 }
34
35
36 diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
37 new file mode 100644
38 index 0000000..e113cdd
39 --- /dev/null
40 +++ b/pym/repoman/modules/scan/directories/mtime.py
41 @@ -0,0 +1,24 @@
42 +
43 +
44 +class MtimeChecks(object):
45 +
46 + def __init__(self, **kwargs):
47 + self.vcs_settings = kwargs.get('vcs_settings')
48 +
49 + def check(self, **kwargs):
50 + ebuild = kwargs.get('ebuild')
51 + changed = kwargs.get('changed')
52 + pkg = kwargs.get('pkg')
53 + if not self.vcs_settings.vcs_preserves_mtime:
54 + if ebuild.ebuild_path not in changed.new_ebuilds and \
55 + ebuild.ebuild_path not in changed.ebuilds:
56 + pkg.mtime = None
57 + return {'continue': False}
58 +
59 + @property
60 + def runInPkgs(self):
61 + return (False, [])
62 +
63 + @property
64 + def runInEbuilds(self):
65 + return (True, [self.check])
66
67 diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
68 index 92e2abd..308b440 100644
69 --- a/pym/repoman/scanner.py
70 +++ b/pym/repoman/scanner.py
71 @@ -294,6 +294,7 @@ class Scanner(object):
72 ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
73 ('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
74 ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
75 + ('mtime', 'MtimeChecks'),
76 ]:
77 if mod[0]:
78 mod_class = MODULE_CONTROLLER.get_class(mod[0])
79 @@ -322,10 +323,6 @@ class Scanner(object):
80 continue
81
82 # Syntax Checks
83 - if not self.vcs_settings.vcs_preserves_mtime:
84 - if dynamic_data['ebuild'].ebuild_path not in self.changed.new_ebuilds and \
85 - dynamic_data['ebuild'].ebuild_path not in self.changed.ebuilds:
86 - dynamic_data['pkg'].mtime = None
87 try:
88 # All ebuilds should have utf_8 encoding.
89 f = io.open(