Giter VIP home page Giter VIP logo

bindirpatch's Introduction

Overview

This is a collection of tools for managing application updates. It consists of the following tools:

  • bindirpatch: Creates and applies diffs between two directories
  • deploy: Creates a patch, manages version numbers and uploads to an FTP server
  • autoupdate: Checks FTP server for new version and installs updates

The bindirpatch tool works standalone and has no dependencies to the other scripts (except for utils.py and the external tools). The deploy and autoupdate scripts are meant to be used together. They require an FTP server that should have two user accounts, one with read-only access and one with write access. The server will always have the latest version of the application, along with a history of patches that can be used to update previous versions.

Dependencies

You need the Windows version of bsdiff and bspatch. You also need the command-line version of 7zip. You may need to adjust the paths to the executables in the utils.py script.

How To Use

  • Setup an FTP server with two users: One with write privileges, another with read only access.
  • In your current application release, at the root directory, create a file named VERSION that contains the number 1. This release version number is incremented automatically by the patch tools whenever to deploy a new release of your application.
  • Make some changes in your application and build a new release. Do not overwrite the old release.
  • Run deploy.py, passing in the old and new release, as well as the url and write-access login data for your FTP server.
  • Create a python script / batch file / exe that runs autoupdate.py with the correct path and the read-only login data for your FTP server and hand that out to your users.

You can use PyInstaller to create a standalone executable from the autoupdate script. This way, your users will not need a Python installation.

It is recommended that you create a launcher GUI application that runs the autoupdate script and then launches the application.

bindirpatch

This Python script creates or applies a binary diff between two directories. This is useful for creating application update patches. Internally, it uses bsdiff/bspatch on each file that was modified. It uses an index file to keep track of which files were added / modified / deleted. The result is compressed with 7zip.

Usage

Create Patch

bindirpatch.py diff <oldDir> <newDir> <outDir> [options]

This will create a patch that updates <oldDir> to the state in <newDir> and stores the resulting patch file in <outDir>. Note that this may take several minutes depending on the size of the content. Check out the -j option.

Apply Patch

bindirpatch.py patch <patchFile> <targetDir> [options]

Applies the <patchFile> to <targetDir>.

Options

-v verbose - Print more status messages
-vv very verbose - Print a lot of status messages (only for debugging)
-j# jobs - Run multiple jobs in parallel. Replace # with number of desired worker processes.

Known Issues

  • There is no log output when running with multiprocessing (-j2 or above)
  • Multiprocessing is not supported for the the patch command, only for diff.
  • Only works on Windows for now

deploy

This is the script used by the developer to deploy a new update. It automatically increments the version number, creates a patch from the old to the new version, then uploads the patch and the full new version to the server.

Usage

deploy.py <oldDir> <newDir> <tempDir> <outDir> <url> <user> <password> <remotePath> [options]

Arguments

oldDir last uploaded build (current latest build on server)
newDir build to be deployed
tempDir Where to put temp files. This directory will be deleted!
outDir where to put the result files
url url of the ftp server
user username for uploading on the server
password password for ftp user
remotePath path on the ftp server to store the files

Options

-j# jobs - Run multiple jobs in parallel. Replace # with number of desired worker processes.

autoupdate

This is the script used on the client side to update the application to the newest version. It does this by downloading all available patches and installing them in the correct order.

If the application cannot be found at the given directory, the latest version is downloaded from the server and installed there.

Similarly, if the installed version is so far behind that downloading the patches would take more traffic than downloading the full application archive, the tool detects this and downloads the new version right away.

Usage

autoupdate.py <projectDir> <tempDir> <serverUrl> [options]

Arguments

projectDir Path to the application directory.
tempDir Path to a temporary working directory.
serverUrl url of the ftp server

Options

-aU:P Authentication, Username:Password, ex: -aexampleuser:examplepassword
-pPath path on the ftp server where the files are stored

bindirpatch's People

Contributors

bschug avatar krysov avatar

Watchers

Alexander Wieser avatar James Cloos avatar Friedrich Wessel avatar  avatar Marco avatar Moritz Berning avatar Robert Eckert avatar Marc Zaku avatar  avatar Friedrich Wessel avatar  avatar Sebastian Vollmar avatar  avatar Marc Trinkhaus avatar Christian Wagenfeldt avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Manuel Marhenke avatar sVx avatar  avatar Jussi Hyttinen avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.