commit:     a7abf497b92fcd20b122473a71e8ce69a5995029
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 23:23:52 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:18 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a7abf497

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 ++++++++
 pym/repoman/modules/scan/directories/mtime.py    | 24 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           |  5 +----
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index 7fe9f0e..b9daef0 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
                        'func_kwargs': {
                        },
                },
+               'mtime-module': {
+                       'name': "mtime",
+                       'class': "MtimeChecks",
+                       'description': doc,
+                       'functions': ['check'],
+                       'func_kwargs': {
+                       },
+               },
        }
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py 
b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 0000000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+       def __init__(self, **kwargs):
+               self.vcs_settings = kwargs.get('vcs_settings')
+
+       def check(self, **kwargs):
+               ebuild = kwargs.get('ebuild')
+               changed = kwargs.get('changed')
+               pkg = kwargs.get('pkg')
+               if not self.vcs_settings.vcs_preserves_mtime:
+                       if ebuild.ebuild_path not in changed.new_ebuilds and \
+                                       ebuild.ebuild_path not in 
changed.ebuilds:
+                               pkg.mtime = None
+               return {'continue': False}
+
+       @property
+       def runInPkgs(self):
+               return (False, [])
+
+       @property
+       def runInEbuilds(self):
+               return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8657c73..b00dbd9 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -293,6 +293,7 @@ class Scanner(object):
                                ('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
                                ('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
                                ('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
+                               ('mtime', 'MtimeChecks'),
                                ]:
                                if mod[0]:
                                        mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -321,10 +322,6 @@ class Scanner(object):
                                continue
 
                        # Syntax Checks
-                       if not self.vcs_settings.vcs_preserves_mtime:
-                               if dynamic_data['ebuild'].ebuild_path not in 
self.changed.new_ebuilds and \
-                                       dynamic_data['ebuild'].ebuild_path not 
in self.changed.ebuilds:
-                                       dynamic_data['pkg'].mtime = None
                        try:
                                # All ebuilds should have utf_8 encoding.
                                f = io.open(

Reply via email to