LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File findbugs.spec of Package findbugs (Project Java:packages)

#
# spec file for package findbugs
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2009, JPackage Project
# All rights reserved.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}

%bcond_with bundled_jformatstring

%define section free

Name:           findbugs
Version:        1.3.9
Release:        0
Summary:        Bug Pattern Detector for Java
License:        LGPL-2.1+
Group:          Development/Debug
Url:            http://findbugs.sourceforge.net/
# bnc#569639
# rm src/xsl/fancy.xsl
# rm -rf doc/
Source0:        http://download.sourceforge.net/findbugs/findbugs-%{version}-source-suse.tar.bz2
Source1:        findbugs-script
Source2:        findbugs-16x16.png
Source3:        findbugs-32x32.png
Source4:        findbugs-48x48.png
Source5:        findbugs.desktop
Source6:        findbugs-1.3.9.pom
Source7:        findbugs-annotations-1.3.9.pom
Source8:        findbugs-ant-1.3.9.pom
Source9:        findbugs-coreplugin-1.3.9.pom
Source10:       jFormatString-1.3.9.pom
Source1000:     README.manual
Patch0:         findbugs-build_xml.patch
Patch1:         findbugs-bcel.patch
Patch2:         findbugs-manifest.patch
Requires(post): jpackage-utils >= 1.7.3
Requires(postun): jpackage-utils >= 1.7.3
Requires:       bcel5_3
Requires:       dom4j
Requires:       jakarta-commons-lang >= 2.4
Requires:       java >= 1.6.0
Requires:       jaxen
Requires:       jcip-annotations
Requires:       objectweb-asm >= 3.0
%if %without bundled_jformatstring
Requires:       jformatstring
%endif
Requires:       jpackage-utils >= 1.7.3
Requires:       jsr-305
BuildRequires:  ant >= 1.6.5
BuildRequires:  ant-junit
BuildRequires:  ant-nodeps
BuildRequires:  bcel5_3
BuildRequires:  desktop-file-utils
BuildRequires:  dom4j
BuildRequires:  jakarta-commons-lang >= 2.4
BuildRequires:  java-devel >= 1.6.0
BuildRequires:  jaxen
BuildRequires:  jcip-annotations
BuildRequires:  jdepend
%if %without bundled_jformatstring
BuildRequires:  jformatstring
%endif
BuildRequires:  jpackage-utils >= 1.7.3
BuildRequires:  jsr-305
BuildRequires:  junit4
BuildRequires:  objectweb-asm >= 3.0
%if %{defined suse_version}
BuildRequires:  fdupes
# owns /usr/share/icons/hicolor
BuildRequires:  hicolor-icon-theme
%endif
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
FindBugs is a program to find bugs in Java programs. It looks for 
instances of ``bug patterns''---code instances that are likely to be 
errors.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Documentation/HTML

%description javadoc

%{summary}.

%package manual
Summary:        Documents for %{name}
Group:          Documentation/Other

%description manual

%{summary}.

%prep
%setup -q
%patch0 -p0
%patch1 -p1
%patch2 -p1

%{_bindir}/find . -name "*.bat" | %{_bindir}/xargs -t %{__rm}

%if %with bundled_jformatstring
# FIXME: (dwalluck): standalone source code is at
# <https://jformatstring.dev.java.net/>, but using bundled source
# for now
%{__unzip} -qq -d jFormatString lib/jFormatString.jar
pushd jFormatString/
%{_bindir}/find -name "*.class" | %{_bindir}/xargs -t %{__rm}
%{javac} `%{_bindir}/find -name "*.java"`
%{jar} cfm ../lib/jFormatString.jar.no META-INF/MANIFEST.MF .
popd
%{__rm} -r jFormatString/
%endif

%if %with bundled_jformatstring
%{_bindir}/find -name "*.jar" -and -not -name jFormatString.jar | %{_bindir}/xargs -t %{__rm}
%else
%{_bindir}/find -name "*.jar" | %{_bindir}/xargs -t %{__rm}
%endif

%{__rm} src/java/edu/umd/cs/findbugs/gui/OSXAdapter.java
%{__rm} src/java5/edu/umd/cs/findbugs/gui2/OSXAdapter.java

%{__rm} -r src/java5/net/jcip/annotations

