[thermostat/f19] Finish move to new-style maven packaging using xmvn.
jerboaa
jerboaa at fedoraproject.org
Fri May 17 16:01:39 UTC 2013
commit 95d98e84541480af91da4dd3bbbcf04cd8bccaf4
Author: Severin Gehwolf <sgehwolf at redhat.com>
Date: Fri May 17 17:47:36 2013 +0200
Finish move to new-style maven packaging using xmvn.
* This means users can now compile thermostat plugins using mvn-build.
* All thermostat poms are properly installed.
thermostat.spec | 125 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 94 insertions(+), 31 deletions(-)
---
diff --git a/thermostat.spec b/thermostat.spec
index ea8cf4a..9ec3474 100644
--- a/thermostat.spec
+++ b/thermostat.spec
@@ -5,7 +5,7 @@ Name: thermostat
Version: 0.6.0
# If building from snapshot out of hg, uncomment and adjust below value as appropriate
#Release: 0.28.20121123hg%{hgrev}%{?dist}
-Release: 14%{?dist}
+Release: 17%{?dist}
Summary: A monitoring and serviceability tool for OpenJDK
License: GPLv2+ with exceptions
URL: http://icedtea.classpath.org/thermostat/
@@ -40,6 +40,10 @@ BuildRequires: java-devel >= 1:1.7.0
BuildRequires: jpackage-utils
BuildRequires: maven-local
+# Explicitly require xmvn >= 0.4.2-1.1 Otherwise
+# config for skipping installation of the war module will not work.
+# See RHBZ#963838
+BuildRequires: xmvn >= 0.4.2-1.1
BuildRequires: maven-dependency-plugin
BuildRequires: maven-surefire-plugin
BuildRequires: maven-surefire-provider-junit4
@@ -185,6 +189,21 @@ tomcat's webapps directory.
%pom_remove_dep org.eclipse.jetty:jetty-server distribution
%pom_remove_dep org.eclipse.jetty:jetty-webapp distribution
+# Skip automatic installation of the war module.
+# We install it manually. Without this "config" %mvn_build -f
+# fails. See RHBZ#963838
+%mvn_package :thermostat-web-war __noinstall
+# Don't install :thermostat-common-test, it's a test only dep which
+# aren't run during the build.
+%mvn_package :thermostat-common-test __noinstall
+
+# These are just upstream build helpers. Don't install them.
+%mvn_package :thermostat-distribution __noinstall
+%mvn_package :thermostat-assembly __noinstall
+
+# thermostat-web-server should be part of the webapp sub-package
+%mvn_package :thermostat-web-server webapp
+
%build
export CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
# Set JAVA_HOME. make uses this
@@ -211,14 +230,11 @@ popd
# This is roughly equivalent to:
# mvn
# -Dthermostat.home=%{_datarootdir}/%{name} \
-# -Dmaven.local.debug=%{maven_debug_flag} \
# -Dthermostat.web.deploy.dir=$(pwd)/webstorage-webapp \
-# package javadoc:aggregate
-%mvn_config properties/thermostat.home %{_datarootdir}/%{name}
-# We need to skip installation of artifacts since it does not recognize the war packaging
-# type yet. This leaves us without many of the goodies that would provide.
-# See https://bugzilla.redhat.com/show_bug.cgi?id=963838
-%mvn_build -f -i
+# install javadoc:aggregate
+# Everything after '--' is passed to plain xmvn/mvn
+%mvn_build -f -- -Dthermostat.home=%{_datarootdir}/%{name} \
+ -Dthermostat.web.deploy.dir=$(pwd)/webstorage-webapp
# the build puts all depdency jars into distribution/target/lib as well
mv distribution/target/libs/thermostat-*jar .
@@ -229,20 +245,37 @@ mv thermostat-*jar distribution/target/libs/
sed -i 's|^JAVA=.*|JAVA="/usr/lib/jvm/java-openjdk/jre/bin/java"|' distribution/target/bin/thermostat
sed -i 's|^JAVA=.*|JAVA="/usr/lib/jvm/java-openjdk/jre/bin/java"|' distribution/target/bin/thermostat-client-gui
-# remove dirs/files which we don't need shipped
-rm -rf distribution/target/{maven-archiver,osgi-cache,generated-sources,tools,classes}
-rm -rf distribution/target/thermostat-distribution-*.jar
+# Remove dirs/files which we don't need shipped
+rm -rf distribution/target/{maven-archiver,maven-status,osgi-cache,generated-sources,tools,classes}
+rm distribution/target/thermostat-distribution-*.jar
+
+# Collect a list of filenames which we later use in order to symlink from /usr/share/java
+pushd distribution/target/libs
+for i in *.jar; do
+ newFileName=$(echo $i | sed 's/-\([0-9]\+\.\)\+[0-9]\+\(-.*\)\?//')
+ # collect original filenames in a file so that we can symlink to them
+ # from %{_javadir}/%{name}
+ echo "libs/${i}#${newFileName}" >> ../../symlink-map-filenames
+done
+popd
+pushd distribution/target/plugins
+for i in $(find -name '*.jar' | sed 's#^./##g'); do
+ fname=$(basename $i)
+ newFileName=$(echo $fname | sed 's/-\([0-9]\+\.\)\+[0-9]\+\(-.*\)\?//')
+ echo "plugins/${i}#${newFileName}" >> ../../symlink-map-filenames
+done
+popd
+grep -v "thermostat-web-server" distribution/symlink-map-filenames > distribution/symlink-map-filenames-filtered
+mv distribution/symlink-map-filenames-filtered distribution/symlink-map-filenames
# clean-up webapp. these are all symlinks to libs in /usr/share/thermostat
# except for thermostat-web-server
-pushd web/war/target
-WEB_WAR_DIR=$(pwd)/$(find -name 'thermostat-web-war*' -type d)
-rm -rf ${WEB_WAR_DIR}/WEB-INF/lib/*
+pushd webstorage-webapp
+rm -rf WEB-INF/lib/*
popd
-mv distribution/target/libs/thermostat-web-server*.jar ${WEB_WAR_DIR}/WEB-INF/lib
+mv distribution/target/libs/thermostat-web-server*.jar webstorage-webapp/WEB-INF/lib
%install
-%mvn_install
#######################################################
# Thermostat core
#######################################################
@@ -253,17 +286,31 @@ mkdir -p %{buildroot}%{_datarootdir}
mkdir -p %{buildroot}%{_libdir}/%{name}
mkdir -p %{buildroot}%{_jnidir}
+# Dance the xmvn install limbo. This only makes sense if %mvn_build does NOT have
+# the '-i' switch.
+%mvn_install
+
+rm -rf %{buildroot}%{_javadir}/%{name}
+
+# now make xmvn happy, it expects version-less thermostat jars in %{_javadir}/%{name}
+mkdir %{buildroot}%{_javadir}/%{name}
+for i in $(cat distribution/symlink-map-filenames); do
+ s=$(echo $i | cut -d'#' -f1)
+ t=$(echo $i | cut -d'#' -f2)
+ ln -s %{_datarootdir}/%{name}/$s %{buildroot}%{_javadir}/%{name}/$t
+done
+
pushd distribution/target/libs
# JNI jars need to be in %{_jnidir}, we symlink to
# %{_libdir}/%{name} files. Files are moved to
# %{_libdir}/%{name} next.
-for i in thermostat-keyring-%{version}*.jar \
- thermostat-agent-core-%{version}*.jar; do
+for i in thermostat-keyring-*.jar \
+ thermostat-agent-core-*.jar; do
ln -s %{_libdir}/%{name}/$i %{buildroot}%{_jnidir}/$i
done
# JNI files are in %{_libdir}
-mv thermostat-keyring-%{version}*.jar \
- thermostat-agent-core-%{version}*.jar \
+mv thermostat-keyring-*.jar \
+ thermostat-agent-core-*.jar \
%{buildroot}%{_libdir}/%{name}
# Make native libs executable so that debuginfos get properly
# generated
@@ -291,8 +338,7 @@ ln -s %{_javadir}/apache-commons-logging.jar %{buildroot}%{_datarootdir}/%{name}
ln -s %{_javadir}/apache-commons-io.jar %{buildroot}%{_datarootdir}/%{name}/libs/commons-io.jar
ln -s %{_javadir}/apache-commons-fileupload.jar %{buildroot}%{_datarootdir}/%{name}/libs/commons-fileupload.jar
ln -s %{_javadir}/jcommon.jar %{buildroot}%{_datarootdir}/%{name}/libs/jcommon.jar
-# Change to jline2.jar once RHBZ#919640 has been fixed
-ln -s %{_javadir}/jline2-2.10.jar %{buildroot}%{_datarootdir}/%{name}/libs/jline2.jar
+ln -s %{_javadir}/jline2.jar %{buildroot}%{_datarootdir}/%{name}/libs/jline2.jar
ln -s %{_javadir}/lucene.jar %{buildroot}%{_datarootdir}/%{name}/libs/lucene.jar
ln -s %{_javadir}/netty.jar %{buildroot}%{_datarootdir}/%{name}/libs/netty.jar
ln -s %{_javadir}/mongo.jar %{buildroot}%{_datarootdir}/%{name}/libs/mongo.jar
@@ -349,20 +395,27 @@ mv %{buildroot}%{_datarootdir}/%{name}/etc/ssl.properties \
ln -s %{_sysconfdir}/%{name}/ssl.properties \
%{buildroot}%{_datarootdir}/%{name}/etc/ssl.properties
+
#######################################################
# Thermostat web storage webapp
#######################################################
-pushd web/war/target
-WEB_WAR_DIR=$(pwd)/$(find -name 'thermostat-web-war*' -type d)
mkdir -p %{buildroot}%{_datadir}/tomcat/webapps
+pushd webstorage-webapp
# Fixup THERMOSTAT_HOME in web.xml
sed -i '/<param-name>THERMOSTAT_HOME<[/]param-name>/,/<param-value>.*<[/]param-value>/{ s$<param-value>.*</param-value>$<param-value>%{_datadir}/%{name}</param-value>$ }' \
- ${WEB_WAR_DIR}/WEB-INF/web.xml
+ WEB-INF/web.xml
# Fixup 'pathname' to thermostat-users.xml file in context.xml
sed -i '/Realm className="org.apache.catalina.realm.MemoryRealm"/,/pathname=".*"/{ s|pathname=".*\(WEB-INF/thermostat-users.xml\)"|pathname="%{_datadir}/tomcat/webapps/%{name}/\1"| }' \
- ${WEB_WAR_DIR}/META-INF/context.xml
-cp -r ${WEB_WAR_DIR} %{buildroot}%{_datadir}/tomcat/webapps/%{name}
+ META-INF/context.xml
popd
+cp -r webstorage-webapp %{buildroot}%{_datadir}/tomcat/webapps/%{name}
+
+# Make xmvn happy. Give it a symlink in %{_javadir}/%{name}
+pushd %{buildroot}%{_datadir}/tomcat/webapps/%{name}/WEB-INF/lib
+for i in thermostat-*.jar; do
+ newFileName=$(echo $i | sed 's/-\([0-9]\+\.\)\+[0-9]\+\(-.*\)\?//')
+ ln -s %{_datadir}/tomcat/webapps/%{name}/WEB-INF/lib/$i %{buildroot}%{_javadir}/%{name}/$newFileName
+done
# Symlink core libs
pushd %{buildroot}%{_datarootdir}/%{name}/libs
@@ -388,7 +441,7 @@ ln -s %{_javadir}/google-gson.jar
ln -s %{_javadir}/apache-commons-codec.jar
popd
-%files
+%files -f .mfiles
%doc COPYING
%doc LICENSE
%doc README
@@ -399,13 +452,23 @@ popd
%{_bindir}/thermostat-client
%{_bindir}/thermostat
-%files javadoc
-%{_javadocdir}/%{name}
+%files javadoc -f .mfiles-javadoc
-%files webapp
+%files webapp -f .mfiles-webapp
%{_datadir}/tomcat/webapps/%{name}
%changelog
+* Fri May 17 2013 Severin Gehwolf <sgehwolf at redhat.com> 0.6.0-17
+- Finish move to new-style mvn packaging.
+
+* Fri May 17 2013 Severin Gehwolf <sgehwolf at redhat.com> 0.6.0-16
+- More xmvn + proper pom installation packaging progress.
+
+* Fri May 17 2013 Severin Gehwolf <sgehwolf at redhat.com> 0.6.0-15
+- Require xmvn >= 0.4.2-1.1 in order to be able to skip installation
+ of the web archive module.
+- More work towards new-style packaging.
+
* Thu May 16 2013 Severin Gehwolf <sgehwolf at redhat.com> 0.6.0-14
- More fixes using pom macros.
- Experiment with new-style packaging. Hit a road-block. Need a
More information about the scm-commits
mailing list