JBoss Community

Single Installation Patching

new comment by Jeff Mesnil View all comments on this document

I have been working on the patch CLI command to patch an AS7 installation and add to tweak the code related to module to be able to generate a correct patch generated by diffing 2 AS7 installations.

 

When comparing modules to check whether they have been updated, computing the dir's checksum is not correct:

* Jar files generated during AS7 build can not have the same checksum since the creation date of the class files is store in the jar's zip entries.

=> this concerns AS7's own modules (org/jboss/as/...) and also jandex jars for 3rd party libraries

 

To circumvent that, instead of computing the SHA-1 of the jar files, I compute the checksum of the file's zip entries name/size/crc (ie I exclude the date metadata).

I also need to exclude some entries from the jar:

* Some java sources are generated at build time (logger and bundle classes) and embed their generation date into the code => the .class files have different size and crc

* META-INF/MANIFEST.MF and pom.properties files also contains the jar creation date => these files have different size and crc

 

When a module dir is compared, .index files (generated at runtime) should not be taken into account (they are not present in the pristine AS7 installations I used to generate the patch by diff)

 

I have a branch for this[1] which uses the same hash algo (based on the zip entries metadata) for all jars. This could likely be reduced only to jars in org/jboss/as and -jandex.jar.

With these changes, the patch code is able to compute a "suitable" checksum for module.

 

I also think the module's resource checksum should be based on the content of the module.xml. Only resources listed in the <resources> element should be included in the checksum. Eg adding a README to a module should not change its checksum. This means a 2-step check:

1. check that the module.xml are identical (with a file checksum)

2. check that the resources listed by the module are "equivalent" (with jar-specific checksum for jar + file checksum for other resources)

 

What do you think?

 

[1] https://github.com/jmesnil/jboss-as/compare/emuckenhuber:patches-master...patches_module_checksum