##
##  trac-plugins.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  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 versions
%define       V_trac                      0.12
%define       V_accountmanagerplugin      20110619
%define       V_tracdownloaderplugin      20100724
%define       V_discussionplugin          20110619
%define       V_includemacro              20100724
%define       V_xmlrpc                    20110619
%define       V_tracmtn                   20100724
%define       V_gitplugin                 0.12.0.5
%define       V_mercurialplugin           20110619
%define       V_timingandestimationplugin 20110619
%define       V_scrumburndownplugin       20100724
%define       V_authopenid                20110619
%define       V_noanonymousplugin         20110619
%define       V_svnurlsplugin             20100724
%define       V_tocmacro                  20100724
%define       V_workfloweditorplugin      20110619
%define       V_advancedticketworkflow    20100724

#   package information
Name:         trac-plugins
Summary:      Trac Plugins
URL:          http://trac.edgewall.org/
Vendor:       Edgewall
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        SCM
License:      GPL
Version:      %{V_trac}
Release:      20110619

#   list of sources
Source0:      http://download.openpkg.org/components/versioned/trac/accountmanagerplugin-%{V_accountmanagerplugin}.tar.gz
Source1:      http://download.openpkg.org/components/versioned/trac/tracdownloaderplugin-%{V_tracdownloaderplugin}.tar.gz
Source2:      http://download.openpkg.org/components/versioned/trac/discussionplugin-%{V_discussionplugin}.tar.gz
Source3:      http://download.openpkg.org/components/versioned/trac/includemacro-%{V_includemacro}.tar.gz
Source4:      http://download.openpkg.org/components/versioned/trac/xmlrpc-%{V_xmlrpc}.tar.gz
Source5:      http://download.openpkg.org/components/versioned/trac/tracmtn-%{V_tracmtn}.tar.gz
Source6:      http://download.openpkg.org/components/versioned/trac/gitplugin-%{V_gitplugin}.zip
Source7:      http://download.openpkg.org/components/versioned/trac/mercurialplugin-%{V_mercurialplugin}.tar.gz
Source8:      http://download.openpkg.org/components/versioned/trac/timingandestimationplugin-%{V_timingandestimationplugin}.tar.gz
Source9:      http://download.openpkg.org/components/versioned/trac/scrumburndownplugin-%{V_scrumburndownplugin}.tar.gz
Source10:     http://download.openpkg.org/components/versioned/trac/authopenid-%{V_authopenid}.tar.gz
Source11:     http://download.openpkg.org/components/versioned/trac/noanonymousplugin-%{V_noanonymousplugin}.tar.gz
Source12:     http://download.openpkg.org/components/versioned/trac/svnurlsplugin-%{V_svnurlsplugin}.tar.gz
Source13:     http://download.openpkg.org/components/versioned/trac/tocmacro-%{V_tocmacro}.tar.gz
Source14:     http://download.openpkg.org/components/versioned/trac/workfloweditorplugin-%{V_workfloweditorplugin}.tar.gz
Source15:     http://download.openpkg.org/components/versioned/trac/advancedticketworkflow-%{V_advancedticketworkflow}.tar.gz
Patch0:       trac-plugins.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  python, python-setup, trac
PreReq:       python, python-setup, trac

%description
    This is a set of plugins for addon Trac functionalities.

