Kaydet (Commit) c210d7cc authored tarafından Markus Mohrhard's avatar Markus Mohrhard

make it easier to debug the generation of certificate data

Change-Id: I86e3c3254cef297c46a8ca377b5ceb36b348e2b3
Reviewed-on: https://gerrit.libreoffice.org/40607Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 6de75d13
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import binascii
......@@ -13,6 +15,9 @@ def file_byte_generator(filename):
block = f.read()
return block
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def create_header(array_name, in_filename):
if sys.version_info >= (3,0):
hexified = ["0x" + binascii.hexlify(bytes([inp])).decode('ascii') for inp in file_byte_generator(in_filename)]
......@@ -25,8 +30,13 @@ def create_header(array_name, in_filename):
if __name__ == '__main__':
if len(sys.argv) < 3:
print('ERROR: usage: gen_cert_header.py array_name update_config_file')
sys.exit(1);
eprint('ERROR: usage: gen_cert_header.py array_name update_config_file')
sys.exit(1)
if not os.path.exists(sys.argv[2]):
eprint('The config file %s does not exist'%(sys.argv[2]))
sys.exit(1)
config = ConfigParser()
config.read(sys.argv[2])
sys.exit(create_header(sys.argv[1], config.get('Updater', 'certificate-der')))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment