summaryrefslogtreecommitdiff
path: root/morphlib/app.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-09-24 12:00:08 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-09-24 12:00:08 +0100
commitd22e120835959a063913045ff7473e26b88afea8 (patch)
tree58a74b2f12c374c9b66cb1bfabe2a4779cc4f9fb /morphlib/app.py
parent4f613fe6a8f2ff82852a5f7a8b82e46454eaa248 (diff)
parent91daacb277a237ecf8cef37b527b06e0c864c44d (diff)
downloadmorph-d22e120835959a063913045ff7473e26b88afea8.tar.gz
Merge branch 'baserock/radiofree/check_mtime'
Diffstat (limited to 'morphlib/app.py')
-rwxr-xr-xmorphlib/app.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 37e494af..b25cd42c 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -164,7 +164,22 @@ class Morph(cliapp.Application):
metavar='PREFIX',
default=defaults['build-ref-prefix'])
+ def check_mtime(self):
+ # Check the mtime for the file to make sure the system clock has been
+ # set
+ try:
+ file_mtime = os.path.getmtime(__file__)
+ except OSError as e:
+ raise morphlib.Error('%s %s' % (e.strerror, e.filename))
+
+ sys_time = time.time()
+ if file_mtime > sys_time:
+ raise morphlib.Error('mtime for %s is in the future, please set '
+ 'your system clock' % __file__)
+
def process_args(self, args):
+ self.check_mtime()
+
# Combine the aliases into repo-alias before passing on to normal
# command processing. This means everything from here on down can
# treat settings['repo-alias'] as the sole source of prefixes for git