Skip to content

Commit

Permalink
packaging: sync spec file with Fedora package
Browse files Browse the repository at this point in the history
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 dd48911
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 67 deletions.
3 changes: 2 additions & 1 deletion packaging/rpm/.srpmgen
Expand Up @@ -6,4 +6,5 @@ spec: postgresql-jdbc.spec


source0: source0:
git_archive: git_archive:
prefix: postgresql-jdbc-9.5.git prefix: pgjdbc-REL9.5.git
tarball_base: REL9.5.git
2 changes: 1 addition & 1 deletion packaging/rpm/fedora-image/Dockerfile
@@ -1,4 +1,4 @@
FROM index.docker.io/fedora:23 FROM index.docker.io/fedora:24
MAINTAINER pgjdbc team MAINTAINER pgjdbc team


ENV HOME=/rpm ENV HOME=/rpm
Expand Down
9 changes: 7 additions & 2 deletions packaging/rpm/fedora-image/srpmgen
Expand Up @@ -30,9 +30,14 @@ sub obtain_source
chomp ($topleveldir); chomp ($topleveldir);


my $pfx = $config->{prefix}; 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) { if ($? >> 8) {
die ("can't generate tarball $pfx.tar.gz"); die ("can't generate tarball $tarball_base.tar.gz");
} }
return; return;
} }
Expand Down
99 changes: 36 additions & 63 deletions packaging/rpm/postgresql-jdbc.spec.tpl
Expand Up @@ -36,23 +36,22 @@


%global section devel %global section devel
%global upstreamrel git %global upstreamrel git
%global upstreammajor 9.5
%global source_path pgjdbc/src/main/java/org/postgresql %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 parent_poms_builddir ./pgjdbc-parent-poms


%global pgjdbc_mvn_options -DwaffleEnabled=false -DosgiEnabled=false \\\ %global pgjdbc_mvn_options -DwaffleEnabled=false -DosgiEnabled=false \\\
-DexcludePackageNames=org.postgresql.osgi:org.postgresql.sspi -DexcludePackageNames=org.postgresql.osgi:org.postgresql.sspi


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


SOURCE0: %{name}-%{version}.tar.gz Source0: REL%{version}.tar.gz
Source1: postgres-testing.sh Source1: postgres-testing.sh


# Upstream moved parent pom.xml into separate project (even though there is only # Upstream moved parent pom.xml into separate project (even though there is only
Expand All @@ -62,7 +61,6 @@ Source2: https://github.com/pgjdbc/pgjdbc-parent-poms/archive/REL%parent_ver.tar


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


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


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




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


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


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


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




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


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


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



%pom_disable_module ubenchmark %pom_disable_module ubenchmark


# Hack #0! For upstream it is to some extent important to have the parent-poms # Build parent POMs in the same Maven call.
# project separated. Having it like that on downstream level does not help at %pom_xpath_inject pom:modules "<module>%parent_poms_builddir</module>"
# all. Note that we have to revert this patch before we do the installation. %pom_xpath_inject pom:parent "<relativePath>pgjdbc-parent-poms/pgjdbc-versions</relativePath>"
sed -i.hack-parent-poms \ %pom_xpath_set pom:relativePath ../pgjdbc-parent-poms/pgjdbc-core-parent pgjdbc
's!<relativePath />!<relativePath>../pgjdbc-parent-poms/pgjdbc-core-parent/pom.xml</relativePath>!' \
pgjdbc/pom.xml # compat symlink: requested by dtardon (libreoffice), reverts part of
sed -i.hack-parent-poms \ # 0af97ce32de877 commit.
'/<artifactId>pgjdbc-versions/a <relativePath>pgjdbc-parent-poms/pgjdbc-versions/pom.xml</relativePath>' \ %mvn_file org.postgresql:postgresql %{name}/postgresql %{name}
pom.xml
# 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 # Hack #1! This directory is missing for some reason, it is most probably some
# misunderstanding between maven, maven-compiler-plugin and # misunderstanding between maven, maven-compiler-plugin and
Expand Down Expand Up @@ -158,61 +157,35 @@ EOF


# Start the local PG cluster. # Start the local PG cluster.
pgtests_start pgtests_start
%endif

# 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
%else %else
%mvn_build -- %pgjdbc_mvn_options -Dmaven.test.skip=true # -f is equal to -Dmaven.test.skip=true
opts="-f"
%endif %endif


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



%install %install
%mvn_install %mvn_install
cd %parent_poms_builddir
%mvn_install

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
popd


%check




%files -f .mfiles %files -f .mfiles
%license LICENSE %license LICENSE
%doc README.md %doc README.md
%{_javadir}/%{name}.jar
%{_javadir}/%{name}2.jar
%{_javadir}/%{name}2ee.jar
%{_javadir}/%{name}3.jar


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


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


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




%changelog %changelog
* Mon Aug 29 2016 Pavel Raiskup <praiskup@redhat.com> - 9.4.1209-6
- sync with latest Fedora

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


Expand Down

0 comments on commit dd48911

Please sign in to comment.