diff options
-rw-r--r-- | morphlib/cachedrepo_tests.py | 2 | ||||
-rw-r--r-- | morphlib/plugins/deploy_plugin.py | 9 | ||||
-rw-r--r-- | morphlib/remoterepocache.py | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/morphlib/cachedrepo_tests.py b/morphlib/cachedrepo_tests.py index 3e042b19..18704f58 100644 --- a/morphlib/cachedrepo_tests.py +++ b/morphlib/cachedrepo_tests.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012-2013 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 94ac8a75..7a6f2b92 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -18,6 +18,7 @@ import cliapp import gzip import os import shutil +import stat import tarfile import tempfile import urlparse @@ -206,6 +207,9 @@ class DeployPlugin(cliapp.Plugin): if not os.path.exists(ext_filename): raise morphlib.Error( 'Could not find extension %s%s' % (name, kind)) + if not self._is_executable(ext_filename): + raise morphlib.Error( + 'Extension not executable: %s' % ext_filename) delete_ext = False else: # Found it in the system morphology's repository. @@ -222,6 +226,11 @@ class DeployPlugin(cliapp.Plugin): if delete_ext: os.remove(ext_filename) + + def _is_executable(self, filename): + st = os.stat(filename) + mask = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH + return (stat.S_IMODE(st.st_mode) & mask) != 0 def _cat_file(self, repo_dir, ref, pathname): '''Retrieve contents of a file from a git repository.''' diff --git a/morphlib/remoterepocache.py b/morphlib/remoterepocache.py index d6812120..ba4937d7 100644 --- a/morphlib/remoterepocache.py +++ b/morphlib/remoterepocache.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012-2013 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by |