summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-04-26 02:43:02 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-05-19 03:43:31 +0200
commit208012cf122dadacd824722c8ab7e0210d691692 (patch)
treec66bf7899672b0d1f0b6dff96f6ef0c27845a339 /bin
parent25ea5a7a561045f8a7f20bb9028701a95b029699 (diff)
extract the mar signing code
Change-Id: I007b0b68a61242b7255a1a58a3637e3307d675aa
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update/create_full_mar.py5
-rw-r--r--bin/update/signing.py11
2 files changed, 13 insertions, 3 deletions
diff --git a/bin/update/create_full_mar.py b/bin/update/create_full_mar.py
index f4990304857e..649eafe2bfa6 100755
--- a/bin/update/create_full_mar.py
+++ b/bin/update/create_full_mar.py
@@ -7,6 +7,7 @@ import json
from tools import uncompress_file_to_dir, get_file_info, make_complete_mar_name
from config import parse_config
+from signing import sign_mar_file
current_dir_path = os.path.dirname(os.path.realpath(__file__))
@@ -37,10 +38,8 @@ def main():
mar_file = make_complete_mar_name(target_dir, filename_prefix)
subprocess.call([os.path.join(current_dir_path, 'make_full_update.sh'), mar_file, uncompress_dir])
- signed_mar_file = make_mar_name(target_dir, filename_prefix + '_signed')
- subprocess.check_call([mar_executable, '-C', target_dir, '-d', config.certificate_path, '-n', config.certificate_name, '-s', mar_file, signed_mar_file])
- os.rename(signed_mar_file, mar_file)
+ sign_mar_file(target_dir, config, mar_file, filename_prefix)
file_info = { 'complete' : get_file_info(mar_file, config.base_url) }
diff --git a/bin/update/signing.py b/bin/update/signing.py
new file mode 100644
index 000000000000..e6ac2832d844
--- /dev/null
+++ b/bin/update/signing.py
@@ -0,0 +1,11 @@
+from tools import make_complete_mar_name
+
+import os
+import subprocess
+
+def sign_mar_file(target_dir, config, mar_file, filename_prefix):
+ signed_mar_file = make_complete_mar_name(target_dir, filename_prefix + '_signed')
+ mar_executable = os.environ.get('MAR', 'mar')
+ subprocess.check_call([mar_executable, '-C', target_dir, '-d', config.certificate_path, '-n', config.certificate_name, '-s', mar_file, signed_mar_file])
+
+ os.rename(signed_mar_file, mar_file)