%track
    prog trac-plugins:accountmanagerplugin = {
        version   = %{V_accountmanagerplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = accountmanagerplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:tracdownloaderplugin = {
        version   = %{V_tracdownloaderplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = tracdownloaderplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:discussionplugin = {
        version   = %{V_discussionplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = discussionplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:includemacro = {
        version   = %{V_includemacro}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = includemacro-(__VER__)\.tar\.gz
    }
    prog trac-plugins:xmlrpc = {
        version   = %{V_xmlrpc}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = xmlrpc-(__VER__)\.tar\.gz
    }
    prog trac-plugins:tracmtn = {
        version   = %{V_tracmtn}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = tracmtn-(__VER__)\.tar\.gz
    }
    prog trac-plugins:gitplugin = {
        version   = %{V_gitplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = gitplugin-(__VER__)\.zip
    }
    prog trac-plugins:mercurialplugin = {
        version   = %{V_mercurialplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = mercurialplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:timingandestimationplugin = {
        version   = %{V_timingandestimationplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = timingandestimationplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:scrumburndownplugin = {
        version   = %{V_scrumburndownplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = scrumburndownplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:authopenid = {
        version   = %{V_authopenid}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = authopenid-(__VER__)\.tar\.gz
    }
    prog trac-plugins:noanonymousplugin = {
        version   = %{V_noanonymousplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = noanonymousplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:svnurlsplugin = {
        version   = %{V_svnurlsplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = svnurlsplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:tocmacro = {
        version   = %{V_tocmacro}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = tocmacro-(__VER__)\.tar\.gz
    }
    prog trac-plugins:workfloweditorplugin = {
        version   = %{V_workfloweditorplugin}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = workfloweditorplugin-(__VER__)\.tar\.gz
    }
    prog trac-plugins:advancedticketworkflow = {
        version   = %{V_advancedticketworkflow}
        url       = http://download.openpkg.org/components/versioned/trac/
        regex     = advancedticketworkflow-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -c
    %setup -q -T -D -a 1
    %setup -q -T -D -a 2
    %setup -q -T -D -a 3
    %setup -q -T -D -a 4
    %setup -q -T -D -a 5
    %setup -q -T -D -a 6
    %setup -q -T -D -a 7
    %setup -q -T -D -a 8
    %setup -q -T -D -a 9
    %setup -q -T -D -a 10
    %setup -q -T -D -a 11
    %setup -q -T -D -a 12
    %setup -q -T -D -a 13
    %setup -q -T -D -a 14
    %setup -q -T -D -a 15
    %patch -p0

%build
    #   build plugins
    ( cd accountmanagerplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd tracdownloaderplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd discussionplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd includemacro
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd xmlrpc
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd tracmtn
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd hvr-trac-git-plugin-*
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd mercurialplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd timingandestimationplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd scrumburndownplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd authopenid
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd noanonymousplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd svnurlsplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd tocmacro
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd workfloweditorplugin
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?
    ( cd advancedticketworkflow
      %{l_prefix}/bin/python setup.py bdist_egg
    ) || exit $?

%install
    #   install plugins
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins
    %{l_shtool} install -c -m 644 \
        accountmanagerplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/accountmanager.egg
    %{l_shtool} install -c -m 644 \
        tracdownloaderplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/downloader.egg
    %{l_shtool} install -c -m 644 \
        discussionplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/discussion.egg
    %{l_shtool} install -c -m 644 \
        includemacro/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/includemacro.egg
    %{l_shtool} install -c -m 644 \
        xmlrpc/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/xmlrpc.egg
    %{l_shtool} install -c -m 644 \
        tracmtn/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/monotone.egg
    %{l_shtool} install -c -m 644 \
        hvr-trac-git-plugin-*/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/git.egg
    %{l_shtool} install -c -m 644 \
        mercurialplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/mercurial.egg
    %{l_shtool} install -c -m 644 \
        timingandestimationplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/timingandestimation.egg
    %{l_shtool} install -c -m 644 \
        scrumburndownplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/scrumburndown.egg
    %{l_shtool} install -c -m 644 \
        authopenid/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/authopenid.egg
    %{l_shtool} install -c -m 644 \
        noanonymousplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/noanonymous.egg
    %{l_shtool} install -c -m 644 \
        svnurlsplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/svnurls.egg
    %{l_shtool} install -c -m 644 \
        tocmacro/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/tocmacro.egg
    %{l_shtool} install -c -m 644 \
        workfloweditorplugin/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/workfloweditor.egg
    %{l_shtool} install -c -m 644 \
        advancedticketworkflow/dist/*.egg \
        $RPM_BUILD_ROOT%{l_prefix}/share/trac/plugins/advancedticketworkflow.egg

    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

