Oracles broken Java rpms

Oracles broken Java RPMs

Oracles Java rpms have 2 (or more) problems:

- Version string is in rpm's "Name". That means every software management tool will not recognize that a new rpm is a update. So even if you create a personal repository where you put the downloaded RPMs, you will not get a notification, that there is a Java update. So you end with parallel Installations of many Java versions and you usually won't have a outdated version

- Oracle uses /usr/sbin/alternatives which is not portable. Better use /usr/sbin/update-alternatives

The fix:

To fix it, use rpmrebuild (at time of writing Version 2.11) and rebuild the downloaded RPMs (for your personal use!):

rpmrebuild --change-spec-whole='sed -re "s/^Name: *(j..)([0-9]+.[0-9]+).*/Name: \1-\2/;s/^Version:(.*)_(.*)/Version:\1.\2/;s/^Epoch(.*)/# Epoch\1/;s#sbin/alternatives#sbin/update-alternatives#g"'  -p  jdk-8u77-linux-x64.rpm

The rebuilt package can be found in ~/rpmbuild/RPMS and you can put it in your repo.

Compare Original:

Name : jdk1.8.0_77
Epoch : 2000
Version : 1.8.0_77

and rebuilt:

Name : jdk-1.8
Version :

Created by redflo. Last Modification: Friday 01 of April, 2016 14:57:51 UTC by redflo.

Flattr me!