pushd lib
%{__ln_s} $(build-classpath bcel5.3)
%{__ln_s} $(build-classpath commons-lang)
%{__ln_s} $(build-classpath dom4j)
%{__ln_s} $(build-classpath jaxen)
%{__ln_s} $(build-classpath jcip-annotations)
%{__ln_s} $(build-classpath jdepend)
%if %without bundled_jformatstring
%{__ln_s} $(build-classpath jformatstring) jFormatString.jar
%endif
%{__ln_s} $(build-classpath jsr-305)
%{__ln_s} $(build-classpath junit4)
%{__ln_s} $(build-classpath objectweb-asm/asm)
%{__ln_s} $(build-classpath objectweb-asm/asm-commons)
%{__ln_s} $(build-classpath objectweb-asm/asm-tree)
popd

%if 0
# FIXME: setup is monolithic right now, as especially the ant task
# doesn't read the CLASSPATH
%{__perl} -p -i -e 's|^Class-Path:.*\n||g' etc/*.MF
%endif

cp %{SOURCE1000} .

%build
export CLASSPATH=
export OPT_JAR_LIST="`%{__cat} %{_sysconfdir}/ant.d/{junit,nodeps}`"

export ANT_OPTS="-Xss1m"
%{ant} build apiJavadoc runjunit

%install
%{__mkdir_p} %{buildroot}%{_javadir}/%{name}/lib
%{__cp} -p lib/findbugs.jar %{buildroot}%{_javadir}/%{name}/lib/findbugs-%{version}.jar
%{__cp} -p lib/findbugs-ant.jar %{buildroot}%{_javadir}/%{name}/lib/findbugs-ant-%{version}.jar
%{__cp} -p lib/annotations.jar %{buildroot}%{_javadir}/%{name}/lib/annotations-%{version}.jar
%if %with bundled_jformatstring
%{__cp} -p lib/jFormatString.jar %{buildroot}%{_javadir}/%{name}/lib/jFormatString-%{version}.jar
%endif

pushd %{buildroot}%{_javadir}/%{name}/lib
%{__ln_s} $(build-classpath bcel5.3)
%{__ln_s} $(build-classpath commons-lang)
%{__ln_s} $(build-classpath dom4j)
%{__ln_s} $(build-classpath jaxen)
%{__ln_s} $(build-classpath jcip-annotations)
%if %without bundled_jformatstring
%{__ln_s} $(build-classpath jformatstring) jFormatString.jar
%endif
%{__ln_s} $(build-classpath jsr-305)
%{__ln_s} $(build-classpath objectweb-asm/asm)
%{__ln_s} $(build-classpath objectweb-asm/asm-commons)
%{__ln_s} $(build-classpath objectweb-asm/asm-tree)
for jar in *-%{version}*; do %{__ln_s} ${jar} ${jar/-%{version}/}; done
popd

%{__cp} -pr plugin/ %{buildroot}%{_javadir}/%{name}/

%{__mkdir_p} %{buildroot}%{_sysconfdir}/ant.d
%{__cat} > %{buildroot}%{_sysconfdir}/ant.d/%{name} << EOF
findbugs/lib/findbugs findbugs/lib/findbugs-ant
EOF

%{__mkdir_p} %{buildroot}%{_datadir}/maven2/poms
%{__cp} -p %{SOURCE6} %{buildroot}%{_datadir}/maven2/poms/JPP.findbugs.lib-findbugs.pom
%add_to_maven_depmap %{name} %{name} %{version} JPP/%{name}/lib %{name}
%{__cp} -p %{SOURCE7} %{buildroot}%{_datadir}/maven2/poms/JPP.findbugs.lib-annotations.pom
%add_to_maven_depmap %{name} annotations %{version} JPP/%{name}/lib annotations
%{__cp} -p %{SOURCE8} %{buildroot}%{_datadir}/maven2/poms/JPP.findbugs.lib-findbugs-ant.pom
%add_to_maven_depmap %{name} %{name}-ant %{version} JPP/%{name}/lib %{name}-ant
%{__cp} -p %{SOURCE9} %{buildroot}%{_datadir}/maven2/poms/JPP.findbugs.plugin-coreplugin.pom
%add_to_maven_depmap %{name} coreplugin %{version} JPP/%{name}/plugin coreplugin
%{__cp} -p %{SOURCE10} %{buildroot}%{_datadir}/maven2/poms/JPP.findbugs.lib-jFormatString.pom
%add_to_maven_depmap %{name} jFormatString %{version} JPP/%{name}/lib jFormatString

%{__mkdir_p} %{buildroot}%{_bindir}
%{__cp} -p %{SOURCE1} %{buildroot}%{_bindir}/%{name}

%{__mkdir_p} %{buildroot}%{_javadocdir}/%{name}-%{version}
# FIXME: (dwalluck): javadoc (openjdk6) throws NPE
%{__cp} -pr apiJavaDoc/* %{buildroot}%{_javadocdir}/%{name}-%{version} || :
(cd %{buildroot}%{_javadocdir} && %{__ln_s} %{name}-%{version} %{name})

%{__mkdir_p} %{buildroot}%{_datadir}/applications
%{_bindir}/desktop-file-install --vendor jpackage --dir %{buildroot}%{_datadir}/applications %{SOURCE5}
%{__install} -D -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
%{__install} -D -p -m 644 %{SOURCE3} %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%{__install} -D -p -m 644 %{SOURCE4} %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{__install} -D -p -m 644 %{SOURCE4} %{buildroot}%{_datadir}/pixmaps/%{name}.png

%{__mkdir_p} %{buildroot}%{_datadir}/%{name}-%{version}/bin
%{__cp} -pr bin/* %{buildroot}%{_datadir}/%{name}-%{version}/bin/

%if %{defined suse_version}
%fdupes -s %{buildroot}
%endif

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt README.txt design
%dir %{_javadir}/%{name}
%dir %{_javadir}/%{name}/lib
%dir %{_javadir}/%{name}/plugin
%dir %{_datadir}/%{name}-%{version}
%dir %{_datadir}/%{name}-%{version}/bin
%attr(0755,root,root) %{_bindir}/findbugs
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/addMessages
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/computeBugHistory
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/convertXmlToText
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/copyBuggySource
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/defectDensity
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/deprecated/bugHistory
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/deprecated/unionBugs
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/deprecated/unionResults
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/deprecated/updateBugs
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/experimental/churn
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/experimental/treemapVisualization
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/fbwrap
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/filterBugs
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/findbugs
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/findbugs2
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/findbugs-dbStats
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/findbugs-msv
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/listBugDatabaseInfo
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/mineBugHistory
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/printAppVersion
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/printClass
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/rejarForAnalysis
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/setBugDatabaseInfo
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/unionBugs
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/bin/xpathFind
%dir %{_iconsdir}/hicolor/
%{_iconsdir}/hicolor/16x16/apps/findbugs.png
%{_iconsdir}/hicolor/32x32/apps/findbugs.png
%{_iconsdir}/hicolor/48x48/apps/findbugs.png
%{_javadir}/%{name}/lib/annotations-%{version}.jar
%{_javadir}/%{name}/lib/annotations.jar
%{_javadir}/%{name}/lib/asm-commons.jar
%{_javadir}/%{name}/lib/asm-tree.jar
%{_javadir}/%{name}/lib/asm.jar
%{_javadir}/%{name}/lib/bcel5.3.jar
%{_javadir}/%{name}/lib/commons-lang.jar
%{_javadir}/%{name}/lib/dom4j.jar
%{_javadir}/%{name}/lib/findbugs-%{version}.jar
%{_javadir}/%{name}/lib/findbugs-ant-%{version}.jar
%{_javadir}/%{name}/lib/findbugs-ant.jar
%{_javadir}/%{name}/lib/findbugs.jar
%{_javadir}/%{name}/lib/jFormatString.jar
%{_javadir}/%{name}/lib/jaxen.jar
%{_javadir}/%{name}/lib/jcip-annotations.jar
%{_javadir}/%{name}/lib/jsr-305.jar
%doc %{_javadir}/%{name}/plugin/README
%{_datadir}/maven2/poms/JPP.findbugs.lib-annotations.pom
%{_datadir}/maven2/poms/JPP.findbugs.lib-findbugs-ant.pom
%{_datadir}/maven2/poms/JPP.findbugs.lib-findbugs.pom
%{_datadir}/maven2/poms/JPP.findbugs.lib-jFormatString.pom
%{_datadir}/maven2/poms/JPP.findbugs.plugin-coreplugin.pom
%config %{_mavendepmapfragdir}/%{name}
%config %{_sysconfdir}/ant.d/%{name}
%{_datadir}/applications/*%{name}.desktop
#%{_datadir}/icons/*/*/apps/*
%{_datadir}/pixmaps/%{name}.png
%if %{defined suse_version}
%dir %{_datadir}/%{name}-%{version}/bin/deprecated
%dir %{_datadir}/%{name}-%{version}/bin/experimental
%dir %{_datadir}/icons/hicolor
%endif

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}

%files manual
%defattr(0644,root,root,0755)
%doc README.manual

%changelog