Name:       hibernate3
Version:    3.6.10
Release:    23
Summary:    Inquiry service and persistence of releationship
License:    LGPLv2+
URL:        http://www.hibernate.org/
# git clone git://github.com/hibernate/hibernate-orm
# cd hibernate-orm/ && git archive --format=tar --prefix=hibernate-orm-3.6.10.Final/ 3.6.10.Final | xz > hibernate-3.6.10.Final.tar.xz
Source0:    hibernate-orm-3.6.10.Final.tar.xz
Patch0000:  hibernate-orm-fix-jacc-gid-aid.patch
Patch0001:  hibernate-orm-cglib-3.1.patch

BuildArch:  noarch

BuildRequires: jpackage-utils javapackages-tools >= 0.7.2 maven-local maven-antrun-plugin maven-release-plugin
BuildRequires: maven-enforcer-plugin maven-injection-plugin antlr-maven-plugin geronimo-validation 
BuildRequires: geronimo-jta hibernate-validator jboss-jacc-1.4-api cglib c3p0 proxool hibernate-commons-annotations
BuildRequires: jboss-servlet-3.0-api ehcache-core rhq-plugin-annotations h2 mvn(hsqldb:hsqldb:1) glassfish-jaxb
BuildRequires: mvn(org.slf4j:slf4j-log4j12) shrinkwrap jboss-transaction-1.1-api

Obsoletes: %{name}-infinispan < %{version}-%{release} %{name}-jbosscache < %{version}-%{release}

%description
Hibernate is an object-relational mapping solution for the Java language.
It is free, open source software released under the GNU Lesser General
Public License. It provides an easy-to-use persistence framework for the
mapping of object-oriented domain models to traditional relational databases.

%package help
Summary:        Help documents for hibernate3
Provides:       javadoc = %{version}-%{release}
Obsoletes:      javadoc < %{version}-%{release}

%description help
Help documents for hibernate3.

%package entitymanager
Summary: Hibernate Entity Manager

%description entitymanager
Hibernate Entity Manager.

%package envers
Summary: Hibernate support for entity auditing

%description envers
Hibernate support for entity auditing.

%package c3p0
Summary: C3P0-based implementation of Hibernate ConnectionProvider

%description c3p0
C3P0-based implementation of Hibernate ConnectionProvider.

%package proxool
Summary: Proxool-based implementation of Hibernate ConnectionProvder

%description proxool
Proxool-based implementation of Hibernate ConnectionProvder.

%package ehcache
Summary: Integration of Hibernate with Ehcache

%description ehcache
Integration of Hibernate with Ehcache.

%package testing
Summary: Hibernate JUnit test utilities

%description testing
Hibernate JUnit test utilities.

%prep
%autosetup -n hibernate-orm-3.6.10.Final -p1

%pom_remove_plugin org.jboss.maven.plugins:maven-jdocbook-plugin hibernate-parent
%pom_remove_plugin org.jboss.maven.plugins:maven-jdocbook-style-plugin hibernate-parent
%pom_remove_plugin :gmaven-plugin hibernate-parent
%pom_disable_module hibernate-testsuite
%pom_disable_module hibernate-oscache
%pom_disable_module hibernate-swarmcache
%pom_disable_module hibernate-jdbc3-testing
%pom_disable_module hibernate-jdbc4-testing

%pom_disable_module hibernate-infinispan
%pom_disable_module hibernate-jbosscache

for m in envers entitymanager ehcache; do
%pom_xpath_remove "pom:dependencies/pom:dependency[pom:scope = 'test']" hibernate-${m}/pom.xml
done

%pom_xpath_remove pom:build/pom:extensions hibernate-parent/pom.xml

%pom_remove_dep org.hibernate:hibernate-tools hibernate-envers
%pom_remove_dep ant:ant hibernate-envers
rm -r hibernate-envers/src/main/java/org/hibernate/tool/ant/*.java \
  hibernate-envers/src/main/java/org/hibernate/envers/ant/*.java

%pom_xpath_set "pom:project/pom:dependencies/pom:dependency[pom:artifactId = 'c3p0' ]/pom:groupId" com.mchange  hibernate-c3p0

for f in hibernate-core hibernate-envers;do
%pom_xpath_set "pom:project/pom:dependencies/pom:dependency[pom:artifactId = 'hibernate-commons-annotations' ]/pom:groupId" org.hibernate.common  ${f}
done

for f in hibernate-core hibernate-entitymanager hibernate-parent;do
sed -i "s|<groupId>javax.validation|<groupId>org.apache.geronimo.specs|" ${f}/pom.xml
sed -i "s|<artifactId>validation-api|<artifactId>geronimo-validation_1.0_spec|" ${f}/pom.xml
done

sed -i "s|<groupId>javax.transaction|<groupId>org.jboss.spec.javax.transaction|" hibernate-core/pom.xml
sed -i "s|<artifactId>jta|<artifactId>jboss-transaction-api_1.1_spec|" hibernate-core/pom.xml
sed -i "s|<version>1.1</version>|<version>1.0.1.Final</version>|" hibernate-core/pom.xml

%pom_xpath_set "pom:project/pom:dependencyManagement/pom:dependencies/pom:dependency[pom:artifactId = 'hibernate-commons-annotations' ]/pom:groupId" org.hibernate.common  hibernate-parent

sed -i "s,59 Temple Place,51 Franklin Street,;s,Suite 330,Fifth Floor,;s,02111-1307,02110-1301," lgpl.txt

%mvn_compat_version : 3 3.6.10.Final
%mvn_package ":hibernate-parent" %{name}
%mvn_package ":hibernate-core" %{name}
%mvn_package ":hibernate" __noinstall

%build

export jdk16_home=/usr
export LANG=en_US.UTF-8
%mvn_build -s -f -- -DdisableDistribution=true -DadditionalJOption=-Xdoclint:none

%install
%mvn_install

%files -f .mfiles-%{name}
%license lgpl.txt

%files help -f .mfiles-javadoc
%license lgpl.txt
%doc changelog.txt

%files entitymanager -f .mfiles-hibernate-entitymanager
%license lgpl.txt

%files envers -f .mfiles-hibernate-envers
%license lgpl.txt

%files c3p0 -f .mfiles-hibernate-c3p0
%license lgpl.txt

%files ehcache -f .mfiles-hibernate-ehcache
%license lgpl.txt

%files proxool -f .mfiles-hibernate-proxool
%license lgpl.txt

%files testing -f .mfiles-hibernate-testing
%license lgpl.txt

%changelog
* Mon Feb 24 2020 wutao <wutao61@huawei.com> - 3.6.10-23
- Package init
