Blob Blame History Raw
%global _version %(echo %version | tr . -)

# whether to run jUnit tests, caution: takes horribly long
# currently disabled as the tests fail, filed in upstream's bugtracker:
# https://sourceforge.net/tracker2/?func=detail&aid=2648813&group_id=5091&atid=105091
# %%global _with_tests 1
%bcond_with _tests

Name:          weka
Version:       3.6.14
Release:       11%{?dist}
Summary:       Waikato Environment for Knowledge Analysis
License:       GPLv2+
URL:           http://www.cs.waikato.ac.nz/ml/%{name}/
Source0:       http://downloads.sourceforge.net/weka/%{name}-%{_version}.zip
Source1:       weka.desktop
Source2:       weka.appdata.xml

BuildArch:     noarch

BuildRequires: desktop-file-utils
BuildRequires: ImageMagick
BuildRequires: libappstream-glib
BuildRequires: maven-local
BuildRequires: mvn(java_cup:java_cup)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)

# Other runtime dependencies
Requires:      hsqldb
Requires:      java >= 1:1.6.0
Requires:      javasqlite
Requires:      libsvm-java
Requires:      mysql-connector-java
Requires:      postgresql-jdbc
# Explicit requires for javapackages-tools since weka script
# uses /usr/share/java-utils/java-functions
Requires:      javapackages-tools

%description
Weka is a collection of machine learning algorithms for data mining tasks.
The algorithms can either be applied directly to a data-set or called from
your own Java code. Weka contains tools for data pre-processing, 
classification, regression, clustering, association rules, and visualization.
It is also well-suited for developing new machine learning schemes.

%package javadoc
Summary:       Javadoc for %{name}

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

%prep
%setup -q -n %{name}-%{_version}

# extract the sources jar
%jar -xf %{name}-src.jar

# remove prebuilt jars
find -name '*.jar' -delete -o -name '*.class' -delete
rm -r doc wekaexamples.zip

%pom_xpath_set pom:project/pom:artifactId %{name}
%pom_xpath_set pom:project/pom:version %{version}

# Use default maven setting
%pom_xpath_remove pom:project/pom:build/pom:directory
%pom_xpath_remove pom:outputDirectory
%pom_xpath_remove pom:testOutputDirectory

# Unneeded tasks
%pom_remove_plugin :maven-source-plugin
%pom_xpath_remove "pom:plugin[pom:artifactId='maven-javadoc-plugin']/pom:executions"
# Disable doclint problems
%pom_xpath_inject "pom:plugin[pom:artifactId='maven-javadoc-plugin']/pom:configuration" "<additionalparam>-Xdoclint:none</additionalparam>"

# Fix dependency
%pom_change_dep net.sf.squirrel-sql.thirdparty-non-maven:java-cup java_cup:java_cup

# Fix non ASCII chars
for s in src/main/java/weka/gui/HierarchyPropertyParser.java;do
  native2ascii -encoding UTF8 ${s} ${s}
done

# fix incorrect-fsf-address
sed -i "s,59 Temple Place,51 Franklin Street,;s,Suite 330,Fifth Floor,;s,02111-1307,02110-1301," COPYING

# Install jar in proper location
%mvn_file nz.ac.waikato.cms.%{name}:%{name} %{name}
%mvn_alias nz.ac.waikato.cms.%{name}:%{name} :%{name}-dev :%{name}-stable

%build

%if %{without _tests}
opts="-f" 
%endif
%mvn_build $opts

%install
%mvn_install

# wrapper script
%jpackage_script weka.gui.GUIChooser "" "" %{name}:java_cup:libsvm:hsqldb:../../javasqlite/sqlite.jar:mysql-connector-java:postgresql %{name} true

# desktop file and icon
desktop-file-install \
--dir=%{buildroot}%{_datadir}/applications %{SOURCE1}

# install icons
convert %{name}.ico %{name}.png
for p in 32x32 64x64 128x128 256x256; do
    mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${p}/apps
    convert src/main/java/weka/gui/%{name}_icon_new.png -resize ${p} \
        %{buildroot}%{_datadir}/icons/hicolor/${p}/apps/%{name}.png
