David Walluck wrote:
Also, there are macros that should be used when refering to the JDK
so
that you pick up the default JDK used for building and not the current
default alternative (e.g., %{java_home}, %{java}, %{javac}, %{jar}).
Aha, I was not aware of these defines.
Unfortunately, there are recent packages passing the Fedora review
that
directly specify java-1.6.0-openjdk-devel as the JDK and I personally
don't like this.
I think that this comes from two schools of thought: one group wants to
tie the Fedora package even more tightly to Fedora and the other wants
to leave the options open. Since Fedora more-or-less has only one JDK
(or two counting GCJ which is optional), this benefit is mostly
theoretical, but you can see from the current discussion that it can be
useful. Similarly, since Fedora can force the default JDK setup at build
time through the build system, although the packages are technically not
as flexible as they could be, it's never really a problem in practice.
My main issue is that as a package maintainer, if I want to support
Fedora officially *and* other RPM-based distributions (through our own
yum repository) I have doubled my workload since I need to make packages
that use fedora-style dependencies for fedora, and package that use
sun-jdk-style dependencies for everyone else. Right now I depend on
"jdk" and everything works peachy everywhere, we make a .noarch.rpm and
it runs on every supported RPM platform on the planet.
Depending on java-1.6.0-openjdk-devel is the worst of the options, from
a 3rd-party-packager point of view. However, now that I know about the
fedora %{java_home} macros, perhaps a better option is to provide
fallback macros for various compatibility levels.
IE, for building my generic everyone-but-fedora packages I would have a
"sun-java-macros" set (in ~/.rpmmacros?) that would set %{java_home} to
/usr/java/jdk1.6.0_05, %{jdk} to jdk (the sun package name)
%{jdk_version} to 2000:1.6.0_05 and so on, and do:
Requires: %{jre} >= %{jre_version}
BuildRequires: %{jdk} >= %{jdk_version}
%build
JAVA_HOME=%{java_home} mvn install assembly:directory-inline
...and on fedora, it would fill those macros in to use the
openjdk-provided deps, or if someone needs something specific, they can
set %{jre} or %{jdk} to a specific package name.
It still wouldn't leave me with a universal "opennms.noarch.rpm" which
would be best, but it would simplify generating distro-specific rpms.
Not that I can't generate spec files to work with fedora with a script
or something, it just seems really lame to have to special case "fc9" vs
"!fc9" specifically. =)
--
Benjamin Reed
The OpenNMS Group
http://www.opennms.org/