gecko-dev/toolkit/xre/moz.build
Kirk Steuber 19c8368ea5 Bug 1458314 - Move the update directory to an installation specific location r=rstrong
This change applies to Windows only.
Firefox will need to migrate the directory from the old location to the new location. This will be done only once by setting the pref `app.update.migrated.updateDir2.<install path hash>` to `true` once migration has completed.

Note: The pref name app.update.migrated.updateDir has already been used, thus the '2' suffix. It can be found in ESR24.

This also removes the old handling fallback for generating the update directory path. Since xulrunner is no longer supported, this should no longer be needed. If neither the vendor nor app name are defined, it falls back to the literal string "Mozilla".

The code to generate the update directory path and the installation hash have been moved to the updatecommon library. This will allow those functions to be used in Firefox, the Mozilla Maintenance Service, the Mozilla Maintenance Service Installer, and TestAUSHelper.

Additionally, the function that generates the update directory path now has extra functionality. It creates the update directory, sets the permissions on it and, optionally, recursively sets the permissions on everything within.

This patch adds functionality that allows Firefox to set permissions on the new update directory on write failure. It attempts to set the permissions itself and, if that fails and the maintenance service is enabled, it calls into the maintenance service to try from there. If a write fails and the permissions cannot be fixed, the user is prompted to reinstall.

Differential Revision: https://phabricator.services.mozilla.com/D4249

--HG--
rename : toolkit/mozapps/update/updater/win_dirent.cpp => toolkit/mozapps/update/common/win_dirent.cpp
rename : toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js => toolkit/mozapps/update/tests/unit_aus_update/updateDirectoryMigrate.js
extra : moz-landing-system : lando
2018-10-23 21:41:04 +00:00

236 lines
6.0 KiB
Python