done
install -Dp src/main/java/weka/gui/%{name}_icon_new.png \
 %{buildroot}%{_datadir}/icons/hicolor/457x457/apps/%{name}.png

# appdata 6652 Segmentation fault      (core dumped)
#install -Dp %%{SOURCE2} %%{buildroot}%%{_datadir}/appdata/%%{name}.appdata.xml
#appstream-util validate-relax --nonet %%{buildroot}%%{_datadir}/appdata/%%{name}.appdata.xml

%files -f .mfiles
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*x*/apps/%{name}.png
#%%{_datadir}/appdata/%%{name}.appdata.xml
%doc documentation.html documentation.css
%doc README WekaManual.pdf changelogs data
%license COPYING

%files javadoc -f .mfiles-javadoc
%license COPYING

%changelog
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.14-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.14-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Aug 31 2018 Severin Gehwolf <sgehwolf@redhat.com> - 3.6.14-9
- Add explicit javapackages-tools requirement for weka script.
  See RHBZ#1600426.

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.14-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.14-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jan 18 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.6.14-6
- Remove obsolete scriptlets

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.14-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.14-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Sun Nov 06 2016 gil cattaneo <puntogil@libero.it> 3.6.14-3
- Rebuilt for exculde ppc ppc64 arches

* Thu Jul 21 2016 gil cattaneo <puntogil@libero.it> 3.6.14-2
- remove appdata
- update launcher script with new postgresql-jdbc

* Sat May 28 2016 gil cattaneo <puntogil@libero.it> 3.6.14-1
- update to 3.6.14

* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Oct 14 2015 gil cattaneo <puntogil@libero.it> 3.6.13-1
- update to 3.6.13
- add launcher script using %%jpackage_script
- include appdata

* Mon Oct 12 2015 gil cattaneo <puntogil@libero.it> 3.6.8-6
- switch to maven
- introduce license macro
- adapt to current guideline
- remove some rpmlint problems

* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sun Aug 19 2012 Miloš Jakubíček <xjakub@fi.muni.cz> - 3.6.8-1
- Update to 3.6.8

* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Jul 10 2012 Miloš Jakubíček <xjakub@fi.muni.cz> - 3.6.7-1
- Update to 3.6.7

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon May 03 2010 Miloš Jakubíček <xjakub@fi.muni.cz> - 3.6.2-4
- Fix typo causing $CLASSPATH in %%{_bindir}/weka to be expanded during the build

* Fri Apr 30 2010 Miloš Jakubíček <xjakub@fi.muni.cz> - 3.6.2-3
- java_cup, hsqldb, postgresql-jdbc, mysql-connector-java, sqlite added to CLASSPATH and required
  (resolve BZ#587596)

* Wed Mar 03 2010 Miloš Jakubíček <xjakub@fi.muni.cz> - 3.6.2-2
- Added Requires: libsvm-java (BZ#523684)

* Sat Jan 16 2010 Milos Jakubicek <xjakub@fi.muni.cz> - 3.6.2-1
- Update to 3.6.2
- Fix libsvm usage (resolves BZ#523684)
- Fix removing jars
- Added BR: jflex, java_cup >= 1:0.11a

* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat Feb 28 2009 Milos Jakubicek <xjakub@fi.muni.cz> - 3.6.0-3
- Fixed desktop file name
- Added optional running junit tests into %%check, added BR:junit
- Fixed changelog entry

* Wed Feb 25 2009 Milos Jakubicek <xjakub@fi.muni.cz> - 3.6.0-2
- Running gtk-update-icon-cache
- Converting icon to png, added BR:ImageMagick, changed icon path 
  in desktop file "weka" only
- java/java-devel R: and BR: made versioned to >= 1:1.6.0
- removed vendor tag in desktop-file-install according to the guidelines
  for new packages.

* Wed Jan 14 2009 Milos Jakubicek <xjakub@fi.muni.cz> - 3.6.0-1
- Initial release.