File jenkins.spec of Package jenkins

# spec file for package jenkins
# Copyright (c) 2011-2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2011-2012, Sascha Peilicke <>
# 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

Name:           jenkins
Version:        1.621
Release:        0
License:        MIT
Summary:        An extendable open source continuous integration server
Group:          Development/Tools/Building
Source:         jenkins.tar.gz
Source1:        %{name}.init
Source2:        %{name}.sysconfig
Source3:        %{name}.logrotate
BuildRequires:  java-devel
BuildRequires:  jenkins-kit == 7b931a76c6c99b0ecad43b8719c7e39c8ea29ab4
Requires:       java >= 1.7
Provides:       hudson = %{version}
Obsoletes:      hudson < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%if 0%{?suse_version} >= 1010
Suggests:       logrotate
Requires(pre):  pwdutils
Requires(pre):  %fillup_prereq %insserv_prereq

Jenkins-CI monitors executions of repeated jobs, such as building a software
project or jobs run by cron. Among those things, current Jenkins-CI focuses
on the following two jobs:

   1. Building/testing software projects continuously, just like
      CruiseControl or DamageControl. In a nutshell, Jenkins-CI provides an
      easy-to-use so-called continuous integration system, making it
      easier for developers to integrate changes to the project, and
      making it easier for users to obtain a fresh build. The automated,
      continuous build increases the productivity.
   2. Monitoring executions of externally-run jobs, such as cron jobs and
      procmail jobs, even those that are run on a remote machine. For
      example, with cron, all you receive is regular e-mails that capture
      the output, and it is up to you to look at them diligently and notice
      when it broke. Jenkins-CI keeps those outputs and makes it easy for you
      to notice when something is wrong.

%setup -q -c -n src
cp -Rf %{_datadir}/tetra ../kit

p=`readlink -e ..`/kit
cd jenkins/
$p/apache-maven-3.2.5/bin/mvn -Dmaven.repo.local=$p/m2 --settings $p/m2/settings.xml --strict-checksums -o install -DskipTests

install -Dm0644 jenkins/war/target/jenkins.war %{buildroot}%{_prefix}/lib/%{name}/%{name}.war
install -Dm0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{name}
install -d %{buildroot}%{_sbindir}
ln -sf ../../%{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
install -Dm0644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
install -Dm0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -d %{buildroot}%{_localstatedir}/lib/%{name}
install -d %{buildroot}%{_localstatedir}/log/%{name}

groupadd -r jenkins &>/dev/null || :
useradd -g jenkins -s /bin/false -r -c "Jenkins Continuous Build server" -d /var/lib/jenkins jenkins &>/dev/null || :
# package update ?
if [ ${1:-0} -gt 1 ]; then
  # update to >= 1.451.1
  # set a mark when updating from JENKINS_AJP_HOST=""
  eval JENKINS_AJP_HOST='' \
    `grep -s '^[[:space:]]*JENKINS_AJP_HOST=' etc/sysconfig/jenkins`
  if [ "x$JENKINS_AJP_HOST" = "x0.0.0.0" ] ; then
    touch etc/sysconfig/__change_jenkins_ajp_host__

%fillup_and_insserv %{name}
# replace old val of JENKINS_AJP_HOST if necessary
if [ -f etc/sysconfig/__change_jenkins_ajp_host__ ] ; then
  rm -f etc/sysconfig/__change_jenkins_ajp_host__
  sed -i -e 's/^JENKINS_AJP_HOST=.*/JENKINS_AJP_HOST=""/g' \

%stop_on_removal %{name}

%restart_on_update %{name}

%config %{_sysconfdir}/init.d/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
#%%config(noreplace) %%{_sysconfdir}/sysconfig/%%{name}
%attr(0755,jenkins,jenkins) %dir %{_localstatedir}/lib/%{name}
%attr(0755,jenkins,jenkins) %{_localstatedir}/log/%{name}