XOSPDelta is a delta update method for XOSP. Instead of downloading full ROM zips, it uses deltas to reduce the download size.
XOSPDelta uses xdelta3 (http://xdelta.org) between the previous and current release. Quote from github.com/omnirom/android_packages_apps_OpenDelta/blob/android-6.0/README.md :
"Usually, OTA ZIP files created by Android builds are compressed.Diffs between compressed OTA ZIPs are not ideal - they are significantly larger than the diff between two uncompressed OTA ZIPs would be. So before we create the diff we decompress the contents of the OTA ZIPs." XOSPDelta uses Chainfire's and OmniROM's zipadjust to decompress the zips.
The delta is generated by running xdelta3 on the decompressed zip of the newest, but as yet unreleased ROM, using the decompressed zip of the newest released ROM. The resultant delta is named "diff". All decompressions are done using Chainfire's zipadjust.
After that, certain information about the base ROM, the target ROM, and the generated delta is written as JSON in a file called "deltaconfig". A sample deltaconfig is below.
The diff and deltaconfig files are then put into a zip archive without compression, and uploaded to a server. The user downloads it, gives the base ROM and the delta zip to XOSPDelta, and gets the updated ROM.
TO-DO : Automatically fetch the delta and apply it to the correct ROM.
There is a script to generate the deltas on the build machine. Get server/xospdelta.sh, and set the variables to reflect your build environment. Run it with the name of the device as a parameter and upload the zip in publish/DEVICE_NAME The zip will have the same name as the second newest (the base ROM) build, to make it easier for the client to find it.
To create the delta files on the server, you need several things, some of which can be found in the server directory.
The main thing is the xospdelta.sh script. It contains a configuration section which you can edit with the correct file locations on your own system. Quite likely you will need to create a wrapper script that pulls in your previous release and your current release, and pushes out the created delta files.The script depends on xdelta3, zip,and zipadjust. To build the binaries for use on your server, make a copy of the jni directory - do not compile inside jni because you may mess up the build of libopendelta.
xdelta3 can be built in (the copy of)jni/xdelta3-3.0.7 by calling:
zipadjust can be built in (the copy of)jni by calling:
gcc -o zipadjust zipadjust.c zipadjust_run.c -lz
dedelta (not used by the script, but maybe helpful when debugging) can be built in (the copy of)jni by calling:
gcc -o dedelta xdelta3-3.0.7/xdelta3.c delta.c delta_run.c
You should be able to install zip from your distro's repositories.
Used libraries and assets
(1) Android Support v4 - Google
(2) Android Cardview - Google
(3) Android-MaterialRefreshLayout - android-cjj
(4) Apache Commons IO - Apache
(5) AppIntro - PaoloRotolo
(6) AVLoadingIndicatorView - Jack Wang
(7) libopendelta - Chainfire (https://github.com/omnirom/android_packages_apps_OpenDelta/blob/android-6.0/jni/delta_run.c)
(8) libsuperuser - Chainfire
(9) Moshi - Square, Inc.
(10) Nineoldandroids (used by AVLoadingIndicatorView) - Jake Wharton
(11) NumberProgressbar - daimajia
(12) SlideExpandableListView - tjerkw