Blob Blame History Raw
%define base_name  validator
%define short_name commons-%{base_name}
%define name       jakarta-%{short_name}
%define section    free
%define with_tests %{?_with_tests:1}%{!?_without_tests:0}

Summary:        Jakarta Commons Validator
Name:           %{name}
Version:        1.1.3
Release:        1jpp_2fc
Epoch:          0
License:        Apache Software License
Group:          Development/Libraries/Java
Source0:        commons-validator-%{version}-src-RHCLEAN.tar.bz2
Source1:        %{name}.catalog
# FIXME DTDs are not in the source tarball anymore (conf directory missing)
Source2:        commons-validator-%{version}-conf.tar.gz
Patch1:         jakarta-commons-validator-%{version}-build.patch
URL:            http://jakarta.apache.org/commons/validator/
BuildRequires:  jpackage-utils >= 0:1.5
BuildRequires:  ant >= 1.6.2
BuildRequires:  jakarta-commons-beanutils >= 0:1.5
BuildRequires:  jakarta-commons-collections >= 0:2.1
BuildRequires:  jakarta-commons-digester >= 0:1.3
BuildRequires:  jakarta-commons-logging >= 0:1.0.2
BuildRequires:  oro >= 0:2.0.6
BuildRequires:  junit >= 0:3.7
BuildRequires:  xml-commons-apis
Requires:       jakarta-commons-beanutils >= 0:1.5
Requires:       jakarta-commons-collections >= 0:2.1
Requires:       jakarta-commons-digester >= 0:1.3
Requires:       jakarta-commons-logging >= 0:1.0.2
Requires:       oro >= 0:2.0.6
Requires:       xml-commons-apis
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot

%description
A common issue when receiving data either electronically or from user
input is verifying the integrity of the data. This work is repetitive
and becomes even more complicated when different sets of validation
rules need to be applied to the same set of data based on locale for
example. Error messages may also vary by locale. This package attempts
to address some of these issues and speed development and maintenance
of validation rules.

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

%description javadoc
Javadoc for %{name}.

# -----------------------------------------------------------------------------

%prep
%setup -q -n %{short_name}-%{version}
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;

tar xzvf %{SOURCE2}

cp -p %{SOURCE1} conf/share/catalog

%patch1

# -----------------------------------------------------------------------------

%build
export CLASSPATH=$(build-classpath \
xml-commons-apis oro junit jakarta-commons-logging jakarta-commons-digester \
jakarta-commons-beanutils jakarta-commons-collections)

%if %{with_tests}
ant -Dbuild.sysclasspath=first test
%endif

ant -Dbuild.sysclasspath=first dist

# -----------------------------------------------------------------------------

%install
rm -rf $RPM_BUILD_ROOT

# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p dist/%{short_name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|jakarta-||g"`; done)
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)

# dtds and catalog
mkdir -p $RPM_BUILD_ROOT%{_datadir}/sgml/%{name}
cp -p conf/share/{*.dtd,catalog} $RPM_BUILD_ROOT%{_datadir}/sgml/%{name}

# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}

# -----------------------------------------------------------------------------

%clean
rm -rf $RPM_BUILD_ROOT

# -----------------------------------------------------------------------------

%post
# Note that we're using versioned catalog, so this is always ok.
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
  %{_bindir}/install-catalog --add \
    %{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \
    %{_datadir}/sgml/%{name}/catalog > /dev/null || :
fi

%postun
# Note that we're using versioned catalog, so this is always ok.
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
  %{_bindir}/install-catalog --remove \
    %{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \
    %{_datadir}/sgml/%{name}/catalog > /dev/null || :
fi

# -----------------------------------------------------------------------------

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt NOTICE.txt
%{_javadir}/*
%{_datadir}/sgml/%{name}

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

# -----------------------------------------------------------------------------

%changelog
* Tue Jun 21 2005 Gary Benson <gbenson@redhat.com> - 0:1.1.3-1jpp_2fc
- Remove jarfile from the tarball.

* Thu Jan 20 2005 Gary Benson <gbenson@redhat.com> - 0:1.1.3-1jpp_1fc
- Build into Fedora.

* Fri Nov 26 2004 Fernando Nasser <fnasser@redhat.com> 0:1.1.3-1jpp_1rh
- Merge with upstream for upgrade

* Tue Sep 07 2004 Fernando Nasser <fnasser at redhat.com> - 0:1.1.3-1jpp
- Upgrade to 1.1.3

* Sun Aug 23 2004 Randy Watler <rwatler at finali.com> - 0:1.0.2-3jpp
- Rebuild with ant-1.6.2

* Thu Mar  4 2004 Frank Ch. Eigler <fche@redhat.com> 0:4.1.29-2jpp_1rh
- RH vacuuming

* Fri Apr 18 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:1.0.2-2jpp
- Move DTDs from %%{_datadir}/%{name} to %%{_datadir}/sgml/%%{name} for FHS
  compliance, <http://www.pathname.com/fhs/2.2/fhs-4.11.html#4.11.7>.

* Fri Apr 18 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:1.0.2-1jpp
- Update to 1.0.2 and JPackage 1.5.
- Move DTDs from %%doc to %%{_datadir}/%%{name}.
- Include catalog for DTDs, and install it if %%{_bindir}/install-catalog
  is available.

* Mon Dec 16 2002 Ville Skyttä <ville.skytta at iki.fi> - 1.0.1-1jpp
- 1.0.1.
- Include the DTD in the package (as documentation).

* Sat Nov  2 2002 Ville Skyttä <ville.skytta at iki.fi> - 1.0-1jpp
- 1.0, initial JPackage release.