Skip to content
Browse files

packaging: sync spec file with Fedora package

Fedora maintainers have done big cleanup and simplification so it
is worth syncing the spec file with pgjdbc.

Also, this commit fixes the 'srpmgen' tool so it is able to
generate equivalent tarball to github's release tarball.

fixes #608
  • Loading branch information
praiskup authored and vlsi committed Aug 30, 2016
1 parent 2d9b313 commit dd48911b24b6547703c3dba3441a59099150f2aa
@@ -6,4 +6,5 @@ spec: postgresql-jdbc.spec

prefix: postgresql-jdbc-9.5.git
prefix: pgjdbc-REL9.5.git
tarball_base: REL9.5.git
@@ -1,4 +1,4 @@
MAINTAINER pgjdbc team

@@ -30,9 +30,14 @@ sub obtain_source
chomp ($topleveldir);

my $pfx = $config->{prefix};
system ("git archive --remote $topleveldir --prefix $pfx/ HEAD | gzip > $pfx.tar.gz");
my $tarball_base = $pfx;
info ("generating tarball $tarball_base.tar.gz from git repository");
if (defined ($config->{tarball_base})) {
$tarball_base = $config->{tarball_base};
system ("git archive --remote $topleveldir --prefix $pfx/ HEAD | gzip > $tarball_base.tar.gz");
if ($? >> 8) {
die ("can't generate tarball $pfx.tar.gz");
die ("can't generate tarball $tarball_base.tar.gz");
@@ -36,23 +36,22 @@

%global section devel
%global upstreamrel git
%global upstreammajor 9.5
%global source_path pgjdbc/src/main/java/org/postgresql
%global parent_ver 1.0.8
%global parent_ver 1.1.0
%global parent_poms_builddir ./pgjdbc-parent-poms

%global pgjdbc_mvn_options -DwaffleEnabled=false -DosgiEnabled=false \\\

Summary: JDBC driver for PostgreSQL
Name: postgresql-jdbc
Version: 9.5.%{upstreamrel}
Version: %upstreammajor.%{upstreamrel}
Release: 1%{?dist}
# ASL 2.0 applies only to postgresql-jdbc.pom file, the rest is BSD
License: BSD and ASL 2.0
Group: Applications/Databases
License: BSD

SOURCE0: %{name}-%{version}.tar.gz
Source0: REL%{version}.tar.gz

# Upstream moved parent pom.xml into separate project (even though there is only
@@ -62,7 +61,6 @@ Source2:

BuildArch: noarch
BuildRequires: java-devel >= 1.8
BuildRequires: jpackage-utils
BuildRequires: maven-local
BuildRequires: java-comment-preprocessor
BuildRequires: properties-maven-plugin
@@ -77,8 +75,6 @@ BuildRequires: postgresql-contrib

# gettext is only needed if we try to update translations
#BuildRequires: gettext
Requires: jpackage-utils
Requires: java-headless >= 1:1.8

PostgreSQL is an advanced Object-Relational database management
@@ -87,7 +83,7 @@ Java programs to access a PostgreSQL database.

%package parent-poms
Summary: Build dependency management for pgjdbc.
Summary: Build dependency management for PostgreSQL JDBC driver.

%description parent-poms
Pom files bringing dependencies required for successful PostgreSQL JDBC driver
@@ -96,33 +92,36 @@ build.

%package javadoc
Summary: API docs for %{name}
Group: Documentation

%description javadoc
This package contains the API Documentation for %{name}.

%setup -c -q -a 2
%setup -c -q -a 2 -n pgjdbc-REL%version

mv %name-%version/* .
mv ./pgjdbc-parent-poms-REL%parent_ver %parent_poms_builddir
mv pgjdbc-REL%version/* .
mv pgjdbc-parent-poms-REL%parent_ver pgjdbc-parent-poms

# remove any binary libs
find -name "*.jar" -or -name "*.class" | xargs rm -f

%pom_disable_module ubenchmark

# Hack #0! For upstream it is to some extent important to have the parent-poms
# project separated. Having it like that on downstream level does not help at
# all. Note that we have to revert this patch before we do the installation.
sed -i.hack-parent-poms \
's!<relativePath />!<relativePath>../pgjdbc-parent-poms/pgjdbc-core-parent/pom.xml</relativePath>!' \
sed -i.hack-parent-poms \
'/<artifactId>pgjdbc-versions/a <relativePath>pgjdbc-parent-poms/pgjdbc-versions/pom.xml</relativePath>' \
# Build parent POMs in the same Maven call.
%pom_xpath_inject pom:modules "<module>%parent_poms_builddir</module>"
%pom_xpath_inject pom:parent "<relativePath>pgjdbc-parent-poms/pgjdbc-versions</relativePath>"
%pom_xpath_set pom:relativePath ../pgjdbc-parent-poms/pgjdbc-core-parent pgjdbc

# compat symlink: requested by dtardon (libreoffice), reverts part of
# 0af97ce32de877 commit.
%mvn_file org.postgresql:postgresql %{name}/postgresql %{name}

# Parent POMs should be installed in a separate subpackage.
%mvn_package ":*{parent,versions,prevjre}*" parent-poms

# For compat reasons, make Maven artifact available under older coordinates.
%mvn_alias org.postgresql:postgresql postgresql:postgresql

# Hack #1! This directory is missing for some reason, it is most probably some
# misunderstanding between maven, maven-compiler-plugin and
@@ -158,61 +157,35 @@ EOF

# Start the local PG cluster.

# First "build" the parent-poms ..
cd %parent_poms_builddir
%mvn_build -- %pgjdbc_mvn_options
cd ..
# .. and then build pgjdbc.

%if %runselftest
%mvn_build -- %pgjdbc_mvn_options
%mvn_build -- %pgjdbc_mvn_options -Dmaven.test.skip=true
# -f is equal to -Dmaven.test.skip=true

# Hack #0! Revert the patch above.
for i in `find -name '*.hack-parent-poms'`
mv $i ${i%%%%.hack-parent-poms}

%mvn_build $opts -- %pgjdbc_mvn_options

cd %parent_poms_builddir

pushd $RPM_BUILD_ROOT%{_javadir}
# Also, for backwards compatibility with our old postgresql-jdbc packages,
# add these symlinks. (Probably only the jdbc3 symlink really makes sense?)
ln -s %{name}/postgresql.jar postgresql-jdbc.jar
ln -s %{name}/postgresql.jar postgresql-jdbc2.jar
ln -s %{name}/postgresql.jar postgresql-jdbc2ee.jar
ln -s %{name}/postgresql.jar postgresql-jdbc3.jar


%files -f .mfiles
%license LICENSE

%files parent-poms -f %parent_poms_builddir/.mfiles

%files javadoc
%files parent-poms -f .mfiles-parent-poms
%license LICENSE
%doc pgjdbc-parent-poms/ pgjdbc-parent-poms/

%files javadoc -f .mfiles-javadoc
%license LICENSE
%doc %{_javadocdir}/%{name}

* Mon Aug 29 2016 Pavel Raiskup <> - 9.4.1209-6
- sync with latest Fedora

* Wed Jun 01 2016 Pavel Raiskup <> - 9.5.git-1
- update to work with tarball from git version of jdbc

0 comments on commit dd48911

Please sign in to comment.