# -*- Mode: python; 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/.
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Startup and Profile System')
if CONFIG['OS_ARCH'] == 'WINNT':
TEST_DIRS += ['test/win']
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini']
XPIDL_SOURCES += [
'nsINativeAppSupport.idl',
'nsIXREDirProvider.idl',
]
if CONFIG['OS_ARCH'] == 'WINNT':
XPIDL_SOURCES += [
'nsIWinAppHelper.idl',
]
XPIDL_MODULE = 'xulapp'
EXPORTS += [
'nsAppRunner.h',
'nsIAppStartupNotifier.h',
]
EXPORTS.mozilla += [
'AutoSQLiteLifetime.h',
'Bootstrap.h',
'CmdLineAndEnvUtils.h',
'SafeMode.h',
]
if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
EXPORTS += ['EventTracer.h']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
EXPORTS.mozilla += [
'PolicyChecks.h',
'WinDllServices.h',
]
UNIFIED_SOURCES += [
'/toolkit/mozapps/update/common/win_dirent.cpp',
'nsNativeAppSupportWin.cpp',
'WinDllServices.cpp',
]
DEFINES['PROXY_PRINTING'] = 1
LOCAL_INCLUDES += [
'../components/printingui',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
UNIFIED_SOURCES += [
'MacApplicationDelegate.mm',
'MacAutoreleasePool.mm',
'MacLaunchHelper.mm',
'nsCommandLineServiceMac.cpp',
'nsNativeAppSupportCocoa.mm',
'updaterfileutils_osx.mm',
]
DEFINES['PROXY_PRINTING'] = 1
LOCAL_INCLUDES += [
'../components/printingui',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
UNIFIED_SOURCES += [
'nsNativeAppSupportDefault.cpp',
'UIKitDirProvider.mm',
]
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
UNIFIED_SOURCES += [
'nsNativeAppSupportUnix.cpp',
]
else:
UNIFIED_SOURCES += [
'nsNativeAppSupportDefault.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
UNIFIED_SOURCES += [
'nsGDKErrorHandler.cpp',
]
if CONFIG['MOZ_X11']:
EXPORTS += ['nsX11ErrorHandler.h']
UNIFIED_SOURCES += [
'nsX11ErrorHandler.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
UNIFIED_SOURCES += [
'nsAndroidStartup.cpp',
]
UNIFIED_SOURCES += [
'/toolkit/mozapps/update/common/commonupdatedir.cpp',
'AutoSQLiteLifetime.cpp',
'Bootstrap.cpp',
'CreateAppData.cpp',
'nsAppStartupNotifier.cpp',
'nsConsoleWriter.cpp',
'nsEmbeddingModule.cpp',
'nsNativeAppSupportBase.cpp',
'nsSigHandlers.cpp',
'nsXREDirProvider.cpp',
]
# nsAppRunner.cpp and ProfileReset.cpp cannot be built in unified mode because
# they pull in OS X system headers.
# nsEmbedFunctions.cpp cannot be built in unified mode because it pulls in X11 headers.
SOURCES += [
'../../other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp',
'nsAppRunner.cpp',
'nsEmbedFunctions.cpp',
'ProfileReset.cpp',
]
if CONFIG['MOZ_X11']:
UNIFIED_SOURCES += [
'glxtest.cpp',
]
if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
UNIFIED_SOURCES += [
'EventTracer.cpp',
]
if CONFIG['MOZ_UPDATER']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
UNIFIED_SOURCES += [
'nsUpdateDriver.cpp',
]
if CONFIG['MOZ_PDF_PRINTING']:
DEFINES['PROXY_PRINTING'] = 1
LOCAL_INCLUDES += [
'../components/printingui',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_X11']:
DEFINES['USE_GLX_TEST'] = True
for var in ('MOZ_APP_NAME', 'MOZ_APP_BASENAME', 'MOZ_APP_DISPLAYNAME',
'MOZ_APP_VERSION', 'OS_TARGET', 'MOZ_WIDGET_TOOLKIT'):
DEFINES[var] = '"%s"' % CONFIG[var]
if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
DEFINES['MOZ_UPDATER'] = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['WIN32_LEAN_AND_MEAN'] = True
DEFINES['UNICODE'] = True
DEFINES['_UNICODE'] = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DEFINES['ANDROID_PACKAGE_NAME'] = '"%s"' % CONFIG['ANDROID_PACKAGE_NAME']
if CONFIG['TARGET_XPCOM_ABI']:
DEFINES['TARGET_OS_ABI'] = '"%s_%s"' % (CONFIG['OS_TARGET'],
CONFIG['TARGET_XPCOM_ABI'])
if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
DEFINES['HAVE_USR_LIB64_DIR'] = True
DEFINES['GRE_MILESTONE'] = CONFIG['GRE_MILESTONE']
for var in ('APP_VERSION', 'APP_ID'):
DEFINES[var] = CONFIG['MOZ_%s' % var]
if CONFIG['MOZ_BUILD_APP'] == 'browser':
DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True
LOCAL_INCLUDES += [
'../../other-licenses/nsis/Contrib/CityHash/cityhash',
'../components/find',
'../components/printingui/ipc',
'../components/windowwatcher',
'../profile',
'/config',
'/dom/base',
'/dom/commandhandler',
'/dom/ipc',
'/dom/webbrowserpersist',
'/testing/gtest/mozilla',
'/toolkit/crashreporter',
'/xpcom/build',
]
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
LOCAL_INCLUDES += [
'/security/sandbox/chromium',
'/security/sandbox/chromium-shim',
]
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'Linux':
USE_LIBS += [
'mozsandbox',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/widget',
'/widget/cocoa',
]
CXXFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
LOCAL_INCLUDES += [
'/widget/xremoteclient',
]
DEFINES['TOPOBJDIR'] = TOPOBJDIR
FINAL_TARGET_PP_FILES += [
'platform.ini'
]
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow']
if CONFIG['MOZ_IPDL_TESTS']:
DEFINES['MOZ_IPDL_TESTS'] = True