Random Linux Garble.

Remove Unwanted Commpression in During Rpmbuild for .jar Files

I was building an rpm for today, and ran into a little issue when packing jar files. After building the .jar file, and packaging it in the rpm, I noticed (actually someone else noticed…) that the .jar files were about half the size when extracted from the rpm, compared to in the sources dir after build.

This seems to be information that is kept in the dark corner of the internet, so after finding the answer, figure I would shine one more light on it.

rpm runs a series of repack commands at the end of rpmbuild, one being “brp-java-repack-jars”

/usr/lib/rpm/redhat/brp-strip /usr/bin/strip  
/usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip  
/usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump  

These final commands cause the jars to turn out a different size due to compression, which may cause someone who is not familiar with this function to question the integrity of the package. This was the case for me, and the person for whom I was building the package wanted to see the same jar file that they were building in development.

This is one of those dark corners of the internet, that not too much information exists about, at least not easy to find information. Being a professional googler, eventually I found a solution deep in the RHN.

%define _\_os\_install_post %{nil}

Add the above to the spec file, and bam! no more unwanted commpression. Doesn’t seem like it would, from the look of that line, but it does.