changeset 2027:fc1a3e0a8cf4

[RPM] Desktop integration and merge from downstream. Reviewed-by: jkang Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-September/021018.html PR3177
author Severin Gehwolf <sgehwolf@redhat.com>
date Tue, 20 Sep 2016 14:44:23 +0200
parents 04da543b538a
children 11bbdf6fc4ec
files distribution/packaging/fedora/thermostat.spec distribution/packaging/shared/desktop/thermostat.appdata.xml distribution/packaging/shared/desktop/thermostat.desktop pom.xml
diffstat 4 files changed, 118 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/distribution/packaging/fedora/thermostat.spec	Tue Sep 20 10:03:56 2016 +0200
+++ b/distribution/packaging/fedora/thermostat.spec	Tue Sep 20 14:44:23 2016 +0200
@@ -64,7 +64,11 @@
   %global javax_servlet_bundle_version 3.1.0
   %global javax_servlet_bsn            javax.servlet-api
   %global jgraphx_bundle_version       3.5.0
-  %global jetty_version                9.4.0
+  # xmvn-subst in rawhide and later fedoras support
+  # in reactor symlinking. See RHBZ#1226251
+  %global xmvn_subst_args            -R %{buildroot} .
+  %global jetty_version              9.4.0.M0
+  %global tomcat_version             8
 
 %else
 
@@ -96,7 +100,9 @@
   %global javax_servlet_bundle_version 3.0.0
   %global javax_servlet_bsn            javax.servlet
   %global jgraphx_bundle_version       3.1.2
-  %global jetty_version                9.0.3.v20130506
+  %global xmvn_subst_args            .
+  %global jetty_version              9.0.3.v20130506
+  %global tomcat_version             7
 
 %endif
 
@@ -133,6 +139,7 @@
   %global system_logdir %{_root_localstatedir}/log/%{pkg_name}
   %global system_statedir %{_root_localstatedir}/run/%{pkg_name}
   %global system_sbindir %{_root_sbindir}
+  %global thermostat_desktop_app_name "'Thermostat (from SCL)'"
 %if 0%{?is_rhel_6}
   %global system_initrddir %{_root_sysconfdir}/rc.d/init.d/
 %endif
@@ -146,6 +153,7 @@
   %global system_cachedir %{_localstatedir}/cache/%{pkg_name}
   %global system_logdir %{_localstatedir}/log/%{pkg_name}
   %global system_statedir %{_localstatedir}/run/%{pkg_name}
+  %global thermostat_desktop_app_name Thermostat
 }
 # system java dir definition (non-scl)
 %global system_javadir %{system_root_datadir}/java
@@ -246,10 +254,12 @@
 # is 4.3 OSGi spec.
 Patch2:     0002_shared_osgi_spec_fixes.patch
 
+%{?scl:
 %if 0%{?non_bootstrap_build}
 # Work-around xmvn-subst limitation
 BuildRequires: %{?scl_prefix}thermostat-webapp = %{version}
 %endif
+}
 
 # RHEL 6 does not have virtual provides java-devel >= 1.7
 %if 0%{?is_rhel_6}
@@ -471,9 +481,9 @@
 %pom_add_dep "org.apache.lucene:lucene-core:%{lucene_version}" vm-heap-analysis/distribution
 # Fix up artifact names for jgraphx
 %pom_remove_dep "org.tinyjee.jgraphx:jgraphx"
-%pom_add_dep "com.mxgraph:jgraphx:3.1.2.0"
+%pom_add_dep "com.mxgraph:jgraphx:%{jgraphx_bundle_version}.0"
 %pom_remove_dep "org.tinyjee.jgraphx:jgraphx" thread/client-swing
-%pom_add_dep "com.mxgraph:jgraphx:3.1.2.0" thread/client-swing
+%pom_add_dep "com.mxgraph:jgraphx:%{jgraphx_bundle_version}.0" thread/client-swing
 #  httpclient
 %pom_remove_dep org.apache.httpcomponents:httpclient-osgi web/client
 %pom_add_dep org.apache.httpcomponents:httpclient:4.4.0 web/client
@@ -637,7 +647,10 @@
 %mvn_build -f -- -Dthermostat.home=%{thermostat_home} \
                  -Dthermostat.system.user=thermostat \
                  -Dthermostat.system.group=thermostat \
+                 -Dthermostat.desktop.app.name=%{thermostat_desktop_app_name} \
                  -Dnetty.version=%{netty_bundle_version}.Final \
+                 -Dtomcat=%{tomcat_version} \
+                 -Dpkg_name=%{pkg_name} \
                  -Dcommons-logging.version=%{logging_bundle_version} \
                  -Dcommons-collections.version=%{collections_bundle_version} \
                  -Dcommons-codec.osgi-version=%{codec_bundle_version} \
@@ -655,7 +668,7 @@
                  -Dlucene.osgi-version=%{lucene_version} \
                  -Dosgi.compendium.bundle.symbolic-name=org.osgi.compendium \
                  -Dosgi.compendium.osgi-version=4.1.0 \
-                 -Djgraphx.osgi.version=%{jgraphx_bundle_version} \
+                 -Djgraphx.osgi.version=%{jgraphx_bundle_version}.0 \
                  -Djetty.javax.servlet.osgi.version=%{javax_servlet_bundle_version} \
                  -Djavax.servlet.bsn=%{javax_servlet_bsn} \
                  -Djetty.version=%{jetty_version}
@@ -692,9 +705,11 @@
 mkdir -p %{buildroot}%{_unitdir}
 %endif
 # Thermostat icon lives there
-mkdir -p %{buildroot}%{_datarootdir}/icons/hicolor/scalable/apps
-# Thermostat desktop lives there
-mkdir -p %{buildroot}%{_datarootdir}/applications
+mkdir -p %{buildroot}%{system_root_datadir}/icons/hicolor/scalable/apps
+# Thermostat desktop file lives there
+mkdir -p %{buildroot}%{system_root_datadir}/applications
+# Thermostat app data file lives there
+mkdir -p %{buildroot}%{system_root_datadir}/appdata
 # Example config files are in docdir
 mkdir -p %{buildroot}%{_docdir}/%{pkg_name}
 # Man page
@@ -758,6 +773,11 @@
 mkdir -p %{buildroot}%{system_root_datadir}/bash-completion/completions
 install -pm 644 distribution/target/packaging/bash-completion/thermostat-completion %{buildroot}%{system_root_datadir}/bash-completion/completions/%{pkg_name}
 
+# install files needed for proper desktop integration
+install -m 0644 distribution/target/packaging/desktop/%{pkg_name}.desktop %{buildroot}%{system_root_datadir}/applications/%{name}.desktop
+install -m 0644 distribution/target/packaging/icons/256px.svg %{buildroot}%{system_root_datadir}/icons/hicolor/scalable/apps/%{name}.svg
+install -m 0644 distribution/target/packaging/desktop/%{pkg_name}.appdata.xml %{buildroot}%{system_root_datadir}/appdata/%{name}.appdata.xml
+
 rm -rf distribution/target/image/bin/%{pkg_name}.orig
 # Remove developer setup things.
 rm distribution/target/image/bin/thermostat-devsetup
@@ -770,13 +790,13 @@
 
 # Replace jars with symlinks to installed libs
 pushd %{buildroot}%{thermostat_home}/libs
-  xmvn-subst .
+  xmvn-subst %{xmvn_subst_args}
 popd
 # Do the same for thermostat plugin dirs
 pushd %{buildroot}%{thermostat_home}/plugins
 for plugin_name in $(ls); do
   pushd $plugin_name
-    xmvn-subst .
+    xmvn-subst %{xmvn_subst_args}
   popd
 done
 popd
@@ -856,7 +876,7 @@
  
 # Replace jars with symlinks
 pushd %{buildroot}%{thermostat_catalina_base}/webapps/%{pkg_name}/WEB-INF/lib
-  xmvn-subst .
+  xmvn-subst %{xmvn_subst_args}
 popd
 
 # Remove tools.jar (coming from the JVM). We also don't need jzlib.jars.
@@ -953,7 +973,7 @@
 # Install but don't activate
 %systemd_post %{?scl_prefix}%{pkg_name}-storage.service
 # Required for icon cache (i.e. Thermostat icon)
-/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
+/bin/touch --no-create %{system_root_datadir}/icons/hicolor &>/dev/null || :
 
 %post webapp
 # install but don't activate
@@ -967,14 +987,14 @@
 %postun
 # Required for icon cache (i.e. Thermostat icon)
 if [ $1 -eq 0 ] ; then
-    /bin/touch --no-create %{_datadir}/icons/hicolor &> /dev/null
-    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+    /bin/touch --no-create %{system_root_datadir}/icons/hicolor &> /dev/null
+    /usr/bin/gtk-update-icon-cache %{system_root_datadir}/icons/hicolor &>/dev/null || :
 fi
 %systemd_postun %{?scl_prefix}%{pkg_name}-storage.service
 
 %posttrans
 # Required for icon cache (i.e. Thermostat icon)
-/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+/usr/bin/gtk-update-icon-cache %{system_root_datadir}/icons/hicolor &>/dev/null || :
 
 %files -f .mfiles
 %doc LICENSE
@@ -1003,6 +1023,10 @@
 # be installed
 %dir %{system_root_datadir}/bash-completion/completions
 %dir %{system_root_datadir}/bash-completion
