[Libreoffice-commits] core.git: 3 commits - config_host.mk.in configure.ac download.lst external/Module_external.mk Makefile.fetch onlineupdate/Executable_updater.mk onlineupdate/README onlineupdate/source RepositoryExternal.mk

Jan Holesovsky kendy at collabora.com
Fri Jul 3 04:49:51 PDT 2015


 Makefile.fetch                                          |    1 
 RepositoryExternal.mk                                   |   33 ++
 config_host.mk.in                                       |    3 
 configure.ac                                            |   24 +
 download.lst                                            |    1 
 external/Module_external.mk                             |    1 
 onlineupdate/Executable_updater.mk                      |   21 -
 onlineupdate/README                                     |    4 
 onlineupdate/source/libmar/sign/moz.build               |   24 -
 onlineupdate/source/libmar/src/moz.build                |   30 -
 onlineupdate/source/libmar/tool/moz.build               |   58 ---
 onlineupdate/source/libmar/verify/moz.build             |   32 --
 onlineupdate/source/update/common/moz.build             |   29 -
 onlineupdate/source/update/src/moz.build                |   30 -
 onlineupdate/source/update/updater/automounter_gonk.cxx |  251 ----------------
 onlineupdate/source/update/updater/automounter_gonk.h   |   48 ---
 onlineupdate/source/update/updater/moz.build            |   13 
 onlineupdate/source/update/updater/updater.cxx          |    2 
 18 files changed, 67 insertions(+), 538 deletions(-)

New commits:
commit 025952f52767fb3508a6725468fe4b1e6ce4c9b1
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jul 3 13:46:38 2015 +0200

    online update: Make the 'updater' build & link at least on Linux.
    
    Works with the non-system bzip2; the --with-system case might still need some
    love - but then again, distros want to have the online update switched off
    anyway...
    
    Change-Id: I26a27aec07a8f1aac22a4d14a38fb5b833550ea7

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 0592dea..a556c3d 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4131,16 +4131,19 @@ $(call gb_LinkTarget_set_include,$(1),\
 $(call gb_LinkTarget_add_libs,$(1),$(BZIP2_LIBS))
 
 endef
+
 gb_ExternalProject__use_bzip2 :=
 
 else # !SYSTEM_BZIP2
 
 define gb_LinkTarget__use_bzip2
-$(call gb_LinkTarget_use_external_project,$(1),bzip2)
 $(call gb_LinkTarget_set_include,$(1),\
 	-I$(call gb_UnpackedTarball_get_dir,bzip2) \
 	$$(INCLUDE) \
 )
+$(call gb_LinkTarget_add_libs,$(1),\
+	-L$(call gb_UnpackedTarball_get_dir,bzip2) -lbz2 \
+)
 endef
 
 define gb_ExternalProject__use_bzip2
diff --git a/onlineupdate/Executable_updater.mk b/onlineupdate/Executable_updater.mk
index 30713c4..a4c4f95 100644
--- a/onlineupdate/Executable_updater.mk
+++ b/onlineupdate/Executable_updater.mk
@@ -26,22 +26,6 @@ $(eval $(call gb_Executable_add_libs,updater,\
     -lICE \
 ))
 
-ifeq ($(OS),MACOSX)
-$(eval $(call gb_Executable_set_include,updater,\
-	-lgtk \
-))
-$(eval $(call gb_Exectuable_add_libs,updater,\
-	-lpthread \
-))
-else ifeq ($(OS),LINUX)
-$(eval $(call gb_Executable_set_include,updater,\
-	-lgtk \
-))
-$(eval $(call gb_Exectuable_add_libs,updater,\
-	-lpthread \
-))
-endif
-
 $(eval $(call gb_Executable_add_cxxflags,updater,\
     $$(GTK3_CFLAGS) \
 ))
diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index 8de9cc1..998a310 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -143,7 +143,7 @@ static bool sUseHardLinks = true;
 // declare it here to avoid including that entire header file.
 #define BZ2_CRC32TABLE_UNDECLARED
 
-#if MOZ_IS_GCC
+#if defined(HAVE_GCC_VISIBILITY_FEATURE)
 extern "C"  __attribute__((visibility("default"))) unsigned int BZ2_crc32Table[256];
 #undef BZ2_CRC32TABLE_UNDECLARED
 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
commit 7eb863d6b6258f31343d4b0b82038afe5e036bc0
Author: Nathan Yee <ny.nathan.yee at gmail.com>
Date:   Fri Jul 3 11:58:27 2015 +0200

    online update: Add the bzip2 external.
    
    Change-Id: Id7547390c49c0bcf672eb1a9863fc236518bfa49

diff --git a/Makefile.fetch b/Makefile.fetch
index 390d3d0..87c8b8a 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -112,6 +112,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,APR,APR_UTIL_TARBALL) \
 		$(call fetch_Optional,BOOST,BOOST_TARBALL) \
 		$(call fetch_Optional,BSH,BSH_TARBALL) \
