##
## jira.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2022 OpenPKG Project
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_jira 8.13.0
%define V_jdbc_mysql 5.1.49
%define V_jdbc_pgsql 42.2.18
# package information
Name: jira
Summary: Issue Tracking System
URL: https://www.atlassian.com/software/jira
Vendor: Atlassian
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: Ticketing
License: Commercial
Version: %{V_jira}
Release: 20201015
# package options
%option with_mysql no
%option with_pgsql no
# package source
Source0: http://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-%{V_jira}.tar.gz
Source1: http://ftp.gwdg.de/pub/misc/mysql/Downloads/Connector-J/mysql-connector-java-%{V_jdbc_mysql}.tar.gz
Source2: http://jdbc.postgresql.org/download/postgresql-%{V_jdbc_pgsql}.jar
Source3: rc.jira
Source4: jira-setup.sh
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101
PreReq: java, JAVA-JDK
%if "%{with_mysql}" == "yes"
PreReq: mysql
%endif
%if "%{with_pgsql}" == "yes"
PreReq: postgresql
%endif
%description
JIRA is the tracker for teams planning and building great products.
Thousands of teams choose JIRA to capture and organize issues,
assign work, and follow team activity. At your desk or on the go
with the new mobile interface, JIRA helps your team get the job
done.
%track
prog jira:jira = {
version = %{V_jira}
url = https://www.atlassian.com/software/jira/download
regex = atlassian-jira-software-(__VER__)\.tar\.gz
}
prog jira:jdbc-mysql = {
version = %{V_jdbc_mysql}
url = http://dev.mysql.com/downloads/connector/j/5.1.html
regex = mysql-connector-java-(__VER__)\.tar\.gz
}
prog jira:jdbc-pgsql = {
version = %{V_jdbc_pgsql}
url = https://jdbc.postgresql.org/download.html
regex = postgresql-(\d+\.\d+\.\d+)\.jar
}
%prep
%setup -q -n atlassian-jira-software-%{V_jira}-standalone
%setup -q -n atlassian-jira-software-%{V_jira}-standalone -T -D -a 1
%build
# remove useless empty files
find . -name ".gitkeep" -print | xargs rm -f
find . -name ".emptydir" -print | xargs rm -f
%install
# create installation directories
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/data \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/etc/jira \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/libexec/jira \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/licenses \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/tmp \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/run \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/log \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/webapps \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/external-source \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/work \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/db
# install product parts
cp -r lib bin atlassian-jira tomcat-docs \
$RPM_BUILD_ROOT%{l_prefix}/libexec/jira/
cp -r external-source webapps \
$RPM_BUILD_ROOT%{l_prefix}/var/jira/
# install configuration files
cp -r conf/* \
$RPM_BUILD_ROOT%{l_prefix}/etc/jira/
%{l_shtool} subst \
-e 's;\(/dev/null`
[ ".$jira_active" = .yes ] && %{l_rc} jira restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# before erase, stop service and remove log files
%{l_rc} jira stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/jira/log/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/jira/run/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/jira/db/* >/dev/null 2>&1 || true
fi
exit 0