File jakarta-commons-vfs.spec of Package jakarta-commons-vfs

#
# spec file for package jakarta-commons-vfs
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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}}
%define _without_maven 1
%bcond_with             maven
%define section   free
%define base_name commons-vfs

Name:           jakarta-commons-vfs
Version:        1.0
Release:        0
Summary:        Commons Virtual Filesystem
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            http://jakarta.apache.org/commons/vfs/
# svn export http://svn.apache.org/repos/asf/jakarta/commons/proper/vfs/tags/vfs-1.0/
Source0:        commons-vfs-1.0-src.tar.bz2
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        commons-vfs-1.0-jpp-depmap.xml
Source5:        commons-build.tar.bz2
Source6:        build.xml
Source7:        maven-build.xml
Source8:        core-build.xml
Source9:        core-maven-build.xml
Source10:       examples-build.xml
Source11:       examples-maven-build.xml
Source12:       sandbox-build.xml
Source13:       sandbox-maven-build.xml
Patch0:         commons-vfs-1.0-project_properties.patch
Patch1:         commons-vfs-1.0-jakarta-commons-httpclient-3.1.patch
Requires:       jaf_1_1_api
Requires:       jakarta-commons-codec
Requires:       jakarta-commons-collections
Requires:       jakarta-commons-compress
Requires:       jakarta-commons-httpclient3
Requires:       jakarta-commons-logging
Requires:       jakarta-commons-net
Requires:       jakarta-slide-webdavclient
Requires:       javamail_1_4_api
Requires:       jcifs
Requires:       jdom
Requires:       jsch
Requires:       oro
Requires:       xml-commons-apis
Requires(post): javapackages-tools
Requires(postun): javapackages-tools
BuildRequires:  javapackages-tools
BuildRequires:  junit
%if %with maven
BuildRequires:  maven >= 1.1
BuildRequires:  saxon
BuildRequires:  saxon-scripts
%else
BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit
%endif
BuildRequires:  jaf_1_1_api
BuildRequires:  jakarta-commons-codec
BuildRequires:  jakarta-commons-collections
BuildRequires:  jakarta-commons-compress
BuildRequires:  jakarta-commons-httpclient3
BuildRequires:  jakarta-commons-logging
BuildRequires:  jakarta-commons-net
BuildRequires:  jakarta-slide-webdavclient
BuildRequires:  javamail_1_4_api
BuildRequires:  jcifs
BuildRequires:  jdom
BuildRequires:  jsch
BuildRequires:  oro
BuildRequires:  xml-commons-apis
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Commons VFS provides a single API for accessing various different
   file systems. It presents a uniform view of the files from
   various different sources, such as the files on local disk, on an
   HTTP server, or inside a Zip archive. Some of the features of
   Commons VFS are: * A single consistent API for accessing files of
   different types.

* Support for numerous file system types.

* Caching of file information. Caches information in-JVM, and
   optionally can cache remote file information on the local file
   system.

* Event delivery.

* Support for logical file systems made up of files from various
   different file systems.

* Utilities for integrating Commons VFS into applications, such as a
   VFS-aware ClassLoader and URLStreamHandlerFactory.

* A set of VFS-enabled Ant tasks.



%package javadoc
Summary:        Commons Virtual Filesystem
Group:          Development/Libraries/Java

%description javadoc
Commons VFS provides a single API for accessing various different
   file systems. It presents a uniform view of the files from
   various different sources, such as the files on local disk, on an
   HTTP server, or inside a Zip archive. Some of the features of
   Commons VFS are: * A single consistent API for accessing files of
   different types.

* Support for numerous file system types.

* Caching of file information. Caches information in-JVM, and
   optionally can cache remote file information on the local file
   system.

* Event delivery.

* Support for logical file systems made up of files from various
   different file systems.

* Utilities for integrating Commons VFS into applications, such as a
   VFS-aware ClassLoader and URLStreamHandlerFactory.

* A set of VFS-enabled Ant tasks.