+# Own desktop related files
+%{system_root_datadir}/applications/%{name}.desktop
+%{system_root_datadir}/icons/hicolor/scalable/apps/%{name}.svg
+%{system_root_datadir}/appdata/%{name}.appdata.xml
 %config(noreplace) %{_sysconfdir}/%{pkg_name}/plugins.d
 %config(noreplace) %{_sysconfdir}/%{pkg_name}/ssl.properties
 %config %{_sysconfdir}/%{pkg_name}/commands
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/distribution/packaging/shared/desktop/thermostat.appdata.xml	Tue Sep 20 14:44:23 2016 +0200
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2012-2016 Red Hat, Inc.
+
+ This file is part of Thermostat.
+
+ Thermostat is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ Thermostat is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Thermostat; see the file COPYING.  If not see
+ <http://www.gnu.org/licenses/>.
+
+ Linking this code with other modules is making a combined work
+ based on this code.  Thus, the terms and conditions of the GNU
+ General Public License cover the whole combination.
+
+ As a special exception, the copyright holders of this code give
+ you permission to link this code with independent modules to
+ produce an executable, regardless of the license terms of these
+ independent modules, and to copy and distribute the resulting
+ executable under terms of your choice, provided that you also
+ meet, for each linked independent module, the terms and conditions
+ of the license of that module.  An independent module is a module
+ which is not derived from or based on this code.  If you modify
+ this code, you may extend this exception to your version of the
+ library, but you are not obligated to do so.  If you do not wish
+ to do so, delete this exception statement from your version.
+
+-->
+<application>
+ <id type="desktop">${pkg_name}.desktop</id>
+ <metadata_license>CC-BY-SA-3.0</metadata_license>
+ <project_license>GPL-2.0-with-classpath-exception</project_license>
+ <name>Thermostat</name>
+ <translation type="gettext">${pkg_name}</translation>
+ <summary>Serviceability and Monitoring for OpenJDK</summary>
+ <description>
+  <p>Thermostat is an instrumentation tool for the Hotspot JVM,
+     with support for monitoring multiple JVM instances on multiple hosts,
+     optionally in a cloud environment.
+  </p>
+  <p>
+     The name Thermostat is intended as a play on words: Thermostat is to Hotspot much as IcedTea is to Java.</p>
+ </description>
+ <screenshots>
+  <screenshot type="default">
+   <image>http://icedtea.classpath.org/thermostat/img/screenshot1.png</image>
+   <caption>Examine memory regions and their sizes</caption>
+  </screenshot>
+  <screenshot type="default">
+   <image>http://icedtea.classpath.org/thermostat/img/screenshot2.png</image>
+   <caption>Visualize thread states</caption>
+  </screenshot>
+  <screenshot type="default">
+   <image>http://icedtea.classpath.org/thermostat/img/screenshot3.png</image>
+   <caption>Dump, browse and search the Java heap</caption>
+  </screenshot>
+ </screenshots>
+ <url type="homepage">http://icedtea.classpath.org/thermostat</url>
+ <updatecontact>sgehwolf@redhat.com</updatecontact>
+ <kudos>
+  <kudo>HiDpiIcon</kudo>
+ </kudos>
+</application>
--- a/distribution/packaging/shared/desktop/thermostat.desktop	Tue Sep 20 10:03:56 2016 +0200
+++ b/distribution/packaging/shared/desktop/thermostat.desktop	Tue Sep 20 14:44:23 2016 +0200
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Version=1.0
 Type=Application
-Name=Thermostat
+Name=${thermostat.desktop.app.name}
 Comment=A monitoring and serviceability tool for OpenJDK
-Exec=${thermostat.home}/bin/thermostat gui
-Icon=thermostat
+Exec=${thermostat.home}/bin/thermostat local
+Icon=${pkg_name}
--- a/pom.xml	Tue Sep 20 10:03:56 2016 +0200
+++ b/pom.xml	Tue Sep 20 14:44:23 2016 +0200
@@ -139,6 +139,8 @@
          under when run via systemd. -->
     <thermostat.system.user>thermostat</thermostat.system.user>
     <thermostat.system.group>thermostat</thermostat.system.group>
+    <thermostat.desktop.app.name>Thermostat</thermostat.desktop.app.name>
+    <pkg_name>thermostat</pkg_name>
     <!-- directory into which the exploded web archive should be deployed to -->
     <thermostat.web.deploy.dir>${thermostat.build.directory}/${project.build.finalName}</thermostat.web.deploy.dir>
     <java.dir>/usr/share/java</java.dir>
@@ -584,4 +586,4 @@
     <url>http://icedtea.classpath.org/hg/thermostat</url>
   </scm>
 
-</project>
\ No newline at end of file
+</project>