+		$(call fetch_Optional,BZIP2,BZIP2_TARBALL) \
 		$(call fetch_Optional,CAIRO,CAIRO_TARBALL) \
 		$(call fetch_Optional,CAIRO,PIXMAN_TARBALL) \
 		$(call fetch_Optional,CDR,CDR_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 3ea67b8..0592dea 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4120,4 +4120,34 @@ endef
 
 endif
 
+ifneq ($(ENABLE_ONLINE_UPDATE_MAR),)
+ifneq ($(SYSTEM_BZIP2),)
+
+define gb_LinkTarget__use_bzip2
+$(call gb_LinkTarget_set_include,$(1),\
+	$(BZIP2_CFLAGS) \
+	$$(INCLUDE) \
+)
+$(call gb_LinkTarget_add_libs,$(1),$(BZIP2_LIBS))
+
+endef
+gb_ExternalProject__use_bzip2 :=
+
+else # !SYSTEM_BZIP2
+
+define gb_LinkTarget__use_bzip2
+$(call gb_LinkTarget_use_external_project,$(1),bzip2)
+$(call gb_LinkTarget_set_include,$(1),\
+	-I$(call gb_UnpackedTarball_get_dir,bzip2) \
+	$$(INCLUDE) \
+)
+endef
+
+define gb_ExternalProject__use_bzip2
+$(call gb_ExternalProject_use_external_project,$(1),bzip2)
+endef
+
+endif
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/config_host.mk.in b/config_host.mk.in
index 17c2306..1d0702b 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -48,6 +48,8 @@ export BUILD_TYPE=@BUILD_TYPE@
 export BUILD_UNOWINREG=@BUILD_UNOWINREG@
 export BUILD_VER_STRING=@BUILD_VER_STRING@
 export BUILD_X64=@BUILD_X64@
+export BZIP2_CFLAGS=$(gb_SPACE)@BZIP2_CFLAGS@
+export BZIP2_LIBS=$(gb_SPACE)@BZIP2_LIBS@
 export CAIRO_CFLAGS=$(gb_SPACE)@CAIRO_CFLAGS@
 export CAIRO_LIBS=$(gb_SPACE)@CAIRO_LIBS@
 export CC=@CC@
@@ -518,6 +520,7 @@ export SYSTEM_APACHE_COMMONS=@SYSTEM_APACHE_COMMONS@
 export SYSTEM_APR=@SYSTEM_APR@
 export SYSTEM_BOOST=@SYSTEM_BOOST@
 export SYSTEM_BSH=@SYSTEM_BSH@
+export SYSTEM_BZIP2=@SYSTEM_BZIP2@
 export SYSTEM_CAIRO=@SYSTEM_CAIRO@
 export SYSTEM_CLUCENE=@SYSTEM_CLUCENE@
 export SYSTEM_COLLADA2GLTF=@SYSTEM_COLLADA2GLTF@
diff --git a/configure.ac b/configure.ac
index 06b2d5e..0325a2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1574,6 +1574,11 @@ AC_ARG_WITH(system-libs,
         [Use libraries already on system -- enables all --with-system-* flags.]),
 ,)
 
