##
##  svk.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 version
%define       V_svk                    2.2.3
%define       V_svn_simple             0.28
%define       V_svn_mirror             0.75
%define       V_internals              1.1
%define       V_perlio_via_dynamic     0.13
%define       V_perlio_via_symlink     0.05
%define       V_perlio_via_trap        0.09
%define       V_perlio_eol             0.19
%define       V_io_digest              0.11
%define       V_algorithm_annotate     0.10
%define       V_file_type              0.22
%define       V_file_chdir             0.1010
%define       V_app_cli                0.313

#   package information
Name:         svk
Summary:      Decentralized Version Control System
URL:          http://svk.elixus.org/
Vendor:       Chia Liang Kao
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        SCM
License:      GPL
Version:      %{V_svk}
Release:      20230709

#   list of sources
Source0:      http://www.cpan.org/authors/id/C/CL/CLKAO/SVK-v%{V_svk}.tar.gz
Source1:      http://www.cpan.org/authors/id/C/CL/CLKAO/SVN-Simple-%{V_svn_simple}.tar.gz
Source2:      http://www.cpan.org/authors/id/C/CL/CLKAO/SVN-Mirror-%{V_svn_mirror}.tar.gz
Source3:      http://www.cpan.org/authors/id/S/ST/STBEY/Internals-%{V_internals}.tar.gz
Source4:      http://www.cpan.org/authors/id/C/CL/CLKAO/PerlIO-via-dynamic-%{V_perlio_via_dynamic}.tar.gz
Source5:      http://www.cpan.org/authors/id/C/CL/CLKAO/PerlIO-via-symlink-%{V_perlio_via_symlink}.tar.gz
Source6:      http://www.cpan.org/authors/id/C/CL/CLKAO/PerlIO-via-trap-%{V_perlio_via_trap}.tar.gz
Source7:      http://www.cpan.org/modules/by-module/PerlIO/PerlIO-eol-%{V_perlio_eol}.tar.gz
Source8:      http://www.cpan.org/authors/id/C/CL/CLKAO/IO-Digest-%{V_io_digest}.tar.gz
Source9:      http://www.cpan.org/modules/by-module/Algorithm/Algorithm-Annotate-%{V_algorithm_annotate}.tar.gz
Source10:     http://www.cpan.org/modules/by-module/File/File-Type-%{V_file_type}.tar.gz
Source11:     http://www.cpan.org/modules/by-module/File/File-chdir-%{V_file_chdir}.tar.gz
Source12:     http://www.cpan.org/modules/by-module/App/App-CLI-%{V_app_cli}.tar.gz
Patch0:       svk.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  perl-crypto, perl-vcs, perl-parse, perl-util, perl-text, perl-www, perl-time, perl-xml
PreReq:       perl-crypto, perl-vcs, perl-parse, perl-util, perl-text, perl-www, perl-time, perl-xml
BuildPreReq:  subversion-perl
PreReq:       subversion-perl

%description
    SVK is a decentralized Version Control System (VCS) written in Perl.
    It uses the Subversion (SVN) filesystem but provides additional,
    powerful features. SVN aims to take over the CVS user base, while
    SVK attempts to take over the others. In its current form, SVK is
    a client of remote SVN, Perforce and CVS repositories to allow for
    offline operation. An SVK-specific server is under development.

%track
    prog svk = {
        version   = %{V_svk}
        url       = http://www.cpan.org/authors/id/C/CL/CLKAO/
        regex     = SVK-v?(__VER__)\.tar\.gz
    }
    prog svk:SVN-Simple = {
        version   = %{V_svn_simple}
        url       = http://www.cpan.org/authors/id/C/CL/CLKAO/
        regex     = SVN-Simple-(__VER__)\.tar\.gz
    }
    prog svk:SVN-Mirror = {
        version   = %{V_svn_mirror}
        url       = http://www.cpan.org/authors/id/C/CL/CLKAO/
        regex     = SVN-Mirror-(__VER__)\.tar\.gz
    }
    prog svk:Internals = {
        version   = %{V_internals}
        url       = http://www.cpan.org/authors/id/S/ST/STBEY/
        regex     = Internals-(__VER__)\.tar\.gz
    }
    prog svk:PerlIO-via-dynamic = {
        version   = %{V_perlio_via_dynamic}
        url       = http://www.cpan.org/authors/id/C/CL/CLKAO/
        regex     = PerlIO-via-dynamic-(__VER__)\.tar\.gz
    }
    prog svk:PerlIO-via-symlink = {
        version   = %{V_perlio_via_symlink}
        url       = http://www.cpan.org/authors/id/C/CL/CLKAO/
        regex     = PerlIO-via-symlink-(__VER__)\.tar\.gz
    }
    prog svk:PerlIO-via-trap = {
        version   = %{V_perlio_via_trap}
        url       = http://www.cpan.org/authors/id/C/CL/CLKAO/
        regex     = PerlIO-via-trap-(__VER__)\.tar\.gz
    }
    prog svk:PerlIO-eol = {
        version   = %{V_perlio_eol}
        url       = http://www.cpan.org/modules/by-module/PerlIO/
        regex     = PerlIO-eol-(__VER__)\.tar\.gz
    }
    prog svk:IO-Digest = {
        version   = %{V_io_digest}
        url       = http://www.cpan.org/authors/id/C/CL/CLKAO/
        regex     = IO-Digest-(__VER__)\.tar\.gz
    }
    prog svk:Algorithm-Annotate = {
        version   = %{V_algorithm_annotate}
        url       = http://www.cpan.org/modules/by-module/Algorithm/
        regex     = Algorithm-Annotate-(__VER__)\.tar\.gz
    }
    prog svk:File-Type = {
        version   = %{V_file_type}
        url       = http://www.cpan.org/modules/by-module/File/
        regex     = File-Type-(__VER__)\.tar\.gz
    }
    prog svk:File-chdir = {
        version   = %{V_file_chdir}
        url       = http://www.cpan.org/modules/by-module/File/
        regex     = File-chdir-(__VER__)\.tar\.gz
    }
    prog svk:App-CLI = {
        version   = %{V_app_cli}
        url       = http://www.cpan.org/modules/by-module/App/
        regex     = App-CLI-(__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
    %patch -p0

%build

%install

    #   perform common Perl prolog operations
    %{l_shtool} mkdir -f -p -m 755 \
        ${RPM_BUILD_ROOT}%{l_prefix}/libexec/svk
    %{l_prefix}/bin/perl-openpkg prepare

    #   install remaining prerequisite Perl modules which
    #   are not part of the OpenPKG perl-xxx packages.
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE4}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE5}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE6}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE7}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE8}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE9}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE10} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE11} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE12} configure build install

    #   install main program
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE1}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE2}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE3}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE0}  configure build install

    #   finalize installation
    %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup

    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
        %{l_files_std} `cat perl-openpkg-files`

%files -f files

%clean

