Permalink
Browse files

Update modulesets automatically based on last modification time

  • Loading branch information...
1 parent a57bd40 commit 95546811a4a463a5778e7e7aeb0f76b1680b347d @ylatuya ylatuya committed Jan 25, 2012
Showing with 21 additions and 0 deletions.
  1. +12 −0 ossbuild/commands/update_moduleset.py
  2. +9 −0 ossbuild/config.py
@@ -98,4 +98,16 @@ def run(self, config, options, args, help=None):
self._find_repos_and_modules(modulesets_dir, moduleset)
self._write_moduleset(moduleset_path)
+ @staticmethod
+ def update(config):
+ options = DummyOptions()
+ cmd = cmd_update_moduleset()
+ cmd.run(config, options, None)
+
+
+class DummyOptions(object):
+ moduleset = None
+ modulesets_dir = None
+
+
register_command(cmd_update_moduleset)
View
@@ -26,6 +26,8 @@
from jhbuild.errors import FatalError
from jhbuild import config
+from ossbuild.commands.update_moduleset import cmd_update_moduleset
+
__all__ = [ 'Config' ]
@@ -47,3 +49,10 @@ def __init__(self, filename=_default_ossbuildrc):
raise FatalError(_('could not load environment config'))
config._defaults_file = _defaults_file
config.Config.__init__(self, filename)
+ self.update_moduleset()
+
+ def update_moduleset(self):
+ newest_file = max (os.listdir(self.modulesets_dir),
+ key=lambda x: os.path.getmtime(os.path.join(self.modulesets_dir, x)))
+ if not newest_file.startswith(self.moduleset + '.'):
+ cmd_update_moduleset.update(self)

0 comments on commit 9554681

Please sign in to comment.