%package manual
Summary:        Commons Virtual Filesystem
Group:          Development/Libraries/Java

%description manual
Commons VFS provides a single API for accessing various different
   file systems. It presents a uniform view of the files from
   various different sources, such as the files on local disk, on an
   HTTP server, or inside a Zip archive. Some of the features of
   Commons VFS are: * A single consistent API for accessing files of
   different types.

* Support for numerous file system types.

* Caching of file information. Caches information in-JVM, and
   optionally can cache remote file information on the local file
   system.

* Event delivery.

* Support for logical file systems made up of files from various
   different file systems.

* Utilities for integrating Commons VFS into applications, such as a
   VFS-aware ClassLoader and URLStreamHandlerFactory.

* A set of VFS-enabled Ant tasks.



%prep
%setup -q -n vfs-%{version}
%setup -q -T -D -a 5 -n vfs-%{version}
%patch0 -p0
%patch1 -p1
find . -name "*.jar" | xargs -t rm
%if %without maven
cp -p %{SOURCE6} %{SOURCE7} .
cp -p %{SOURCE8} core/build.xml
cp -p %{SOURCE9} core/maven-build.xml
cp -p %{SOURCE10} examples/build.xml
cp -p %{SOURCE11} examples/maven-build.xml
cp -p %{SOURCE12} sandbox/build.xml
cp -p %{SOURCE13} sandbox/maven-build.xml
%else
export DEPCAT=$(pwd)/commons-vfs-1.0-depcat.new.xml
echo '<?xml version="1.0" standalone="yes"?>' > $DEPCAT
echo '<depset>' >> $DEPCAT
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    %{_bindir}/saxon project.xml %{SOURCE1} >> $DEPCAT
    popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
%{_bindir}/saxon $DEPCAT %{SOURCE2} > commons-vfs-1.0-depmap.new.xml
%endif

%build
%if %with maven
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    cp project.xml project.xml.orig
    %{_bindir}/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
    popd
done
maven \
    -Dmaven.repo.remote=file:%{_datadir}/maven/repository \
    -Dmaven.javadoc.source=1.4 \
    -Dmaven.home.local=$(pwd)/.maven \
    -Dmaven.test.error.ignore=true \
    jar javadoc xdoc:transform 
%else
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL
export CLASSPATH=$(build-classpath commons-collections commons-httpclient3 commons-logging commons-net jaf_1_1_api javamail_1_4_api jcifs jdom jsch junit slide/jakarta-slide-webdavlib):`pwd`/target/commons-vfs-%{version}.jar:`pwd`/target/test-classes
export OPT_JAR_LIST="junit ant/ant-junit"
%{ant} \
    -Dmaven.build.dir=`pwd`/target \
    -Dmaven.build.outputDir=`pwd`/target \
    -Dmaven.mode.offline=true \
    -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
    -Dmaven.repo.remote=file:%{_datadir}/maven/repository \
    -Dmaven.javadoc.source=1.4 \
    -Dmaven.home.local=$(pwd)/.maven \
    -Dmaven.test.skip=true \
    -Dmaven.test.error.ignore=true \
    package javadoc 
%endif

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 target/%{base_name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in jakarta-*; do \
ln -sf ${jar} ${jar/jakarta-/}; done)

#pom
mkdir -p %{buildroot}%{_mavenpomdir}
install -m 0644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap

# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%if %with maven
cp -pr target/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
# FIXME: (dwalluck): breaks --short-circuit
rm -rf target/docs/apidocs
%else
cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
rm -rf target/site/apidocs
%endif
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%if %with maven
## manual
cp -pr target/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
find $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} -name "*.sav" -exec rm {} \;
%endif

%files
%defattr(0644,root,root,0755)
%doc *.txt
%{_javadir}/*
%{_mavenpomdir}/*
%config %{_mavendepmapfragdir}/*

%files manual
%defattr(0644,root,root,0755)
%{_docdir}/%{name}-%{version}

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

%changelog
openSUSE Build Service is sponsored by