summaryrefslogtreecommitdiff
path: root/morphlib/app.py
diff options
context:
space:
mode:
authorJames Thomas <james.thomas@codethink.co.uk>2012-09-21 12:38:54 +0000
committerJames Thomas <james.thomas@codethink.co.uk>2012-09-21 15:40:11 +0000
commit806f50937fc4765abc91f0b7a31bd46780b76f3b (patch)
tree26c36d0b82bc916d2e2736847698dd31a5d6e6e0 /morphlib/app.py
parentd51aff5f5d710db20eff1f410a4bc93072401fd7 (diff)
downloadmorph-806f50937fc4765abc91f0b7a31bd46780b76f3b.tar.gz
Check the mtime of the app.py to make sure it is not in the future
If it's in the future this may cause problems, so exit with an error
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 42a35461..e1126fa5 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