summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-09-05 01:53:31 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-05-19 03:43:22 +0200
commit641bd985386c4accfcc99afb769db2385462ffe8 (patch)
tree6bd56250e0231cf98eaaf17831d31bc255aa3630 /bin
parent6c3fa47fc9a22bbe78e2aa8a016af922003580f5 (diff)
create complete and correct build_config files for the updater
Change-Id: I4f6b7aecc24d42d6b248cb8d959aeab59af963c2
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update/create_build_config.py22
-rwxr-xr-xbin/update/create_full_mar.py7
-rwxr-xr-xbin/update/create_full_mar_for_languages.py11
-rw-r--r--bin/update/tools.py5
4 files changed, 35 insertions, 10 deletions
diff --git a/bin/update/create_build_config.py b/bin/update/create_build_config.py
index 7957be62d9fa..1342746dee0a 100755
--- a/bin/update/create_build_config.py
+++ b/bin/update/create_build_config.py
@@ -4,6 +4,18 @@ import json
import sys
import os
+def update_url(old_url, **kwargs):
+ new_url = old_url
+ for key, val in kwargs.items():
+ new_url = new_url.replace(key, val)
+
+ return new_url
+
+def update_all_url_entries(data, **kwargs):
+ data['complete']['url'] = update_url(data['complete']['url'], **kwargs)
+ for language in data['languages']:
+ language['complete']['url'] = update_url(language['complete']['url'], **kwargs)
+
def main(argv):
if len(argv) < 7:
print("Usage: create_build_config.py $PRODUCTNAME $VERSION $BUILDID $UPDATECHANNEL $PLATFORM $TARGETDIR")
@@ -15,6 +27,16 @@ def main(argv):
'platform' : argv[5]
}
+ extra_data_files = ['complete_info.json', 'complete_lang_info.json']
+
+ for extra_file in extra_data_files:
+ extra_file_path = os.path.join(argv[6], extra_file)
+ with open(extra_file_path, "r") as f:
+ extra_data = json.load(f)
+ data.update(extra_data)
+
+ update_all_url_entries(data, channel=argv[4], platform=argv[5], buildid=argv[3], version=argv[2])
+
with open(os.path.join(argv[6], "build_config.json"), "w") as f:
json.dump(data, f, indent=4)
diff --git a/bin/update/create_full_mar.py b/bin/update/create_full_mar.py
index f29a40d1d931..02870b35a63c 100755
--- a/bin/update/create_full_mar.py
+++ b/bin/update/create_full_mar.py
@@ -15,10 +15,11 @@ def make_mar_name(target_dir, filename_prefix):
def main():
print(sys.argv)
- if len(sys.argv) < 8:
- print("Usage: create_full_mar_for_languages.py $PRODUCTNAME $WORKDIR $TARGETDIR $TEMPDIR $FILENAMEPREFIX")
+ if len(sys.argv) < 9:
+ print("Usage: create_full_mar_for_languages.py $PRODUCTNAME $WORKDIR $TARGETDIR $TEMPDIR $FILENAMEPREFIX $BASE_URL")
sys.exit(1)
+ url = sys.argv[8]
certificate_path = sys.argv[7]
certificate_name = sys.argv[6]
filename_prefix = sys.argv[5]
@@ -45,7 +46,7 @@ def main():
os.rename(signed_mar_file, mar_file)
- file_info = { 'complete' : get_file_info(mar_file) }
+ file_info = { 'complete' : get_file_info(mar_file, url) }
with open(os.path.join(target_dir, 'complete_info.json'), "w") as complete_info_file:
json.dump(file_info, complete_info_file, indent = 4)
diff --git a/bin/update/create_full_mar_for_languages.py b/bin/update/create_full_mar_for_languages.py
index 23f3a3e6608b..7e79ac897f05 100755
--- a/bin/update/create_full_mar_for_languages.py
+++ b/bin/update/create_full_mar_for_languages.py
@@ -13,18 +13,19 @@ def make_complete_mar_name(target_dir, filename_prefix, language):
filename = filename_prefix + "_" + language + "_complete_langpack.mar"
return os.path.join(target_dir, filename)
-def create_lang_infos(mar_file_name, language):
+def create_lang_infos(mar_file_name, language, url):
data = {'lang' : language,
- 'complete' : get_file_info(mar_file_name)
+ 'complete' : get_file_info(mar_file_name, url)
}
return data
def main():
print(sys.argv)
- if len(sys.argv) < 8:
- print("Usage: create_full_mar_for_languages.py $PRODUCTNAME $WORKDIR $TARGETDIR $TEMPDIR $FILENAMEPREFIX")
+ if len(sys.argv) < 9:
+ print("Usage: create_full_mar_for_languages.py $PRODUCTNAME $WORKDIR $TARGETDIR $TEMPDIR $FILENAMEPREFIX $BASE_URL")
sys.exit(1)
+ url = sys.argv[8]
certificate_path = sys.argv[7]
certificate_name = sys.argv[6]
filename_prefix = sys.argv[5]
@@ -55,7 +56,7 @@ def main():
subprocess.call([mar_executable, '-C', target_dir, '-d', certificate_path, '-n', certificate_name, '-s', mar_file_name, signed_mar_file])
os.rename(signed_mar_file, mar_file_name)
- lang_infos.append(create_lang_infos(mar_file_name, language))
+ lang_infos.append(create_lang_infos(mar_file_name, language, url))
with open(os.path.join(target_dir, "complete_lang_info.json"), "w") as language_info_file:
json.dump({'languages' : lang_infos}, language_info_file, indent=4)
diff --git a/bin/update/tools.py b/bin/update/tools.py
index 87f67fa97f4e..5d0871b299af 100644
--- a/bin/update/tools.py
+++ b/bin/update/tools.py
@@ -34,10 +34,11 @@ def get_hash(file_path):
sha512.update(data)
return sha512.hexdigest()
-def get_file_info(mar_file):
+def get_file_info(mar_file, url):
filesize = os.path.getsize(mar_file)
data = { 'hash' : get_hash(mar_file),
'hashFunction' : 'sha512',
- 'size' : filesize }
+ 'size' : filesize,
+ 'url' : url + os.path.basename(mar_file)}
return data