summaryrefslogtreecommitdiff
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
parent6c3fa47fc9a22bbe78e2aa8a016af922003580f5 (diff)
create complete and correct build_config files for the updater
Change-Id: I4f6b7aecc24d42d6b248cb8d959aeab59af963c2
-rw-r--r--Makefile.gbuild6
-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
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac9
7 files changed, 48 insertions, 13 deletions
diff --git a/Makefile.gbuild b/Makefile.gbuild
index d4d0fb34ba02..903a7b8a59cd 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -33,10 +33,10 @@ create-update-info:
rm -rf $(MAR_DIR) || true
rm -rf $(UPDATE_DIR) || true
mkdir -p $(UPDATE_DIR)
- $(SRCDIR)/bin/update/create_build_config.py "$(PRODUCTNAME)" "$(VERSION)" "$(BUILDID)" "$(UPDATE_CHANNEL)" "$(PLATFORM)" "$(UPDATE_DIR)"
mkdir -p $(MAR_DIR)/current-build
mkdir -p $(MAR_DIR)/language
- MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(UPDATE_DIR)" "$(MAR_DIR)/current-build/" "$(MAR_NAME_PREFIX)" "$(UPDATE_CERTIFICATE_NAME)" "$(UPDATE_CERTIFICATE_PATH)"
- MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar_for_languages.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(UPDATE_DIR)" "$(MAR_DIR)/language" "$(MAR_NAME_PREFIX)" "$(UPDATE_CERTIFICATE_NAME)" "$(UPDATE_CERTIFICATE_PATH)"
+ MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(UPDATE_DIR)" "$(MAR_DIR)/current-build/" "$(MAR_NAME_PREFIX)" "$(UPDATE_CERTIFICATE_NAME)" "$(UPDATE_CERTIFICATE_PATH)" "$(UPDATE_BASE_URL)"
+ MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar_for_languages.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(UPDATE_DIR)" "$(MAR_DIR)/language" "$(MAR_NAME_PREFIX)" "$(UPDATE_CERTIFICATE_NAME)" "$(UPDATE_CERTIFICATE_PATH)" "$(UPDATE_BASE_URL)"
+ $(SRCDIR)/bin/update/create_build_config.py "$(PRODUCTNAME)" "$(VERSION)" "$(BUILDID)" "$(UPDATE_CHANNEL)" "$(PLATFORM)" "$(UPDATE_DIR)"
# vim: set noet sw=4 ts=4:
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
diff --git a/config_host.mk.in b/config_host.mk.in
index 3d045df662f7..b3d246b8fcfe 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -578,6 +578,7 @@ export UNOWINREG_DLL=@UNOWINREG_DLL@
export UPDATE_CERTIFICATE_NAME=@UPDATE_CERTIFICATE_NAME@
export UPDATE_CERTIFICATE_PATH=@UPDATE_CERTIFICATE_PATH@
export UPDATE_CHANNEL=@UPDATE_CHANNEL@
+export UPDATE_BASE_URL=@UPDATE_BASE_URL@
export USE_LIBRARY_BIN_TAR=@USE_LIBRARY_BIN_TAR@
export USE_XINERAMA=@USE_XINERAMA@
export UUIDGEN=@UUIDGEN@
diff --git a/configure.ac b/configure.ac
index 63334a7c4aa7..4c1e4f47b2c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1398,6 +1398,12 @@ AC_ARG_WITH(update-certificate-path,
[Defines the path to the nss certificate store used for the updater
This makes only sense if the onlineupdate is used and the mar files should be uploaded.]))
+AC_ARG_WITH(update-base-url,
+ AS_HELP_STRING([--with-update-base-url=http://dev-builds.libreoffice.org/update/$(channel)/$(buildid)],
+ [Defines the base url for the mar file url. THe following variables are going to be replaced
+ with the corresponding content: channel, buildid, version, platform, productname.
+ This makes only sense if the onlineupdate is used and the mar files should be uploaded.]))
+
libo_FUZZ_ARG_ENABLE(extension-update,
AS_HELP_STRING([--disable-extension-update],
[Disable possibility to update installed extensions.]),
@@ -11321,6 +11327,7 @@ ENABLE_ONLINE_UPDATE_MAR=
UPDATE_CHANNEL=
UPDATE_CERTIFICATE_NAME=
UPDATE_CERTIFICATE_PATH=
+UPDATE_BASE_URL=
if test "$enable_online_update" = ""; then
if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
AC_MSG_RESULT([yes])
@@ -11336,6 +11343,7 @@ else
UPDATE_CHANNEL="$with_update_channel"
UPDATE_CERTIFICATE_NAME="$with_update_certificate_name"
UPDATE_CERTIFICATE_PATH="$with_update_certificate_path"
+ UPDATE_BASE_URL="$with_update_base_url"
elif test "$enable_online_update" = "yes"; then
AC_MSG_RESULT([yes])
ENABLE_ONLINE_UPDATE="TRUE"
@@ -11348,6 +11356,7 @@ AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
AC_SUBST(UPDATE_CHANNEL)
AC_SUBST(UPDATE_CERTIFICATE_NAME)
AC_SUBST(UPDATE_CERTIFICATE_PATH)
+AC_SUBST(UPDATE_BASE_URL)
dnl ===================================================================
dnl Test whether we need bzip2