Fix Maven artifact installation

- Resolves: rhbz#1358134
This commit is contained in:
Mikolaj Izdebski 2016-07-20 09:49:12 +02:00
parent 367f2e7252
commit 1b1f0eaad2

View File

@ -56,9 +56,6 @@ URL: http://jdbc.postgresql.org/
Source0: https://github.com/pgjdbc/pgjdbc/archive/REL%version.tar.gz
Source1: postgres-testing.sh
Provides: mvn(org.postgresql:postgresql)
Provides: mvn(postgresql:postgresql)
# Upstream moved parent pom.xml into separate project (even though there is only
# one dependant project on it?). Let's try to not complicate packaging by
# having separate spec file for it, too.
@ -118,15 +115,16 @@ 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>!' \
pgjdbc/pom.xml
sed -i.hack-parent-poms \
'/<artifactId>pgjdbc-versions/a <relativePath>pgjdbc-parent-poms/pgjdbc-versions/pom.xml</relativePath>' \
pom.xml
# 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
# 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
@ -164,29 +162,15 @@ EOF
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
%mvn_build -- %pgjdbc_mvn_options -Dmaven.test.skip=true
%endif
# Hack #0! Revert the patch above.
for i in `find -name '*.hack-parent-poms'`
do
mv $i ${i%%%%.hack-parent-poms}
done
%install
%mvn_install
cd %parent_poms_builddir
%mvn_install
%check
@ -196,7 +180,7 @@ cd %parent_poms_builddir
%license LICENSE
%doc README.md
%files parent-poms -f %parent_poms_builddir/.mfiles
%files parent-poms -f .mfiles-parent-poms
%files javadoc
%license LICENSE