docs / using / delta-packages.md |
---|
Now, once we've got a full package, we need to generate a Delta package. To do this, we'll replace all the DLL/EXEs in the NuGet packages with bsdiff files. bspatch/bsdiff is a mostly efficient algorithm for calculating diffs between binary files (especially Native binaries, but it works well for .NET ones too), and a way to apply them.
So, this is pretty easy:
- Extract the previous NuGet package
- Extract the current NuGet package
- Replace every EXE/DLL with the bsdiff. So,
lib\net40\MyCoolApp.exe
becomeslib\net40\MyCoolApp.exe.diff
. Create a file that contains a SHA1 of the expected resulting file and its filesize calledlib\net40\MyCoolApp.exe.shasum
- New DLLs in current get put in verbatim
- Zip it back up
The .shasum file has the same format as the Releases file described in the "'Latest' Pointer" section, except that it will only have one entry.
So now we've got all of the metadata of the original package, just none of its contents. To get the final package, we do the following:
- Take the previous version, expand it out
- Take the delta version, do the same
- For each DLL in the previous package, we bspatch it, then check the shasum file to ensure we created the correct resulting file
- If we find a DLL in the new package, just copy it over
- If we can't find a bspatch for a file, nuke it (it doesn't exist in the new rev)
- Zip it back up
Return: Table of Contents |
---|