This documents will introduce update-hash to update MD5 checksum. There will be an applied example of Helloworld software release after the introduction.
In order to update the MD5 checksum, it involves 2 relevant files: update-hash and buildout.hash.cfg. The following introduction can also be found in SlapOS repository or in your Theia project:
update-hash is a tool to assist software release developers in the management of buildout.hash.cfg files.
A lot of recipes which uses hashing for referenced files. Updating the hash results in part uninstallation and installation, which is desired behaviour, as the file might have to be redownloaded. By using update-hash with buildout.hash.cfg the developer does not have to do the calculations and updates manually, just calling the tool is enough.
Generally each Buildout profile which references some file shall use this approach to improve development process and minimise risk of using incorrect data from such entires.
buildout.hash.cfg files are buildout-style simplified configparser files to have a easy way to update MD5 hashes of provided files for download. They look like:
md5sum = <hash>
filename = <relative-path>
Where <hash> is an automatically calculated checksum of <relative-path>.
Then buildout.hash.cfg can be included in software profile by extends of [buildout] section, and the section's md5sum and filename can be used.
In case if section recipe has special unwanted behaviour for filename field the _update_hash_filename_ key can be used like:
md5sum = <hash>
_update_hash_filename_ = <relative-path>
In order to update the buildout.hash.cfg one just need to call update-hash while being in the directory containing the file.
In this project, update-hash is located in /srv/slapgrid/slappart49/srv/project/slapos/update-hash, you will have a similar path.
In this helloworld software, buildout.hash.cfg is located in /srv/slapgrid/slappart49/srv/project/slapos/software/helloworld/buildout.hash.cfg. There is one md5sum of one section needed to be updated:
To demonstrate how to call update-hash, we can remove the hash value in buildout.hash.cfg temporarily.
Since we are about to update the hash for helloworld software release, and buildout.hash.cfg is located directly under ~/software/helloworld directory, we are expected to go to the directory, just be asides buildout.hash.cfg:
Open a terminal by hit Ctrl + Shift + ` , and go to helloworld directory:
As we have known the location of update-hash script, which is located just under slapos/ and at the same directory as software/, we can call the script by:
As long as you hit the return for this command, you will immediately have your md5sum in buildout.hash.cfg: