Commit 8b275ea4 authored by akrherz's avatar akrherz

OF-1111 Rethink RPM build and versioning

Ant RPM build configuration is modified such that:

 - rpmbuild arch of x86_64 is now default.  This will require a
   change to the Ignite's Bamboo to specify a 64bit JRE to bundle
 - the rpmbuild arch logic is simplified and one can now specify
   which arch to build for by setting `-Drpmbuild.arch=<arch>`
 - the resulting RPM filenames are changed, such to allow upgrades
   between alpha builds, beta/rc builds and GA builds without
   having to `rpm --force` these.  See note below on the new
   RPM filenames.
 - the changelog field in the RPM will contain the hash of the
   last commit in the local repository `git rev-parse --short HEAD`
 - A new `git.revision` Ant target is introduced so support the
   inclusion of this in the build metadata

New RPM filenames:
    For General Releases we get x.y.z-1
    For Alpha builds we get     x.y.z-0.1.{YYYYMMDD}alpha
    For Beta/RC builds we get   x.y.z-0.2.(beta|rc)
parent ca122761
...@@ -256,6 +256,26 @@ ...@@ -256,6 +256,26 @@
<!-- TARGETs --> <!-- TARGETs -->
<!-- ======================================================================================= --> <!-- ======================================================================================= -->
<!-- git.revision =========================================================
http://stackoverflow.com/questions/2974106
-->
<available file=".git" type="dir" property="git.present"/>
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<echo message="repository.version set to '${repository.version}'" />
</target>
<!-- init ================================================================================== --> <!-- init ================================================================================== -->
<target name="init"> <target name="init">
...@@ -1171,61 +1191,88 @@ ...@@ -1171,61 +1191,88 @@
</target> </target>
<!-- installer.rpm ========================================================================= --> <!-- installer.rpm ========================================================
Build RPM artifiacts, set rpmbuild.arch to build non-x64, for example:
$ ant installer.rpm -Drpmbuild.arch=noarch
$ ant installer.rpm -Drpmbuild.arch=i686
-->
<property name="bundle.jre" value="true" /> <property name="bundle.jre" value="true" />
<property name="target.work.subdir" value="rpm" /> <property name="target.work.subdir" value="rpm" />
<property name="target.rpm" value="${work.dir}/${target.work.subdir}" /> <property name="target.rpm" value="${work.dir}/${target.work.subdir}" />
<property name="rpm.spec.file" value="${basedir}/build/rpm/openfire.spec"/> <property name="rpm.spec.file" value="${basedir}/build/rpm/openfire.spec"/>
<property name="rpmbuild.arch" value="x86_64" />
<tstamp> <tstamp>
<format property="rpm.builddate" pattern="EEE MMM dd yyyy" locale="en"/> <format property="rpm.builddate" pattern="EEE MMM dd yyyy" locale="en"/>
</tstamp> </tstamp>
<target name="installer.rpm" depends="init, dist.init" description="Builds a rpm of openfire."> <tstamp>
<format property="rpm.builddate2" pattern="yyyyMMdd" locale="en"/>
</tstamp>
<target name="installer.rpm" depends="init, dist.init, git.revision"
description="Builds a rpm of openfire.">
<antcall target="dist.src"/> <antcall target="dist.src"/>
<!-- create empty dirs to allow rpmbuild to do its thing -->
<mkdir dir="${target.rpm}/SPECS" /> <mkdir dir="${target.rpm}/SPECS" />
<mkdir dir="${target.rpm}/SOURCES" /> <mkdir dir="${target.rpm}/SOURCES" />
<mkdir dir="${target.rpm}/BUILD" /> <mkdir dir="${target.rpm}/BUILD" />
<mkdir dir="${target.rpm}/SRPMS" /> <mkdir dir="${target.rpm}/SRPMS" />
<mkdir dir="${target.rpm}/RPMS" /> <mkdir dir="${target.rpm}/RPMS" />
<!-- Setup the RPM versioning correctly, so one can update from
a alpha,beta,rc build to GA
For General Releases we get x.y.z-1
For Alpha builds we get x.y.z-0.1.{YYYYMMDD}alpha
For Beta/RC builds we get x.y.z-0.2.(beta|rc)
-->
<property name="rpmbuild.version"
value="${version.major}.${version.minor}.${version.revision}"/>
<if>
<equals arg1="${version.extra}" arg2=""/>
<then>
<property name="rpmbuild.release"
value="1"/>
</then>
<elseif>
<equals arg1="${version.extra}" arg2="alpha"/>
<then>
<property name="rpmbuild.release"
value="0.1.${rpm.builddate2}${version.extra}"/>
</then>
</elseif>
<else>
<property name="rpmbuild.release"
value="0.2.${version.extra}"/>
</else>
</if>
<copy tofile="${target.rpm}/SPECS/openfire.spec" file="${rpm.spec.file}" /> <copy tofile="${target.rpm}/SPECS/openfire.spec" file="${rpm.spec.file}" />
<!-- Save the user from themself, if noarch is the target arch, ignore
copying the JRE as well -->
<if> <if>
<and>
<equals arg1="${bundle.jre}" arg2="true"/> <equals arg1="${bundle.jre}" arg2="true"/>
<not>
<equals arg1="${rpmbuild.arch}" arg2="noarch" />
</not>
</and>
<then> <then>
<!-- Include bundled jre --> <!-- Include bundled jre -->
<copy todir="${target.rpm}/SOURCES" file="${jre.bundle.location}" /> <copy todir="${target.rpm}/SOURCES" file="${jre.bundle.location}" />
</then> </then>
</if> </if>
<copy todir="${target.rpm}/SOURCES" file="${release.dest.dir}/${release.fullname.src}.tar.gz" /> <copy todir="${target.rpm}/SOURCES/" file="${release.dest.dir}/${release.fullname.src}.tar.gz" />
<if>
<equals arg1="${bundle.jre}" arg2="true"/>
<then>
<rpm specFile="openfire.spec"
topDir="${target.rpm}"
command="-ba --target i386 --define 'JRE_BUNDLE ${jre.bundle.location}' --define 'OPENFIRE_VERSION ${version}' --define 'OPENFIRE_SOURCE ${release.fullname.src}.tar.gz' --define 'OPENFIRE_BUILDDATE ${rpm.builddate}'"
failOnError="true"
/>
<copy todir="${release.dest.dir}" >
<fileset dir="${target.rpm}/SRPMS" />
<fileset dir="${target.rpm}/RPMS/i386" />
</copy>
</then>
<else>
<rpm specFile="openfire.spec" <rpm specFile="openfire.spec"
topDir="${target.rpm}" topDir="${target.rpm}"
command="-ba --target noarch --define 'OPENFIRE_VERSION ${version}' --define 'OPENFIRE_SOURCE ${release.fullname.src}.tar.gz' --define 'OPENFIRE_BUILDDATE ${rpm.builddate}'" command="-ba --target ${rpmbuild.arch} --define 'JRE_BUNDLE ${jre.bundle.location}' --define 'OPENFIRE_VERSION ${rpmbuild.version}' --define 'OPENFIRE_RELEASE ${rpmbuild.release}' --define 'OPENFIRE_SOURCE ${release.fullname.src}.tar.gz' --define 'OPENFIRE_REPOVERSION ${repository.version}' --define 'OPENFIRE_BUILDDATE ${rpm.builddate}'"
failOnError="true" failOnError="true"
/> />
<!-- copy the rpmbuild result into the release directory! -->
<copy todir="${release.dest.dir}" > <copy todir="${release.dest.dir}" >
<fileset dir="${target.rpm}/SRPMS" /> <fileset dir="${target.rpm}/SRPMS" />
<fileset dir="${target.rpm}/RPMS/noarch" /> <fileset dir="${target.rpm}/RPMS/${rpmbuild.arch}" />
</copy> </copy>
</else>
</if>
</target> </target>
<!-- plugins =============================================================================== --> <!-- plugins =============================================================================== -->
......
Summary: Openfire XMPP Server Summary: Openfire XMPP Server
Name: openfire Name: openfire
Version: %{OPENFIRE_VERSION} Version: %{OPENFIRE_VERSION}
Release: 1 Release: %{OPENFIRE_RELEASE}
BuildRoot: %{_builddir}/%{name}-root BuildRoot: %{_builddir}/%{name}-root
Source0: %{OPENFIRE_SOURCE} Source0: %{OPENFIRE_SOURCE}
%ifnarch noarch %ifnarch noarch
Source1: %{JRE_BUNDLE} Source1: %{JRE_BUNDLE}
%endif %endif
Group: Applications/Communications Group: Applications/Communications
Vendor: Jive Software Vendor: Igniterealtime Community
Packager: Jive Software Packager: Igniterealtime Community
License: Apache license v2.0 License: Apache license v2.0
AutoReqProv: no AutoReqProv: no
URL: http://www.igniterealtime.org/ URL: http://www.igniterealtime.org/
...@@ -25,8 +25,6 @@ Openfire is a leading Open Source, cross-platform IM server based on the ...@@ -25,8 +25,6 @@ Openfire is a leading Open Source, cross-platform IM server based on the
XMPP (Jabber) protocol. It has great performance, is easy to setup and use, XMPP (Jabber) protocol. It has great performance, is easy to setup and use,
and delivers an innovative feature set. and delivers an innovative feature set.
This particular release includes a bundled JRE.
%prep %prep
%setup -q -n openfire_src %setup -q -n openfire_src
...@@ -152,5 +150,5 @@ exit 0 ...@@ -152,5 +150,5 @@ exit 0
%endif %endif
%changelog %changelog
* %{OPENFIRE_BUILDDATE} Jive Software <webmaster@jivesoftware.com> %{OPENFIRE_VERSION}-1 * %{OPENFIRE_BUILDDATE} Igniterealtime Community <webmaster@igniterealtime.org> %{OPENFIRE_VERSION}-%{OPENFIRE_RELEASE}
- Automatic RPM build. - Automated RPM build with git rev-parse --short HEAD of %{OPENFIRE_REPOVERSION}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment