From 415e5ba8848e076aaf1c561887d4596e4c94153e Mon Sep 17 00:00:00 2001
From: "John K. Harvey" <john.harvey@crunchydata.com>
Date: Wed, 30 Dec 2015 15:38:58 -0500
Subject: [PATCH] New specfiles for EL6/7 for pgjdbc REL9.4.1207

---
 .../9.5/postgresql-jdbc/EL-6/postgresql-jdbc.spec  | 27 ++++++-------
 .../9.5/postgresql-jdbc/EL-7/postgresql-jdbc.spec  | 44 +++++++++++-----------
 2 files changed, 37 insertions(+), 34 deletions(-)

diff --git a/rpm/redhat/9.5/postgresql-jdbc/EL-6/postgresql-jdbc.spec b/rpm/redhat/9.5/postgresql-jdbc/EL-6/postgresql-jdbc.spec
index 4ae4461..c100a70 100644
--- a/rpm/redhat/9.5/postgresql-jdbc/EL-6/postgresql-jdbc.spec
+++ b/rpm/redhat/9.5/postgresql-jdbc/EL-6/postgresql-jdbc.spec
@@ -23,7 +23,6 @@
 # on the rpm command line
 
 %{!?gcj_support:%global gcj_support	1}
-%{!?upstreamver:%global upstreamver	9.3-1101}
 %global pgmajorversion 95
 %global pginstdir /usr/pgsql-9.5
 %global sname postgresql-jdbc
@@ -33,24 +32,25 @@
 
 Summary:	JDBC driver for PostgreSQL
 Name:		postgresql%{pgmajorversion}-jdbc
-Version:	9.3.1101
+Version:	9.4.1207
 Release:	1PGDG%{?dist}
 Epoch:		0
 License:	BSD
 Group:		Applications/Databases
 URL:		http://jdbc.postgresql.org/
 
-Source0:	http://jdbc.postgresql.org/download/%{sname}-%{upstreamver}.src.tar.gz
+Source0:	https://github.com/pgjdbc/pgjdbc/archive/REL%{version}.tar.gz
 
 Provides:	postgresql-jdbc
 
 %if ! %{gcj_support}
 BuildArch:	noarch
 %endif
-BuildRequires:  jpackage-utils >= 0:1.5
-BuildRequires:  ant >= 0:1.6.2
-BuildRequires:  ant-junit >= 0:1.6.2
-BuildRequires:  junit >= 0:3.7
+# gettext is only needed if we try to update translations
+#BuildRequires:	gettext
+# Maven RPM is in http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo
+BuildRequires:  apache-maven >= 3.0.0
+BuildRequires:  java-1.8.0-openjdk-devel
 BuildRequires:	findutils gettext
 %if %{gcj_support}
 BuildRequires:	gcc-java
@@ -65,24 +65,22 @@ system. The postgresql-jdbc package includes the .jar files needed for
 Java programs to access a PostgreSQL database.
 
 %prep
-%setup -q -n %{sname}-%{upstreamver}.src
+%setup -q -n pgjdbc-REL%{version}/
 
 # remove any binary libs
 find -name "*.jar" -or -name "*.class" | xargs rm -f
 
 %build
-export OPT_JAR_LIST="ant/ant-junit junit"
 export CLASSPATH=
 
-sh update-translations.sh
-ant
+mvn -DskipTests -P release-artifacts clean package
 
 %install
 rm -rf %{buildroot}
 install -d %{buildroot}%{_javadir}
 # Per jpp conventions, jars have version-numbered names and we add
 # versionless symlinks.
-install -m 644 jars/postgresql-%{upstreamver}.jdbc4.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
+install -m 644 pgjdbc/target/postgresql-%{version}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
 
 pushd %{buildroot}%{_javadir}
 ln -s %{name}-%{version}.jar %{name}.jar
@@ -103,7 +101,7 @@ rm -rf %{buildroot}
 
 %files
 %defattr(-,root,root)
-%doc LICENSE doc/* 
+%doc LICENSE
 %{_javadir}/*
 %if %{gcj_support}
 %dir %{_libdir}/gcj/%{name}
@@ -112,6 +110,9 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
+* Wed Dec 30 2015 John Harvey <john.harvey@crunchydata.com>
+- Update to 9.4 build 1207 (maven support)
+
 * Thu Jul 10 2014 Devrim Gunduz <devrim@gunduz.org> 0:9.3.1101-1PGDG
 - Update to 9.3 build 1101
 
diff --git a/rpm/redhat/9.5/postgresql-jdbc/EL-7/postgresql-jdbc.spec b/rpm/redhat/9.5/postgresql-jdbc/EL-7/postgresql-jdbc.spec
index 1fae9e8..aa15e3b 100644
--- a/rpm/redhat/9.5/postgresql-jdbc/EL-7/postgresql-jdbc.spec
+++ b/rpm/redhat/9.5/postgresql-jdbc/EL-7/postgresql-jdbc.spec
@@ -1,30 +1,27 @@
 %global section		devel
-%global upstreamver	9.3-1101
 %global pgmajorversion 95
 %global pginstdir /usr/pgsql-9.5
 %global sname postgresql-jdbc
 
 Summary:	JDBC driver for PostgreSQL
 Name:		postgresql%{pgmajorversion}-jdbc
-Version:	9.3.1101
-Release:	1%{?dist}
+Version:	9.4.1207
+Release:	1PGDG%{?dist}
 # ASL 2.0 applies only to postgresql-jdbc.pom file, the rest is BSD
 License:	BSD and ASL 2.0
 Group:		Applications/Databases
 URL:		http://jdbc.postgresql.org/
 
-Source0:	http://jdbc.postgresql.org/download/%{sname}-%{upstreamver}.src.tar.gz
+Source0:	https://github.com/pgjdbc/pgjdbc/archive/REL%{version}.tar.gz
 # originally http://repo2.maven.org/maven2/postgresql/postgresql/8.4-701.jdbc4/postgresql-8.4-701.jdbc4.pom:
 Source1:	%{name}.pom
 
 BuildArch:	noarch
-BuildRequires:	java-1.7.0-openjdk-devel
-BuildRequires:	jpackage-utils
-BuildRequires:	ant
-BuildRequires:	ant-junit
-BuildRequires:	junit
 # gettext is only needed if we try to update translations
 #BuildRequires:	gettext
+# Maven RPM is in http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo
+BuildRequires:	apache-maven >= 3.0.0
+BuildRequires:	java-1.8.0-openjdk-devel
 Requires:	jpackage-utils
 Requires:	java-headless >= 1:1.8
 
@@ -41,17 +38,18 @@ Group:          Documentation
 This package contains the API Documentation for %{name}.
 
 %prep
-%setup -c -q -n postgresql-jdbc-9.3-1101.src/
+%setup -c -q -n pgjdbc-REL%{version}/
 
-mv -f %{sname}-%{upstreamver}.src/* .
-rm -f %{sname}-%{upstreamver}.src/.gitignore
-rmdir %{sname}-%{upstreamver}.src
+mv -f pgjdbc-REL%{version}/* .
+rm -f pgjdbc-REL%{version}/.gitattributes
+rm -f pgjdbc-REL%{version}/.gitignore
+rm -f pgjdbc-REL%{version}/.travis.yml
+#rmdir pgjdbc-REL%{version}
 
 # remove any binary libs
 find -name "*.jar" -or -name "*.class" | xargs rm -f
 
 %build
-export OPT_JAR_LIST="ant/ant-junit junit"
 export CLASSPATH=
 
 # Ideally we would run "sh update-translations.sh" here, but that results
@@ -60,13 +58,14 @@ export CLASSPATH=
 # different platforms don't build in the same minute.  For now, rely on
 # upstream to have updated the translations files before packaging.
 
-ant jar publicapi
+mvn -DskipTests -P release-artifacts clean package
+
 
 %install
 install -d $RPM_BUILD_ROOT%{_javadir}
 # Per jpp conventions, jars have version-numbered names and we add
 # versionless symlinks.
-install -m 644 jars/postgresql-%{upstreamver}.jdbc41.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
+install -m 644 pgjdbc/target/postgresql-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
 
 
 pushd $RPM_BUILD_ROOT%{_javadir}
@@ -78,27 +77,27 @@ ln -s postgresql-jdbc.jar postgresql-jdbc3.jar
 popd
 
 # Install the pom after inserting the correct version number
-sed 's/UPSTREAM_VERSION/%{upstreamver}/g' %{SOURCE1} >JPP-%{name}.pom
+sed 's/UPSTREAM_VERSION/%{version}/g' %{SOURCE1} >JPP-%{name}.pom
 install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}/
 install -m 644 JPP-%{name}.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
 %add_maven_depmap
 
 install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}
-cp -ra build/publicapi $RPM_BUILD_ROOT%{_javadocdir}/%{name}
-install -d build/publicapi docs/%{name}
+cp -ra pgjdbc/target/apidocs $RPM_BUILD_ROOT%{_javadocdir}/%{name}
+install -d pgjdbc/target/apidocs docs/%{name}
 
 
 %check
 %if 0%{?runselftest}
 # Note that this requires to have PostgreSQL properly configured;  for this
 # reason the testsuite is turned off by default (see org/postgresql/test/README)
-ant test 2>&1 | tee test.log | grep FAILED
+mvn clean package 2>&1 | tee test.log | grep FAILED
 test $? -eq 0 && { cat test.log ; exit 1 ; }
 %endif
 
 
 %files -f .mfiles
-%doc LICENSE README.md doc/*
+%doc LICENSE README.md
 %{_javadir}/%{sname}2.jar
 %{_javadir}/%{sname}2ee.jar
 %{_javadir}/%{sname}3.jar
@@ -108,6 +107,9 @@ test $? -eq 0 && { cat test.log ; exit 1 ; }
 %doc %{_javadocdir}/%{name}
 
 %changelog
+* Wed Dec 30 2015 John Harvey <john.harvey@crunchydata.com>
+- Update to 9.4 build 1207 (maven support)
+
 * Wed Jul 9 2014 Devrim Gunduz <devrim@gunduz.org> 0:9.3.1101-1PGDG
 - Update to 9.3 build 1101
 - Remove gcj support, now deprecated.
-- 
2.5.0

