Friday, February 9, 2007

RPM, Java and frustration

First in the past 6 months for whatever reason I ditched my windows box and completely living my life on Fedora. There have been some painful moments, but overall experience has been good. After getting into the groove of things I can develop, work and play as always. Open Office is good I just crave for it do more and do it faster. Marcf (blog) has a differnt opinion, and I hear you Marc, it just takes a commitment and ability to forget some of the key strokes engrained in your brain by years of using a single OS (one step back, then two steps forward). So I am now one of the converted, not yet religous, but converted.

Great, and I should probably talk more about my experiences in the conversion, but today it's about RPMs. Not using RPMs, installation of RPMs are GREAT, SIMPLE, QUICK. I have been using yumex and life is pretty good.

As a java developer RPMs feel wrong and more specifically rpmbuild is annoying. And if you suggest jpackage, DON'T. I believe in well defined and slim containers with application isolation. I believe in 'rpm -i' and RUN. I believe that an application should have one requirement - the JVM. I am confused by the desire of jpackage to have all my libraries referenced, leading to DLL hell. I am confused by rpmbuild as a driver for my build system as opposed to a tool for building an RPM. I am confused that the LSB model is pushed all the way up to the application level.

I like the RPM model and in this case would really like to see two things (1) a solid ant integration with RPMs so I could skip 'rpmbuild', 'spec files', 'faking rpm dir structure', ... and (2) RPMs for applications rather than core OS. Maybe something for me to tackle.

So... what did i do/hack for blue...
1. I build my rpm information within ant task
first creating RPM directory structure
second load spec file in rpm/SPECS
third layout files into my 'buildroot' which will be rpm/INSTALL

<mkdir dir="${build}/rpm/RPMS" />
<mkdir dir="${build}/rpm/SPECS" />
<mkdir dir="${build}/rpm/SOURCES" />
<mkdir dir="${build}/rpm/BUILD" />
<mkdir dir="${build}/rpm/SRPMS" />
<mkdir dir="${build}/rpm/INSTALL" />

<copy todir="${build}/rpm/SPECS" file="blue-plugins.spec" />
<copy todir="${build}/rpm/INSTALL/usr/lib/nagios/plugins/" >
<fileset dir="${dist-plugins}" />
</copy>


2. call rpm ant task

<rpm specfile="blue-plugins.spec" topdir="${build}/rpm" command="--bb --buildroot=${build}/rpm/INSTALL" />


3. the simple spec file!

Summary: Blue Java Plugins, Blue is a port of Nagios to Java
Name: blue-plugins
Version: 0.8
Release: 1
License: GPL
Group: Applications/System
URL: http://blue.sourceforge.net/
Vendor: Blue
Packager: Richard Friedman
Prefix: %{_prefix}/lib/nagios/plugins
BuildArchitectures: noarch

%description
bla bla bla

%prep

%build

%install

%files
/usr/lib/nagios/plugins/

3 comments:

Ari said...

How does your spec file work without a Source: entry?

Richard Friedman said...

Check out the build file, http://blue.cvs.sourceforge.net/blue/blue/build.xml?view=markup. In there I build out the src tar file, I believe. It's been a long time since i touched this.

Hanumant said...

Thanks for the steps. They proved helpful to me in figuring out the whole process, which I have documented at http://javaworkshop.wordpress.com