hsqldb/hsqldb.spec

219 lines
6.8 KiB
RPMSpec
Raw Permalink Normal View History

%global pomversion 2.3.0
Name: hsqldb
Version: 2.3.1
2017-02-17 10:20:45 +03:00
Release: 5
Epoch: 1
Summary: HyperSQL Database Engine
License: BSD
URL: http://hsqldb.sourceforge.net/
Group: Databases
BuildArch: noarch
Source0: http://downloads.sourceforge.net/hsqldb/%{name}-%{version}.zip
Source1: %{name}-1.8.0-standard.cfg
Source2: %{name}-1.8.0-standard-server.properties
Source3: %{name}-1.8.0-standard-webserver.properties
Source4: %{name}-1.8.0-standard-sqltool.rc
Source5: http://www.hsqldb.org/repos/org/hsqldb/hsqldb/%{pomversion}/hsqldb-%{pomversion}.pom
# Custom systemd files - talking with upstream about incorporating them, see
# http://sourceforge.net/projects/hsqldb/forums/forum/73673/topic/5367103
Source6: %{name}.systemd
Source7: %{name}-wrapper
Source8: %{name}-post
Source9: %{name}-stop
# Javadoc fails to create since apidocs folder is deleted and not recreated
Patch0: %{name}-apidocs.patch
# Package org.hsqldb.cmdline was only compiled with java 1.5
Patch1: %{name}-cmdline.patch
2012-02-01 14:20:01 +04:00
BuildRequires: ant
2012-04-04 13:08:28 +04:00
BuildRequires: jpackage-utils >= 0:1.5
BuildRequires: junit
BuildRequires: systemd-units
2016-03-16 11:38:26 +03:00
BuildRequires: servlet6
Requires: java
2016-03-16 11:38:26 +03:00
Requires: servlet6
Requires(pre): shadow-utils
Requires(post): systemd
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
2012-02-01 14:20:01 +04:00
%description
HSQLdb is a relational database engine written in JavaTM , with a JDBC
driver, supporting a subset of ANSI-92 SQL. It offers a small (about
100k), fast database engine which offers both in memory and disk based
tables. Embedded and server modes are available. Additionally, it
includes tools such as a minimal web server, in-memory query and
management tools (can be run as applets or servlets, too) and a number
of demonstration examples.
Downloaded code should be regarded as being of production quality. The
product is currently being used as a database and persistence engine in
many Open Source Software projects and even in commercial projects and
products! In it's current version it is extremely stable and reliable.
It is best known for its small size, ability to execute completely in
memory and its speed. Yet it is a completely functional relational
database management system that is completely free under the Modified
BSD License. Yes, that's right, completely free of cost or restrictions!
2012-04-04 13:08:28 +04:00
%package manual
Summary: Manual for %{name}
2012-04-04 13:08:28 +04:00
%description manual
Documentation for %{name}.
%package javadoc
Summary: Javadoc for %{name}
2012-04-04 13:08:28 +04:00
Requires: jpackage-utils
%description javadoc
Javadoc for %{name}.
%package demo
Summary: Demo for %{name}
2012-04-04 13:08:28 +04:00
Requires: %{name} = %{epoch}:%{version}-%{release}
%description demo
Demonstrations and samples for %{name}.
2012-02-01 14:20:01 +04:00
%prep
%setup -q -n %{name}-%{version}/%{name}
2012-02-01 14:20:01 +04:00
# set right permissions
find . -name "*.sh" -exec chmod 755 \{\} \;
# remove all _notes directories
for dir in `find . -name _notes`; do rm -rf $dir; done
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
find . -name "*.class" -exec rm -f {} \;
find . -name "*.war" -exec rm -f {} \;
# correct silly permissions
chmod -R go=u-w *
# Fix doc location
sed -i -e 's/doc-src/doc/g' build/build.xml
2012-02-01 14:20:01 +04:00
%patch0 -p1
%patch1 -p1
2012-02-01 14:20:01 +04:00
%build
export CLASSPATH=$(build-classpath \
2016-03-16 11:38:26 +03:00
tomcat-servlet-api \
2012-02-01 14:20:01 +04:00
junit)
pushd build
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
2016-03-16 11:38:26 +03:00
ant hsqldb
2012-02-01 14:20:01 +04:00
popd
%install
# jar
install -d -m 755 %{buildroot}%{_javadir}
install -m 644 lib/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar
2012-02-01 14:20:01 +04:00
# bin
install -d -m 755 %{buildroot}%{_bindir}
# systemd
install -d -m 755 %{buildroot}%{_unitdir}
install -d -m 755 %{buildroot}%{_prefix}/lib/%{name}
install -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}.service
install -m 755 %{SOURCE7} %{buildroot}%{_prefix}/lib/%{name}/%{name}-wrapper
install -m 755 %{SOURCE8} %{buildroot}%{_prefix}/lib/%{name}/%{name}-post
install -m 755 %{SOURCE9} %{buildroot}%{_prefix}/lib/%{name}/%{name}-stop
2012-02-01 14:20:01 +04:00
# config
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
2012-02-01 14:20:01 +04:00
# serverconfig
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}
install -m 644 %{SOURCE2} %{buildroot}%{_localstatedir}/lib/%{name}/server.properties
install -m 644 %{SOURCE3} %{buildroot}%{_localstatedir}/lib/%{name}/webserver.properties
install -m 600 %{SOURCE4} %{buildroot}%{_localstatedir}/lib/%{name}/sqltool.rc
2012-02-01 14:20:01 +04:00
# lib
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}/lib
2012-02-01 14:20:01 +04:00
# javadoc
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -r doc/apidocs/* %{buildroot}%{_javadocdir}/%{name}
# data
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}/data
2012-02-01 14:20:01 +04:00
# manual
install -d -m 755 %{buildroot}%{_docdir}/%{name}-%{version}
cp -r doc/* %{buildroot}%{_docdir}/%{name}-%{version}
cp index.html %{buildroot}%{_docdir}/%{name}-%{version}
2012-02-01 14:20:01 +04:00
cd ..
2012-04-04 13:08:28 +04:00
# Maven metadata
install -pD -T -m 644 %{SOURCE5} %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
# %add_maven_depmap
2012-04-04 13:08:28 +04:00
%add_to_maven_depmap %{name} %{name} %{version} JPP %{name}
pushd %{buildroot}%{_localstatedir}/lib/%{name}/lib
# build-classpath can not be used as the jar is not
# yet present during the build
ln -s %{_javadir}/hsqldb.jar hsqldb.jar
2016-03-16 11:38:26 +03:00
ln -s $(build-classpath tomcat-servlet-api) servlet.jar
2012-04-04 13:08:28 +04:00
popd
2012-02-01 14:20:01 +04:00
2012-04-04 13:08:28 +04:00
%preun
%systemd_preun hsqldb.service
2012-02-01 14:20:01 +04:00
2012-04-04 13:08:28 +04:00
%pre
2012-02-01 14:20:01 +04:00
# Add the "hsqldb" user and group
# we need a shell to be able to use su - later
2012-04-04 13:08:28 +04:00
%{_sbindir}/groupadd -g 96 -f -r %{name} 2> /dev/null || :
%{_sbindir}/useradd -u 96 -g %{name} -s /sbin/nologin \
-d %{_localstatedir}/lib/%{name} -r %{name} 2> /dev/null || :
2012-02-01 14:20:01 +04:00
%post
%systemd_post hsqldb.service
2012-02-01 14:20:01 +04:00
%postun
%systemd_postun_with_restart hsqldb.service
2012-04-04 13:08:28 +04:00
%triggerun -- hsqldb < 1.8.1.3-9
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply httpd
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save hsqldb >/dev/null 2>&1 ||:
# If the package is allowed to autostart:
/bin/systemctl --no-reload enable hsqldb.service >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del hsqldb >/dev/null 2>&1 || :
/bin/systemctl try-restart hsqldb.service >/dev/null 2>&1 || :
2012-02-01 14:20:01 +04:00
%files
2012-04-04 13:08:28 +04:00
%defattr(-,root,root,-)
2012-02-01 14:20:01 +04:00
%{_javadir}/*
2012-04-04 13:08:28 +04:00
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_unitdir}/%{name}.service
%{_prefix}/lib/%{name}/%{name}-wrapper
%{_prefix}/lib/%{name}/%{name}-post
%{_prefix}/lib/%{name}/%{name}-stop
2012-04-04 13:08:28 +04:00
%attr(0700,hsqldb,hsqldb) %{_localstatedir}/lib/%{name}/data
2012-02-01 14:20:01 +04:00
%{_localstatedir}/lib/%{name}/lib
2012-04-04 13:08:28 +04:00
%{_localstatedir}/lib/%{name}/server.properties
%{_localstatedir}/lib/%{name}/webserver.properties
2012-02-01 14:20:01 +04:00
%attr(0600,hsqldb,hsqldb) %{_localstatedir}/lib/%{name}/sqltool.rc
%dir %{_localstatedir}/lib/%{name}
2012-04-04 13:08:28 +04:00
%{_mavendepmapfragdir}/*
%{_mavenpomdir}/*
2012-02-01 14:20:01 +04:00
%files manual
%doc %{_docdir}/%{name}-%{version}
%files javadoc
%doc %{_javadocdir}/%{name}
2012-02-01 14:20:01 +04:00
%files demo