summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-05-28 16:33:41 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-05-28 16:33:54 +0000
commit51eef784d9c6b7b79769415bc65fbfbef87334eb (patch)
tree1933d712d01c38feac245a413b2953c06195dd6a
parentd5d9b7253f968b67e9c9a3e6d260a6adf1dee8f9 (diff)
parent867d193648723e23ce31974b625116656512b52b (diff)
downloadmorph-51eef784d9c6b7b79769415bc65fbfbef87334eb.tar.gz
Merge branch 'liw/deploy-not-exec-message'
Updated copyright years so ./check passes. Reviewed-by: Richard Maw
-rw-r--r--morphlib/cachedrepo_tests.py2
-rw-r--r--morphlib/plugins/deploy_plugin.py9
-rw-r--r--morphlib/remoterepocache.py2
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