From 6aa9bd0f77dcb5128167fae62e32aa5252fe85c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 2 Dec 2013 00:55:24 +0100 Subject: Renew the updater branch Now with some actual consensus on what the updater will do! --- mmc_updater/CMakeLists.txt | 44 + mmc_updater/LICENSE | 19 + mmc_updater/README.md | 138 + .../cmake/modules/GenerateCppResourceFile.cmake | 23 + mmc_updater/depends/AnyOption/CMakeLists.txt | 9 + mmc_updater/depends/AnyOption/README | 16 + mmc_updater/depends/AnyOption/anyoption.cpp | 1176 ++++++ mmc_updater/depends/AnyOption/anyoption.h | 270 ++ mmc_updater/depends/tinyxml/CMakeLists.txt | 24 + mmc_updater/depends/tinyxml/readme.txt | 530 +++ mmc_updater/depends/tinyxml/tinystr.cpp | 111 + mmc_updater/depends/tinyxml/tinystr.h | 305 ++ mmc_updater/depends/tinyxml/tinyxml.cpp | 1886 +++++++++ mmc_updater/depends/tinyxml/tinyxml.h | 1805 +++++++++ mmc_updater/depends/tinyxml/tinyxmlerror.cpp | 52 + mmc_updater/depends/tinyxml/tinyxmlparser.cpp | 1638 ++++++++ mmc_updater/depends/win32cpp/controls.h | 1074 +++++ mmc_updater/depends/win32cpp/copyright.txt | 33 + mmc_updater/depends/win32cpp/cstring.h | 905 +++++ mmc_updater/depends/win32cpp/default_resource.h | 94 + mmc_updater/depends/win32cpp/default_resource.rc | 250 ++ mmc_updater/depends/win32cpp/dialog.h | 876 ++++ mmc_updater/depends/win32cpp/docking.h | 4214 ++++++++++++++++++++ mmc_updater/depends/win32cpp/file.h | 392 ++ mmc_updater/depends/win32cpp/frame.h | 3303 +++++++++++++++ mmc_updater/depends/win32cpp/gdi.h | 3944 ++++++++++++++++++ mmc_updater/depends/win32cpp/info.txt | 205 + mmc_updater/depends/win32cpp/listview.h | 867 ++++ mmc_updater/depends/win32cpp/mdi.h | 783 ++++ mmc_updater/depends/win32cpp/menu.h | 600 +++ mmc_updater/depends/win32cpp/propertysheet.h | 960 +++++ mmc_updater/depends/win32cpp/rebar.h | 709 ++++ mmc_updater/depends/win32cpp/release notes.txt | 116 + mmc_updater/depends/win32cpp/ribbon.h | 527 +++ mmc_updater/depends/win32cpp/shared_ptr.h | 199 + mmc_updater/depends/win32cpp/socket.h | 778 ++++ mmc_updater/depends/win32cpp/statusbar.h | 226 ++ mmc_updater/depends/win32cpp/stdcontrols.h | 1000 +++++ mmc_updater/depends/win32cpp/tab.h | 1658 ++++++++ mmc_updater/depends/win32cpp/taskdialog.h | 811 ++++ mmc_updater/depends/win32cpp/thread.h | 241 ++ mmc_updater/depends/win32cpp/toolbar.h | 1361 +++++++ mmc_updater/depends/win32cpp/treeview.h | 624 +++ mmc_updater/depends/win32cpp/wceframe.h | 420 ++ mmc_updater/depends/win32cpp/wcestddef.h | 58 + mmc_updater/depends/win32cpp/webbrowser.h | 760 ++++ mmc_updater/depends/win32cpp/wincore.h | 2977 ++++++++++++++ mmc_updater/depends/win32cpp/winutils.h | 649 +++ mmc_updater/src/AppInfo.cpp | 23 + mmc_updater/src/AppInfo.h | 39 + mmc_updater/src/CMakeLists.txt | 121 + mmc_updater/src/DirIterator.cpp | 85 + mmc_updater/src/DirIterator.h | 43 + mmc_updater/src/FileUtils.cpp | 557 +++ mmc_updater/src/FileUtils.h | 141 + mmc_updater/src/Log.cpp | 65 + mmc_updater/src/Log.h | 46 + mmc_updater/src/MacBundle.cpp | 53 + mmc_updater/src/MacBundle.h | 35 + mmc_updater/src/Platform.h | 30 + mmc_updater/src/ProcessUtils.cpp | 536 +++ mmc_updater/src/ProcessUtils.h | 97 + mmc_updater/src/StandardDirs.cpp | 63 + mmc_updater/src/StandardDirs.h | 22 + mmc_updater/src/StandardDirs.mm | 18 + mmc_updater/src/StlSymbolsLeopard.cpp | 75 + mmc_updater/src/StringUtils.h | 46 + mmc_updater/src/UpdateDialog.cpp | 25 + mmc_updater/src/UpdateDialog.h | 29 + mmc_updater/src/UpdateDialogAscii.cpp | 70 + mmc_updater/src/UpdateDialogAscii.h | 32 + mmc_updater/src/UpdateDialogCocoa.h | 32 + mmc_updater/src/UpdateDialogCocoa.mm | 194 + mmc_updater/src/UpdateDialogGtk.cpp | 155 + mmc_updater/src/UpdateDialogGtk.h | 42 + mmc_updater/src/UpdateDialogGtkFactory.cpp | 59 + mmc_updater/src/UpdateDialogGtkFactory.h | 13 + mmc_updater/src/UpdateDialogWin32.cpp | 215 + mmc_updater/src/UpdateDialogWin32.h | 39 + mmc_updater/src/UpdateInstaller.cpp | 439 ++ mmc_updater/src/UpdateInstaller.h | 70 + mmc_updater/src/UpdateMessage.h | 42 + mmc_updater/src/UpdateObserver.h | 15 + mmc_updater/src/UpdateScript.cpp | 98 + mmc_updater/src/UpdateScript.h | 86 + mmc_updater/src/UpdaterOptions.cpp | 156 + mmc_updater/src/UpdaterOptions.h | 27 + mmc_updater/src/main.cpp | 201 + mmc_updater/src/resources/Info.plist | 38 + mmc_updater/src/resources/icon128.png | Bin 0 -> 3802 bytes mmc_updater/src/resources/icon64.png | Bin 0 -> 2182 bytes mmc_updater/src/resources/mac.icns | Bin 0 -> 43606 bytes mmc_updater/src/resources/updater.ico | Bin 0 -> 82726 bytes mmc_updater/src/resources/updater.rc | 30 + mmc_updater/src/tests/CMakeLists.txt | 51 + mmc_updater/src/tests/TestFileUtils.cpp | 50 + mmc_updater/src/tests/TestFileUtils.h | 10 + mmc_updater/src/tests/TestUpdateScript.cpp | 48 + mmc_updater/src/tests/TestUpdateScript.h | 9 + mmc_updater/src/tests/TestUpdaterOptions.cpp | 68 + mmc_updater/src/tests/TestUpdaterOptions.h | 8 + mmc_updater/src/tests/TestUtils.h | 108 + mmc_updater/src/tests/file_list.xml | 52 + mmc_updater/src/tests/new_app.cpp | 8 + mmc_updater/src/tests/old_app.cpp | 7 + mmc_updater/src/tests/test-update.rb | 218 + mmc_updater/src/tests/v2_file_list.xml | 67 + 107 files changed, 44566 insertions(+) create mode 100644 mmc_updater/CMakeLists.txt create mode 100644 mmc_updater/LICENSE create mode 100644 mmc_updater/README.md create mode 100644 mmc_updater/cmake/modules/GenerateCppResourceFile.cmake create mode 100644 mmc_updater/depends/AnyOption/CMakeLists.txt create mode 100644 mmc_updater/depends/AnyOption/README create mode 100644 mmc_updater/depends/AnyOption/anyoption.cpp create mode 100644 mmc_updater/depends/AnyOption/anyoption.h create mode 100644 mmc_updater/depends/tinyxml/CMakeLists.txt create mode 100644 mmc_updater/depends/tinyxml/readme.txt create mode 100644 mmc_updater/depends/tinyxml/tinystr.cpp create mode 100644 mmc_updater/depends/tinyxml/tinystr.h create mode 100644 mmc_updater/depends/tinyxml/tinyxml.cpp create mode 100644 mmc_updater/depends/tinyxml/tinyxml.h create mode 100644 mmc_updater/depends/tinyxml/tinyxmlerror.cpp create mode 100644 mmc_updater/depends/tinyxml/tinyxmlparser.cpp create mode 100644 mmc_updater/depends/win32cpp/controls.h create mode 100644 mmc_updater/depends/win32cpp/copyright.txt create mode 100644 mmc_updater/depends/win32cpp/cstring.h create mode 100644 mmc_updater/depends/win32cpp/default_resource.h create mode 100644 mmc_updater/depends/win32cpp/default_resource.rc create mode 100644 mmc_updater/depends/win32cpp/dialog.h create mode 100644 mmc_updater/depends/win32cpp/docking.h create mode 100644 mmc_updater/depends/win32cpp/file.h create mode 100644 mmc_updater/depends/win32cpp/frame.h create mode 100644 mmc_updater/depends/win32cpp/gdi.h create mode 100644 mmc_updater/depends/win32cpp/info.txt create mode 100644 mmc_updater/depends/win32cpp/listview.h create mode 100644 mmc_updater/depends/win32cpp/mdi.h create mode 100644 mmc_updater/depends/win32cpp/menu.h create mode 100644 mmc_updater/depends/win32cpp/propertysheet.h create mode 100644 mmc_updater/depends/win32cpp/rebar.h create mode 100644 mmc_updater/depends/win32cpp/release notes.txt create mode 100644 mmc_updater/depends/win32cpp/ribbon.h create mode 100644 mmc_updater/depends/win32cpp/shared_ptr.h create mode 100644 mmc_updater/depends/win32cpp/socket.h create mode 100644 mmc_updater/depends/win32cpp/statusbar.h create mode 100644 mmc_updater/depends/win32cpp/stdcontrols.h create mode 100644 mmc_updater/depends/win32cpp/tab.h create mode 100644 mmc_updater/depends/win32cpp/taskdialog.h create mode 100644 mmc_updater/depends/win32cpp/thread.h create mode 100644 mmc_updater/depends/win32cpp/toolbar.h create mode 100644 mmc_updater/depends/win32cpp/treeview.h create mode 100644 mmc_updater/depends/win32cpp/wceframe.h create mode 100644 mmc_updater/depends/win32cpp/wcestddef.h create mode 100644 mmc_updater/depends/win32cpp/webbrowser.h create mode 100644 mmc_updater/depends/win32cpp/wincore.h create mode 100644 mmc_updater/depends/win32cpp/winutils.h create mode 100644 mmc_updater/src/AppInfo.cpp create mode 100644 mmc_updater/src/AppInfo.h create mode 100644 mmc_updater/src/CMakeLists.txt create mode 100644 mmc_updater/src/DirIterator.cpp create mode 100644 mmc_updater/src/DirIterator.h create mode 100644 mmc_updater/src/FileUtils.cpp create mode 100644 mmc_updater/src/FileUtils.h create mode 100644 mmc_updater/src/Log.cpp create mode 100644 mmc_updater/src/Log.h create mode 100644 mmc_updater/src/MacBundle.cpp create mode 100644 mmc_updater/src/MacBundle.h create mode 100644 mmc_updater/src/Platform.h create mode 100644 mmc_updater/src/ProcessUtils.cpp create mode 100644 mmc_updater/src/ProcessUtils.h create mode 100644 mmc_updater/src/StandardDirs.cpp create mode 100644 mmc_updater/src/StandardDirs.h create mode 100644 mmc_updater/src/StandardDirs.mm create mode 100644 mmc_updater/src/StlSymbolsLeopard.cpp create mode 100644 mmc_updater/src/StringUtils.h create mode 100644 mmc_updater/src/UpdateDialog.cpp create mode 100644 mmc_updater/src/UpdateDialog.h create mode 100644 mmc_updater/src/UpdateDialogAscii.cpp create mode 100644 mmc_updater/src/UpdateDialogAscii.h create mode 100644 mmc_updater/src/UpdateDialogCocoa.h create mode 100644 mmc_updater/src/UpdateDialogCocoa.mm create mode 100644 mmc_updater/src/UpdateDialogGtk.cpp create mode 100644 mmc_updater/src/UpdateDialogGtk.h create mode 100644 mmc_updater/src/UpdateDialogGtkFactory.cpp create mode 100644 mmc_updater/src/UpdateDialogGtkFactory.h create mode 100644 mmc_updater/src/UpdateDialogWin32.cpp create mode 100644 mmc_updater/src/UpdateDialogWin32.h create mode 100644 mmc_updater/src/UpdateInstaller.cpp create mode 100644 mmc_updater/src/UpdateInstaller.h create mode 100644 mmc_updater/src/UpdateMessage.h create mode 100644 mmc_updater/src/UpdateObserver.h create mode 100644 mmc_updater/src/UpdateScript.cpp create mode 100644 mmc_updater/src/UpdateScript.h create mode 100644 mmc_updater/src/UpdaterOptions.cpp create mode 100644 mmc_updater/src/UpdaterOptions.h create mode 100644 mmc_updater/src/main.cpp create mode 100644 mmc_updater/src/resources/Info.plist create mode 100644 mmc_updater/src/resources/icon128.png create mode 100644 mmc_updater/src/resources/icon64.png create mode 100644 mmc_updater/src/resources/mac.icns create mode 100644 mmc_updater/src/resources/updater.ico create mode 100644 mmc_updater/src/resources/updater.rc create mode 100644 mmc_updater/src/tests/CMakeLists.txt create mode 100644 mmc_updater/src/tests/TestFileUtils.cpp create mode 100644 mmc_updater/src/tests/TestFileUtils.h create mode 100644 mmc_updater/src/tests/TestUpdateScript.cpp create mode 100644 mmc_updater/src/tests/TestUpdateScript.h create mode 100644 mmc_updater/src/tests/TestUpdaterOptions.cpp create mode 100644 mmc_updater/src/tests/TestUpdaterOptions.h create mode 100644 mmc_updater/src/tests/TestUtils.h create mode 100644 mmc_updater/src/tests/file_list.xml create mode 100644 mmc_updater/src/tests/new_app.cpp create mode 100644 mmc_updater/src/tests/old_app.cpp create mode 100755 mmc_updater/src/tests/test-update.rb create mode 100644 mmc_updater/src/tests/v2_file_list.xml (limited to 'mmc_updater') diff --git a/mmc_updater/CMakeLists.txt b/mmc_updater/CMakeLists.txt new file mode 100644 index 00000000..ef4b096d --- /dev/null +++ b/mmc_updater/CMakeLists.txt @@ -0,0 +1,44 @@ +project(updater) + +cmake_minimum_required(VERSION 2.6) +enable_testing() +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +include_directories(depends) + +if (WIN32) + include_directories(depends/win32cpp/include) + + if(MSVC) + # - Link the updater binary statically with the Visual C++ runtime + # so that the executable can function standalone. + # - Enable PDB generation for release builds + set(CMAKE_CXX_FLAGS_DEBUG "/MT") + set(CMAKE_C_FLAGS_DEBUG "/MT") + + set(CMAKE_CXX_FLAGS_RELEASE "/MT /Zi /O2 /Ob2 /D NDEBUG") + set(CMAKE_C_FLAGS_RELEASE "/MT /Zi /O2 /Ob2 /D NDEBUG") + remove_definitions(-DUNICODE -D_UNICODE) + endif() +else() + # optimize for reduced code size + set(CMAKE_CXX_FLAGS_RELEASE "-Os") + set(CMAKE_C_FLAGS_RELEASE "-Os") +endif() + +if (APPLE) + # Build the updater as a dual 32/64bit binary. If only one architecture + # is required, removing the other architecture will reduce the size + # of the updater binary + set(CMAKE_OSX_ARCHITECTURES i386;x86_64) + + # Build the updater so that it works on OS X 10.5 and above. + set(MIN_OSX_VERSION 10.5) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${MIN_OSX_VERSION}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${MIN_OSX_VERSION}") +endif() + +add_subdirectory(src) +add_subdirectory(depends/AnyOption) +add_subdirectory(depends/tinyxml) + diff --git a/mmc_updater/LICENSE b/mmc_updater/LICENSE new file mode 100644 index 00000000..f71a89be --- /dev/null +++ b/mmc_updater/LICENSE @@ -0,0 +1,19 @@ + +This project is licensed under a BSD license. + +The Mendeley Desktop icon graphics and name are trademarks of Mendeley Ltd. +and must be removed or replaced - see src/AppInfo.cpp and the files +in src/resources. + +=== + +Copyright (c) 2011, Mendeley Ltd. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/mmc_updater/README.md b/mmc_updater/README.md new file mode 100644 index 00000000..fa3c41ae --- /dev/null +++ b/mmc_updater/README.md @@ -0,0 +1,138 @@ +This tool is a component of a cross-platform auto-update system. +It is responsible for performing the installation of an update after +the necessary files have been downloaded to a temporary directory. + +It was originally written for use with Mendeley Desktop (see www.mendeley.com) + +The tool consists of a single small binary which performs update installation, +an XML file format describing the contents of an update (an 'update script') +and a tool to create update scripts from a directory containing an installed application. + +To perform an update, the application (or another separate tool) needs to download +the updater binary, an update script and one or more compressed packages +containing the files for the update to a temporary directory. It then needs +to invoke the updater, specifying the location where the application is installed, +the location of the compressed packages and the path to the update script. + +Once the updater has been started, it: + + 1. Waits for the application to exit + 2. Acquires the necessary priviledges to install the updates, prompting + the user if necessary. + 3. Installs the updates, displaying progress to the user in a small dialog + 4. Performs cleanup and any additional actions required as part of the update + 5. Starts the new version of the main application. + + In the event of a failure during the update, the installation is rolled back + to its previous state and a message is presented to the user. + +## Building the Updater + + Create a new directory for the build and from that directory run: + + cmake + make + + The updater binary will be built in the src/ directory. + + You should also run the tests in src/tests to verify that the updater is + functioning correctly. + +## Preparing an Update + + 1. Create a directory containing your application's files, + laid out in the same way and with the same permissions as they would be when installed. + 2. Create a config file specifying how the application's files should be + partitioned into packages - see tools/config-template.json + 3. Use the tools/create-packages.rb script to create a file_list.xml file + and a set of package files required for updates. + 4. Upload the file_list.xml file and packages to a server + + After step 4 is done, you need to notify existing installs that an update + is available. The installed application then needs to download the + relevant packages, file_list.xml file and updater binary to a temporary + directory and invoke the updater. + + See doc/update-hosting for more details on hosting and delivering the updates. + +## Invoking the Updater + + Once the application has downloaded an update, it needs to invoke it. The syntax is: + + updater --install-dir --package-dir --script