From 22aaa9be2ef05358f672ce8fc9f6978664741e7f Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 20 Aug 2017 19:42:43 +0200 Subject: updater: move the update channel info from the config to versionrc Change-Id: Id19578a889de51cacac869d7ec681c5c18c40cf9 Reviewed-on: https://gerrit.libreoffice.org/41365 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- bin/update/get_update_channel.py | 23 +++++++++++++++++++++++ desktop/source/app/updater.cxx | 10 +++++++++- desktop/source/app/updater.hxx | 1 + instsetoo_native/CustomTarget_setup.mk | 1 + 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 bin/update/get_update_channel.py diff --git a/bin/update/get_update_channel.py b/bin/update/get_update_channel.py new file mode 100755 index 000000000000..f94507d64587 --- /dev/null +++ b/bin/update/get_update_channel.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 +# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +import sys +from config import parse_config + +def main(): + if len(sys.argv) < 2: + sys.exit(1) + + update_config = sys.argv[1] + config = parse_config(update_config) + print(config.channel) + +if __name__ == "__main__": + main() + +# vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index 4049b0ab3472..86e7a473783b 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -687,7 +687,7 @@ void update_checker() OUString aBuildTarget = "${_OS}_${_ARCH}"; rtl::Bootstrap::expandMacros(aBuildTarget); - OUString aChannel = officecfg::Office::Update::Update::UpdateChannel::get(); + OUString aChannel = Updater::getUpdateChannel(); static const char* pUpdateChannelEnv = std::getenv("LIBO_UPDATER_CHANNEL"); if (pUpdateChannelEnv) { @@ -835,6 +835,14 @@ OUString Updater::getBuildID() return aBuildID; } +OUString Updater::getUpdateChannel() +{ + OUString aUpdateChannel("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":UpdateChannel}"); + rtl::Bootstrap::expandMacros(aUpdateChannel); + + return aUpdateChannel; +} + void Updater::removeUpdateFiles() { Updater::log("Removing: " + getUpdateFileURL()); diff --git a/desktop/source/app/updater.hxx b/desktop/source/app/updater.hxx index 937728dd70bc..a029832d17d3 100644 --- a/desktop/source/app/updater.hxx +++ b/desktop/source/app/updater.hxx @@ -29,6 +29,7 @@ public: static OUString getInstallationPath(); static OUString getBuildID(); + static OUString getUpdateChannel(); static void log(const OUString& rMessage); static void log(const OString& rMessage); diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk index 95eba463ef7c..2b312be018cf 100644 --- a/instsetoo_native/CustomTarget_setup.mk +++ b/instsetoo_native/CustomTarget_setup.mk @@ -156,6 +156,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_ && echo 'BuildVersion=$(BUILD_VER_STRING)' \ && echo 'buildid=$(shell cd $(SRCDIR) && git log -1 --format=%H)' \ && echo 'ExtensionUpdateURL=http://updateexte.libreoffice.org/ExtensionUpdateService/check.Update' \ + && echo 'UpdateChannel=$(shell cd $(SRCDIR) && bin/update/get_update_channel.py $(UPDATE_CONFIG))' \ && echo 'ReferenceOOoMajorMinor=4.1' \ && echo 'UpdateID=$(PRODUCTNAME)_$(LIBO_VERSION_MAJOR)_en-US' \ && echo 'UpdateURL=$(if $(ENABLE_ONLINE_UPDATE),http://update.libreoffice.org/check.php$(if $(filter-out WNT,$(OS)),?pkgfmt=$(PKGFORMAT)))' \ -- cgit