%global namedreltag .Final
%global namedversion %{version}%{?namedreltag}
# Build tasks
# -----------
# assemble - Assembles all Jar, War, Zip, and Tar archives. (DON'T work)
# build - Assembles and tests this project.
# buildDependents - Assembles and tests this project and all projects that depend on it.
# buildNeeded - Assembles and tests this project and all projects it depends on.
# classes - Assembles the main classes.
# clean - Deletes the build directory.
# jar - Assembles a jar archive containing the main classes.
# testClasses - Assembles the test classes.
#
# Documentation tasks
# -------------------
# javadoc - Generates Javadoc API documentation for the main source code.
#
# Help tasks
# ----------
# dependencies - Displays the dependencies of root project 'hibernate-release-4.1.5.SP1'.
# help - Displays a help message
# projects - Displays the sub-projects of root project 'hibernate-release-4.1.5.SP1'.
# properties - Displays the properties of root project 'hibernate-release-4.1.5.SP1'.
# tasks - Displays the tasks runnable from root project 'hibernate-release-4.1.5.SP1' (some of the displayed tasks may belong to subprojects).
#
# IDE tasks
# ---------
# cleanEclipse - Cleans all Eclipse files.
# cleanIdea - Cleans IDEA project files (IML, IPR)
# eclipse - Generates all Eclipse files.
# idea - Generates IDEA project files (IML, IPR, IWS)
#
# Upload tasks
# ------------
# uploadArchives - Uploads all artifacts belonging to configuration ':hibernate-c3p0:archives'.
#
# Verification tasks
# ------------------
# check - Runs all checks.
# matrix - Runs the unit tests on Database Matrix
# test - Runs the unit tests.
# Other tasks
# -----------
# buildReleaseBundles - Build release bundle in all formats
# cleanIdeaWorkspace
# wrapper
Name: hibernate
Version: 4.1.6
Release: 1%{?dist}
Summary: Relational persistence and query service
Group: Development/Libraries
License: LGPLv2+
URL: http://www.hibernate.org/
Source0: http://sourceforge.net/projects/hibernate/files/hibernate4/%{namedversion}/hibernate-release-%{namedversion}.tgz
# TODO remove these poms when gradle maven plugin work properly
Source1: http://repo1.maven.org/maven2/org/hibernate/hibernate-c3p0/%{namedversion}/hibernate-c3p0-%{namedversion}.pom
Source2: http://repo1.maven.org/maven2/org/hibernate/hibernate-core/%{namedversion}/hibernate-core-%{namedversion}.pom
Source3: http://repo1.maven.org/maven2/org/hibernate/hibernate-ehcache/%{namedversion}/hibernate-ehcache-%{namedversion}.pom
Source4: http://repo1.maven.org/maven2/org/hibernate/hibernate-entitymanager/%{namedversion}/hibernate-entitymanager-%{namedversion}.pom
Source5: http://repo1.maven.org/maven2/org/hibernate/hibernate-envers/%{namedversion}/hibernate-envers-%{namedversion}.pom
Source6: http://repo1.maven.org/maven2/org/hibernate/hibernate-infinispan/%{namedversion}/hibernate-infinispan-%{namedversion}.pom
Source7: http://repo1.maven.org/maven2/org/hibernate/hibernate-proxool/%{namedversion}/hibernate-proxool-%{namedversion}.pom
Source8: http://repo1.maven.org/maven2/org/hibernate/hibernate-testing/%{namedversion}/hibernate-testing-%{namedversion}.pom
Patch0: hibernate-4.1.6.Final-build.patch
# require infinispan-core:5.1.4.FINAL:tests@jar
Patch1: hibernate-4.1.6.Final-remove-infinispan-core-tests.patch
Patch2: hibernate-4.1.6.Final-fix-incorrect-fsf-address.patch
BuildRequires: java-devel
BuildRequires: jpackage-utils
BuildRequires: ant
BuildRequires: antlr
BuildRequires: bean-validation-api
BuildRequires: byteman
BuildRequires: c3p0
BuildRequires: classmate
BuildRequires: dom4j
BuildRequires: ehcache-core
BuildRequires: h2
BuildRequires: hibernate-commons-annotations
BuildRequires: hibernate-jpa-2.0-api
BuildRequires: hibernate-jpamodelgen
# BuildRequires: hibernate-tools https://bugzilla.redhat.com/show_bug.cgi?id=826701
BuildRequires: infinispan
BuildRequires: jandex
BuildRequires: javassist
BuildRequires: jboss-common-core
BuildRequires: jboss-jacc-1.4-api
# jboss-jts 4.16.4.Final
BuildRequires: jboss-jts
BuildRequires: jboss-logging
BuildRequires: jboss-logging-tools
BuildRequires: jboss-naming
BuildRequires: jboss-transaction-1.1-api
BuildRequires: junit
BuildRequires: log4j
BuildRequires: mchange-commons
BuildRequires: mockito
BuildRequires: proxool
BuildRequires: rhq-plugin-annotations
BuildRequires: slf4j
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=845540
BuildRequires: xapool
# build tools and deps
BuildRequires: apache-commons-beanutils
BuildRequires: apache-commons-lang
BuildRequires: apache-commons-logging
BuildRequires: codemodel
BuildRequires: glassfish-jaxb
BuildRequires: glassfish-jaxb-api
# TODO require gradle 1.1
BuildRequires: gradle
BuildRequires: istack-commons
BuildRequires: jaxb2-common-basics
BuildRequires: rngom
BuildRequires: txw2
BuildRequires: xsom
Requires: java
Requires: jpackage-utils
BuildArch: noarch
%description
Hibernate is a powerful, ultra-high performance
object/relational persistence and query service
for Java. Hibernate lets you develop persistent
objects following common Java idiom - including
association, inheritance, polymorphism, composition
and the Java collections framework. Extremely
fine-grained, richly typed object models are
possible. The Hibernate Query Language, designed
as a "minimal" object-oriented extension to SQL,
provides an elegant bridge between the object and
relational worlds. Hibernate is now the most
popular ORM solution for Java.
%package c3p0
Group: Development/Libraries
Summary: Hibernate C3P0 ConnectionProvider
Requires: c3p0
Requires: jboss-logging
Requires: %{name}-core = %{version}-%{release}
%description c3p0
C3P0-based implementation of the Hibernate ConnectionProvder contract.
%package core
Group: Development/Libraries
Summary: Hibernate Core
Requires: antlr
Requires: bean-validation-api
Requires: dom4j
Requires: hibernate-commons-annotations
Requires: hibernate-jpa-2.0-api
Requires: hibernate-validator
Requires: jboss-jacc-1.4-api
Requires: jboss-transaction-1.1-api
Requires: jboss-logging
Requires: %{name} = %{version}-%{release}
%description core
The core functionality of Hibernate.
%package ehcache
Group: Development/Libraries
Summary: Hibernate Ehcache Integration
Requires: ehcache-core
Requires: jboss-logging
Requires: %{name}-core = %{version}-%{release}
%description ehcache
Integration of Hibernate with Ehcache.
%package entitymanager
Group: Development/Libraries
Summary: Hibernate Entity Manager
Requires: dom4j
Requires: hibernate-commons-annotations
Requires: hibernate-jpa-2.0-api
Requires: javassist
Requires: jboss-logging
Requires: jboss-transaction-1.1-api
Requires: %{name}-core = %{version}-%{release}
%description entitymanager
Hibernate Entity Manager.
%package envers
Group: Development/Libraries
Summary: Hibernate Envers
# Requires: hibernate-tools
Requires: jboss-logging
Requires: %{name}-core = %{version}-%{release}
Requires: %{name}-entitymanager = %{version}-%{release}
%description envers
Support for entity auditing.
%package infinispan
Group: Development/Libraries
Summary: Hibernate Infinispan Integration
Requires: infinispan
Requires: jboss-logging
Requires: rhq-plugin-annotations
Requires: %{name}-core = %{version}-%{release}
Requires: %{name}-testing = %{version}-%{release}
%description infinispan
Integration of Hibernate with Infinispan.
%package proxool
Group: Development/Libraries
Summary: Hibernate Proxool ConnectionProvider
Requires: jboss-logging
Requires: proxool
Requires: %{name}-core = %{version}-%{release}
%description proxool
Proxool-based implementation of the Hibernate ConnectionProvder contract.
%package testing
Group: Development/Libraries
Summary: Hibernate Testing
Requires: byteman
# jboss-jts 4.16.4.Final
Requires: jboss-jts
Requires: junit
Requires: xapool
Requires: %{name}-core = %{version}-%{release}
%description testing
Hibernate JUnit test utilities.
%package javadoc
Group: Documentation
Summary: Javadoc for %{name}
Requires: jpackage-utils
%description javadoc
This package contains javadoc for %{name}.
%prep
%setup -q -n hibernate-release-%{namedversion}
find . -name "*.jar" -delete
find . -name "*.class" -delete
rm -r documentation/*
mv -f project/* .
%patch0 -p1
%patch1 -p1
%patch2 -p0
# FIXME
cp -p %{SOURCE6} .
# infinispan
sed -i "s|5.1.4.FINAL|5.1.2.FINAL|" hibernate-infinispan-%{namedversion}.pom
cp -p %{SOURCE8} .
# jboss-jts
sed -i "s|4.16.4.Final|4.16.2.Final|" hibernate-testing-%{namedversion}.pom
# fix non ASCII chars
for s in hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java\
hibernate-core/src/main/java/org/hibernate/annotations/SQLUpdate.java\
hibernate-core/src/main/java/org/hibernate/annotations/NamedQueries.java\
hibernate-core/src/main/java/org/hibernate/annotations/NaturalId.java\
hibernate-core/src/main/java/org/hibernate/annotations/ResultCheckStyle.java\
hibernate-core/src/main/java/org/hibernate/annotations/SQLDeleteAll.java\
hibernate-core/src/main/java/org/hibernate/annotations/SQLDelete.java\
hibernate-core/src/main/java/org/hibernate/annotations/Loader.java\
hibernate-core/src/main/java/org/hibernate/annotations/SQLInsert.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/BaseEnversEventListener.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/EnversPreCollectionUpdateEventListenerImpl.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/EnversPostDeleteEventListenerImpl.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/BaseEnversCollectionEventListener.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/EnversPostUpdateEventListenerImpl.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/EnversPreCollectionRemoveEventListenerImpl.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/EnversPostInsertEventListenerImpl.java\
hibernate-envers/src/main/java/org/hibernate/envers/event/EnversPostCollectionRecreateEventListenerImpl.java\
hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java\
hibernate-envers/src/main/java/org/hibernate/envers/entities/EntityConfiguration.java\
hibernate-envers/src/main/java/org/hibernate/envers/entities/mapper/relation/OneToOneNotOwningMapper.java\
hibernate-envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java\
hibernate-envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java\
hibernate-envers/src/main/java/org/hibernate/envers/query/AuditQueryCreator.java\
hibernate-envers/src/main/java/org/hibernate/envers/query/impl/AbstractAuditQuery.java\
hibernate-envers/src/main/java/org/hibernate/envers/query/impl/RevisionsOfEntityQuery.java\
hibernate-envers/src/main/java/org/hibernate/envers/query/impl/EntitiesAtRevisionQuery.java\
hibernate-envers/src/main/java/org/hibernate/envers/tools/Tools.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/TypeOverrides.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/AddressAdapterImpl.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/EvictAllCommand.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandInitializer.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandFactory.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/AddressAdapter.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/FlagAdapter.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapter.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandIds.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapterImpl.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheHelper.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandExtensions.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/EntityRegionImpl.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/ReadOnlyAccess.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/TransactionalAccess.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseTransactionalDataRegion.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseGeneralDataRegion.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/CollectionRegionImpl.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/CollectionRegionImpl.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/TransactionalAccess.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/TimestampsRegionImpl.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/TimestampTypeOverrides.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/PutFromLoadValidator.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TransactionalAccessDelegate.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/query/QueryResultsRegionImpl.java\
hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/tm/HibernateTransactionManagerLookup.java\
hibernate-proxool/src/main/java/org/hibernate/service/jdbc/connections/internal/ProxoolConnectionProvider.java;do
native2ascii -encoding UTF8 ${s} ${s}
done
# disable hibernate-tools support
rm -r hibernate-envers/src/main/java/org/hibernate/tool/ant/*.java \
hibernate-envers/src/main/java/org/hibernate/envers/ant/*.java
sed -i "s|provided( |//provided(|" hibernate-envers/hibernate-envers.gradle
# these test fails also for unavailable test deps
rm -r hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/StatementCacheTest.java
rm -r hibernate-core/src/test/java/org \
hibernate-ehcache/src/test/java/org \
hibernate-entitymanager/src/test/java/org \
hibernate-infinispan/src/test/java/org
%build
unset JAVA_HOME
export JAVA_HOME=%{_jvmdir}/java
export GRADLE_USER_HOME=$PWD SKIP_UNIT_TEST=true
mkdir -p gradlehome
# build buildSrc.jar
gradle --debug jar javadoc -g $PWD/gradlehome -b $PWD/buildSrc/build.gradle
# use buildReleaseBundles for aggregate javadoc
gradle --debug build buildReleaseBundles -g $PWD/gradlehome -b $PWD/build.gradle
%install
mkdir -p %{buildroot}%{_javadir}/%{name}
for module in c3p0 core ehcache entitymanager envers infinispan proxool testing; do
install -m 644 hibernate-${module}/target/libs/hibernate-${module}-%{namedversion}.jar %{buildroot}%{_javadir}/%{name}/hibernate-${module}.jar
done
mkdir -p %{buildroot}%{_mavenpomdir}
# TODO use the poms files generated by gradle maven plugin
install -pm 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-c3p0.pom
%add_maven_depmap JPP.%{name}-hibernate-c3p0.pom %{name}/hibernate-c3p0.jar -f c3p0
install -pm 644 %{SOURCE2} %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-core.pom
%add_maven_depmap JPP.%{name}-hibernate-core.pom %{name}/hibernate-core.jar
install -pm 644 %{SOURCE3} %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-ehcache.pom
%add_maven_depmap JPP.%{name}-hibernate-ehcache.pom %{name}/hibernate-ehcache.jar -f ehcache
install -pm 644 %{SOURCE4} %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-entitymanager.pom
%add_maven_depmap JPP.%{name}-hibernate-entitymanager.pom %{name}/hibernate-entitymanager.jar -f entitymanager
install -pm 644 %{SOURCE5} %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-envers.pom
%add_maven_depmap JPP.%{name}-hibernate-envers.pom %{name}/hibernate-envers.jar -f envers
install -pm 644 hibernate-infinispan-%{namedversion}.pom %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-infinispan.pom
%add_maven_depmap JPP.%{name}-hibernate-infinispan.pom %{name}/hibernate-infinispan.jar -f infinispan
install -pm 644 %{SOURCE7} %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-proxool.pom
%add_maven_depmap JPP.%{name}-hibernate-proxool.pom %{name}/hibernate-proxool.jar -f proxool
install -pm 644 hibernate-testing-%{namedversion}.pom %{buildroot}%{_mavenpomdir}/JPP.%{name}-hibernate-testing.pom
%add_maven_depmap JPP.%{name}-hibernate-testing.pom %{name}/hibernate-testing.jar -f testing
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -rp release/target/documentation/javadocs/* %{buildroot}%{_javadocdir}/%{name}
%files
%dir %{_javadir}/%{name}
%{_javadir}/%{name}/hibernate-core.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-core.pom
%{_mavendepmapfragdir}/%{name}
%doc changelog.txt lgpl.txt README.md
%files javadoc
%{_javadocdir}/%{name}
%doc lgpl.txt
%files c3p0
%{_javadir}/%{name}/hibernate-c3p0.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-c3p0.pom
%{_mavendepmapfragdir}/%{name}-c3p0
%doc lgpl.txt
%files ehcache
%{_javadir}/%{name}/hibernate-ehcache.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-ehcache.pom
%{_mavendepmapfragdir}/%{name}-ehcache
%doc lgpl.txt
%files entitymanager
%{_javadir}/%{name}/hibernate-entitymanager.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-entitymanager.pom
%{_mavendepmapfragdir}/%{name}-entitymanager
%doc lgpl.txt
%files envers
%{_javadir}/%{name}/hibernate-envers.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-envers.pom
%{_mavendepmapfragdir}/%{name}-envers
%doc lgpl.txt
%files infinispan
%{_javadir}/%{name}/hibernate-infinispan.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-infinispan.pom
%{_mavendepmapfragdir}/%{name}-infinispan
%doc lgpl.txt
%files proxool
%{_javadir}/%{name}/hibernate-proxool.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-proxool.pom
%{_mavendepmapfragdir}/%{name}-proxool
%doc lgpl.txt
%files testing
%{_javadir}/%{name}/hibernate-testing.jar
%{_mavenpomdir}/JPP.%{name}-hibernate-testing.pom
%{_mavendepmapfragdir}/%{name}-testing
%doc lgpl.txt
%changelog
* Mon Aug 27 2012 gil cattaneo 4.1.6-1
- update to 4.1.6.Final
* Thu Aug 02 2012 gil cattaneo 4.1.5-1.SP1
- initial rpm