+AC_ARG_WITH(system-bzip2,
+    AS_HELP_STRING([--with-system-bzip2],
+        [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
+    [with_system_bzip2="$with_system_libs"])
+
 AC_ARG_WITH(system-headers,
     AS_HELP_STRING([--with-system-headers],
         [Use headers already on system -- enables all --with-system-* flags for
@@ -11807,6 +11812,25 @@ AC_SUBST(ENABLE_ONLINE_UPDATE)
 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
 
 dnl ===================================================================
+dnl Test whether we need bzip2
+dnl ===================================================================
+SYSTEM_BZIP2=
+if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
+    AC_MSG_CHECKING([whether to use system bzip2])
+    if test "$with_system_bzip2" = yes; then
+        SYSTEM_BZIP2=TRUE
+        AC_MSG_RESULT([yes])
+        PKG_CHECK_MODULES(BZIP2, bzip2)
+    else
+        AC_MSG_RESULT([no])
+        BUILD_TYPE="$BUILD_TYPE BZIP2"
+    fi
+fi
+AC_SUBST(SYSTEM_BZIP2)
+AC_SUBST(BZIP2_CFLAGS)
+AC_SUBST(BZIP2_LIBS)
+
+dnl ===================================================================
 dnl Test whether to enable extension update
 dnl ===================================================================
 AC_MSG_CHECKING([whether to enable extension update])
diff --git a/download.lst b/download.lst
index 54ed35b..bf5a5d8 100644
--- a/download.lst
+++ b/download.lst
@@ -17,6 +17,7 @@ export APR_UTIL_MD5SUM := 71a11d037240b292f824ba1eb537b4e3
 export APR_UTIL_TARBALL := apr-util-1.5.3.tar.gz
 export BOOST_TARBALL := d6eef4b4cacb2183f2bf265a5a03a354-boost_1_55_0.tar.bz2
 export BSH_TARBALL := ec1941a74d3ef513c4ce57a9092b74e1-bsh-2.0b5-src.zip
+export BZIP2_TARBALL := 00b516f4704d4a7cb50a1d97e6e8e15b-bzip2-1.0.6.tar.gz
 export CAIRO_TARBALL := f101a9e88b783337b20b2e26dfd26d5f-cairo-1.10.2.tar.gz
 export CDR_MD5SUM := b33fd0be3befdd1b37777e08ce058bd9
 export CDR_TARBALL := libcdr-0.1.1.tar.bz2
diff --git a/external/Module_external.mk b/external/Module_external.mk
index 8b4fb6c..51900d5 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
 	$(call gb_Helper_optional,APR,apr) \
 	$(call gb_Helper_optional,BOOST,boost) \
 	$(call gb_Helper_optional,BSH,beanshell) \
+	$(call gb_Helper_optional,BZIP2,bzip2) \
 	$(call gb_Helper_optional,CAIRO,cairo) \
 	$(call gb_Helper_optional,CDR,libcdr) \
 	$(call gb_Helper_optional,CLUCENE,clucene) \
diff --git a/onlineupdate/Executable_updater.mk b/onlineupdate/Executable_updater.mk
index f8537be..30713c4 100644
--- a/onlineupdate/Executable_updater.mk
+++ b/onlineupdate/Executable_updater.mk
@@ -50,12 +50,9 @@ $(eval $(call gb_Executable_add_libs,updater,\
     $(GTK3_LIBS) \
 ))
 
-$(eval $(call gb_Executable_use_libraries,updater,\
-	libreofficekitgtk \
-))
-
 $(eval $(call gb_Executable_use_externals,updater,\
 	gtk \
+	bzip2 \
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,updater,\
commit ba1d870abf1b12fd4ac4ba353d39d20bc9bb3a0e
Author: Nathan Yee <ny.nathan.yee at gmail.com>
Date:   Fri Jul 3 11:09:48 2015 +0200

    online update: Remove unneeded files.
    
    Change-Id: Id69448d893f7492e7321c6c6f84d6cccc9024220

diff --git a/onlineupdate/README b/onlineupdate/README
index 74012d4..539e04c 100644
--- a/onlineupdate/README
+++ b/onlineupdate/README
@@ -3,5 +3,5 @@ Online update implementation based on Mozilla's MAR format + update mechanism
 Parts of this code are copied from the mozilla repository, and adapted to
 LibreOffice needs:
 
-firefox/modules/libmar -> online-update/source/libmar
-firefox/toolkit/mozapps/update -> online-update/source/update
+firefox/modules/libmar -> onlineupdate/source/libmar
+firefox/toolkit/mozapps/update -> onlineupdate/source/update
diff --git a/onlineupdate/source/libmar/sign/moz.build b/onlineupdate/source/libmar/sign/moz.build
deleted file mode 100644
index d7b8d1f..0000000
--- a/onlineupdate/source/libmar/sign/moz.build
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-Library('signmar')
-
-UNIFIED_SOURCES += [
-    'mar_sign.c',
-    'nss_secutil.c',
-]
-
-FORCE_STATIC_LIB = True
-
-LOCAL_INCLUDES += [
-    '../src',
-    '../verify',
-]
-
-DEFINES['MAR_NSS'] = True
-
-if CONFIG['OS_ARCH'] == 'WINNT':
-    USE_STATIC_LIBS = True
diff --git a/onlineupdate/source/libmar/src/moz.build b/onlineupdate/source/libmar/src/moz.build
deleted file mode 100644
index 2d25e08..0000000
--- a/onlineupdate/source/libmar/src/moz.build
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-EXPORTS += [
-    'mar.h',
-    'mar_cmdline.h',
-]
-
-HOST_SOURCES += [
-    'mar_create.c',
-    'mar_extract.c',
-    'mar_read.c',
-]
-HostLibrary('hostmar')
-
-Library('mar')
-
-UNIFIED_SOURCES += [
-    'mar_create.c',
-    'mar_extract.c',
-    'mar_read.c',
-]
-
-FORCE_STATIC_LIB = True
-
-if CONFIG['OS_ARCH'] == 'WINNT':
-    USE_STATIC_LIBS = True
diff --git a/onlineupdate/source/libmar/tool/moz.build b/onlineupdate/source/libmar/tool/moz.build
deleted file mode 100644
index 7cb27da..0000000
--- a/onlineupdate/source/libmar/tool/moz.build
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-HOST_SOURCES += [
-    'mar.c',
-]
-
-HostProgram('mar')
-
-HOST_USE_LIBS += [
-    'hostmar',
-]
-
-if CONFIG['MOZ_ENABLE_SIGNMAR']:
-    Program('signmar')
-
-    SOURCES += HOST_SOURCES
-
-    USE_LIBS += [
-        'mar',
-        'signmar',
-        'verifymar',
-    ]
-
-for var in ('MAR_CHANNEL_ID', 'MOZ_APP_VERSION'):
-    DEFINES[var] = '"%s"' % CONFIG[var]
-
-if CONFIG['MOZ_ENABLE_SIGNMAR']:
-    USE_LIBS += [
-        'nspr',
-        'nss',
-    ]
-else:
-    DEFINES['NO_SIGN_VERIFY'] = True
-
-if CONFIG['OS_ARCH'] == 'WINNT':
-    USE_STATIC_LIBS = True
-
-    OS_LIBS += [
-        'ws2_32',
-    ]
-    if CONFIG['MOZ_ENABLE_SIGNMAR']:
-        OS_LIBS += [
-            'crypt32',
-            'advapi32',
-        ]
-elif CONFIG['OS_ARCH'] == 'Darwin':
-    OS_LIBS += [
-      '-framework Security',
-    ]
-
-if CONFIG['HOST_OS_ARCH'] == 'WINNT':
-    HOST_OS_LIBS += [
-        'ws2_32',
-    ]
diff --git a/onlineupdate/source/libmar/verify/moz.build b/onlineupdate/source/libmar/verify/moz.build
deleted file mode 100644
index 7a6a1422..0000000
--- a/onlineupdate/source/libmar/verify/moz.build
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-Library('verifymar')
-
-UNIFIED_SOURCES += [
-    'cryptox.c',
-    'mar_verify.c',
-]
-
-FORCE_STATIC_LIB = True
-
-if CONFIG['OS_ARCH'] == 'WINNT':
-    USE_STATIC_LIBS = True
-elif CONFIG['OS_ARCH'] == 'Darwin':
-    UNIFIED_SOURCES += [
-      'MacVerifyCrypto.cpp',
-    ]
-    OS_LIBS += [
-      '-framework Security',
-    ]
-else:
-    DEFINES['MAR_NSS'] = True
-    LOCAL_INCLUDES += ['../sign']
-
-LOCAL_INCLUDES += [
-    '../src',
-]
-
diff --git a/onlineupdate/source/update/common/moz.build b/onlineupdate/source/update/common/moz.build
deleted file mode 100644
index 0444336..0000000
--- a/onlineupdate/source/update/common/moz.build
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-EXPORTS += [
-    'readstrings.h',
-    'updatedefines.h',
-    'updatelogging.h',
-]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    EXPORTS += [
-        'pathhash.h',
-        'uachelper.h',
-        'updatehelper.cpp',
-        'updatehelper.h',
-    ]
-
-Library('updatecommon')
-
-srcdir = '.'
-
-include('sources.mozbuild')
-
-FINAL_LIBRARY = 'xul'
-
-FAIL_ON_WARNINGS = True
diff --git a/onlineupdate/source/update/src/moz.build b/onlineupdate/source/update/src/moz.build
deleted file mode 100644
index 2d25e08..0000000
--- a/onlineupdate/source/update/src/moz.build
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-EXPORTS += [
-    'mar.h',
-    'mar_cmdline.h',
-]
-
-HOST_SOURCES += [
-    'mar_create.c',
-    'mar_extract.c',
-    'mar_read.c',
-]
-HostLibrary('hostmar')
-
-Library('mar')
-
-UNIFIED_SOURCES += [
-    'mar_create.c',
-    'mar_extract.c',
-    'mar_read.c',
-]
-
-FORCE_STATIC_LIB = True
-
-if CONFIG['OS_ARCH'] == 'WINNT':
-    USE_STATIC_LIBS = True
diff --git a/onlineupdate/source/update/updater/automounter_gonk.cxx b/onlineupdate/source/update/updater/automounter_gonk.cxx
deleted file mode 100644
index 3dff2a1..0000000
--- a/onlineupdate/source/update/updater/automounter_gonk.cxx
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* 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/. */
-
-#include <android/log.h>
-#include <cutils/android_reboot.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/mount.h>
-#include <sys/reboot.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "automounter_gonk.h"
-#include "updatedefines.h"
-#include "updatelogging.h"
-
-#define LOG_TAG "GonkAutoMounter"
-
-#define GONK_LOG(level, format, ...) \
-  LOG((LOG_TAG ": " format "\n", ##__VA_ARGS__)); \
-  __android_log_print(level, LOG_TAG, format, ##__VA_ARGS__)
-
-#define LOGI(format, ...) GONK_LOG(ANDROID_LOG_INFO, format, ##__VA_ARGS__)
-#define LOGE(format, ...) GONK_LOG(ANDROID_LOG_ERROR, format, ##__VA_ARGS__)
-
-const char *kGonkMountsPath = "/proc/mounts";
-const char *kGonkSystemPath = "/system";
-
-GonkAutoMounter::GonkAutoMounter() : mDevice(nullptr), mAccess(Unknown)
-{
-  if (!RemountSystem(ReadWrite)) {
-    LOGE("Could not remount %s as read-write.", kGonkSystemPath);
-  }
-}
-
-GonkAutoMounter::~GonkAutoMounter()
-{
-  bool result = RemountSystem(ReadOnly);
-  free(mDevice);
-
-  if (!result) {
-    // Don't take any chances when remounting as read-only fails, just reboot.
-    Reboot();
-  }
-}
-
-void
-GonkAutoMounter::Reboot()
-{
-  // The android_reboot wrapper provides more safety, doing fancier read-only
-  // remounting and attempting to sync() the filesystem first. If this fails
-  // our only hope is to force a reboot directly without these protections.
-  // For more, see system/core/libcutils/android_reboot.c
-  LOGE("Could not remount %s as read-only, forcing a system reboot.",
-       kGonkSystemPath);
-  LogFlush();
-
-  if (android_reboot(ANDROID_RB_RESTART, 0, nullptr) != 0) {
-    LOGE("Safe system reboot failed, attempting to force");
-    LogFlush();
-
-    if (reboot(RB_AUTOBOOT) != 0) {
-      LOGE("CRITICAL: Failed to force restart");
-    }
-  }
-}
-
-static const char *
-MountAccessToString(MountAccess access)
-{
-  switch (access) {
-    case ReadOnly: return "read-only";
-    case ReadWrite: return "read-write";
-    default: return "unknown";
-  }
-}
-
-bool
-GonkAutoMounter::RemountSystem(MountAccess access)
-{
-  if (!UpdateMountStatus()) {
-    return false;
-  }
-
-  if (mAccess == access) {
-    return true;
-  }
-
-  unsigned long flags = MS_REMOUNT;
-  if (access == ReadOnly) {
-    flags |= MS_RDONLY;
-    // Give the system a chance to flush file buffers
-    sync();
-  }
-
-  if (!MountSystem(flags)) {
-    return false;
-  }
-
-  // Check status again to verify /system has been properly remounted
-  if (!UpdateMountStatus()) {
-    return false;
-  }
-
-  if (mAccess != access) {
-    LOGE("Updated mount status %s should be %s",
-         MountAccessToString(mAccess),
-         MountAccessToString(access));
-    return false;
-  }
-
-  return true;
-}
-
-bool
-GonkAutoMounter::UpdateMountStatus()
-{
-  FILE *mountsFile = NS_tfopen(kGonkMountsPath, "r");
-
-  if (mountsFile == nullptr) {
-    LOGE("Error opening %s: %s", kGonkMountsPath, strerror(errno));
-    return false;
-  }
-
-  // /proc/mounts returns a 0 size from fstat, so we use the same
-  // pre-allocated buffer size that ADB does here
-  const int mountsMaxSize = 4096;
-  char mountData[mountsMaxSize];
-  size_t read = fread(mountData, 1, mountsMaxSize - 1, mountsFile);
-  mountData[read + 1] = '\0';
-
-  if (ferror(mountsFile)) {
-    LOGE("Error reading %s, %s", kGonkMountsPath, strerror(errno));
-    fclose(mountsFile);
-    return false;
-  }
-
-  char *token, *tokenContext;
-  bool foundSystem = false;
-
-  for (token = strtok_r(mountData, "\n", &tokenContext);
-       token;
-       token = strtok_r(nullptr, "\n", &tokenContext))
-  {
-    if (ProcessMount(token)) {
-      foundSystem = true;
-      break;
-    }
-  }
-
-  fclose(mountsFile);
-
-  if (!foundSystem) {
-    LOGE("Couldn't find %s mount in %s", kGonkSystemPath, kGonkMountsPath);
-  }
-  return foundSystem;
-}
-
-bool
-GonkAutoMounter::ProcessMount(const char *mount)
-{
-  const int strSize = 256;
-  char mountDev[strSize];
-  char mountDir[strSize];
-  char mountAccess[strSize];
-
-  int rv = sscanf(mount, "%255s %255s %*s %255s %*d %*d\n",
-                  mountDev, mountDir, mountAccess);
-  mountDev[strSize - 1] = '\0';
-  mountDir[strSize - 1] = '\0';
-  mountAccess[strSize - 1] = '\0';
-
-  if (rv != 3) {
-    return false;
-  }
-
-  if (strcmp(kGonkSystemPath, mountDir) != 0) {
-    return false;
-  }
-
-  free(mDevice);
-  mDevice = strdup(mountDev);
-  mAccess = Unknown;
-
-  char *option, *optionContext;
-  for (option = strtok_r(mountAccess, ",", &optionContext);
-       option;
-       option = strtok_r(nullptr, ",", &optionContext))
-  {
-    if (strcmp("ro", option) == 0) {
-      mAccess = ReadOnly;
-      break;
-    } else if (strcmp("rw", option) == 0) {
-      mAccess = ReadWrite;
-      break;
-    }
-  }
-
-  return true;
-}
-
-/*
- * Mark the given block device as read-write or read-only, using the BLKROSET
- * ioctl.
- */
-static void SetBlockReadWriteStatus(const char *blockdev, bool setReadOnly) {
-  int fd;
-  int roMode = setReadOnly ? 1 : 0;
-
-  fd = open(blockdev, O_RDONLY);
-  if (fd < 0) {
-    return;
-  }
-
-  if (ioctl(fd, BLKROSET, &roMode) == -1) {
-    LOGE("Error setting read-only mode on %s to %s: %s", blockdev,
-         setReadOnly ? "true": "false", strerror(errno));
-  }
-  close(fd);
-}
-
-
-bool
-GonkAutoMounter::MountSystem(unsigned long flags)
-{
-  if (!mDevice) {
-    LOGE("No device was found for %s", kGonkSystemPath);
-    return false;
-  }
-
-  // Without setting the block device ro mode to false, we get a permission
-  // denied error while trying to remount it in read-write.
-  SetBlockReadWriteStatus(mDevice, (flags & MS_RDONLY));
-
-  const char *readOnly = flags & MS_RDONLY ? "read-only" : "read-write";
-  int result = mount(mDevice, kGonkSystemPath, "none", flags, nullptr);
-
-  if (result != 0) {
-    LOGE("Error mounting %s as %s: %s", kGonkSystemPath, readOnly,
-         strerror(errno));
-    return false;
-  }
-
-  LOGI("Mounted %s partition as %s", kGonkSystemPath, readOnly);
-  return true;
-}
diff --git a/onlineupdate/source/update/updater/automounter_gonk.h b/onlineupdate/source/update/updater/automounter_gonk.h
deleted file mode 100644
index 1300d39..0000000
--- a/onlineupdate/source/update/updater/automounter_gonk.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* 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/. */
-
-#ifndef AUTOMOUNTER_GONK_H__
-#define AUTOMOUNTER_GONK_H__
-
-typedef enum {
-  ReadOnly,
-  ReadWrite,
-  Unknown
-} MountAccess;
-
-/**
- * This class will remount the /system partition as read-write in Gonk to allow
- * the updater write access. Upon destruction, /system will be remounted back to
- * read-only. If something causes /system to remain read-write, this class will
- * reboot the device and allow the system to mount as read-only.
- *
- * Code inspired from AOSP system/core/adb/remount_service.c
- */
-class GonkAutoMounter
-{
-public:
-  GonkAutoMounter();
-  ~GonkAutoMounter();
-
-  const MountAccess GetAccess()
-  {
-    return mAccess;
-  }
-
-private:
-  bool RemountSystem(MountAccess access);
-  bool ForceRemountReadOnly();
-  bool UpdateMountStatus();
-  bool ProcessMount(const char *mount);
-  bool MountSystem(unsigned long flags);
-  void Reboot();
-
-private:
-  char *mDevice;
-  MountAccess mAccess;
-};
-
-#endif // AUTOMOUNTER_GONK_H__
diff --git a/onlineupdate/source/update/updater/moz.build b/onlineupdate/source/update/updater/moz.build
deleted file mode 100644
index d5b1d50..0000000
--- a/onlineupdate/source/update/updater/moz.build
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-Program('updater')
-
-updater_rel_path = ''
-include('updater-common.build')
-if CONFIG['ENABLE_TESTS']:
-    DIRS += ['updater-xpcshell']
-FAIL_ON_WARNINGS = True


More information about the Libreoffice-commits mailing list