Files
perl-String-Diff/perl-String-Diff.spec
Tina Müller b1623dd1df Accepting request 1237596 from devel:languages:perl:autoupdate
- Remove cf34e0b93fe89fb24f91cfaf998b5b563f269eb2.patch (fixed upstream)
- updated to 0.100.0 (0.10)
   see /usr/share/doc/packages/perl-String-Diff/Changes
  0.10      2024-11-30
          - yet another distro fixup, same changelog as in v0.08, i.e.:
          - fixed two tests that had been broken with YAML >= 1.21 (GH#7) (Kenichi Ishigaki)
          - Add Test::Base to cpanfile (GH#5) (Jose Luis Martinez)
          - Add develop dependencies to cpanfile (Jose Luis Martinez)
          - Fix failing POD test (Petr Šabata)
          - Kudos to Jose Luis Martinez for collecting all the issues
            from different sources into one concise branch ready for a
            new CPAN release
  0.09      2024-11-30
          - distro cleanup (replaced author toolchain), same changelog as in v0.08
  0.08  2024-11-25 15:16:09 CET
          - fixed two tests that had been broken with YAML >= 1.21 (GH#7) (Kenichi Ishigaki)
          - Add Test::Base to cpanfile (GH#5) (Jose Luis Martinez)
          - Add develop dependencies to cpanfile (Jose Luis Martinez)
          - Fix failing POD test (Petr Šabata)
          - Kudos to Jose Luis Martinez for collecting all the issues
            from different sources into one concise branch ready for a
            new CPAN release

OBS-URL: https://build.opensuse.org/request/show/1237596
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-String-Diff?expand=0&rev=26
2025-01-17 00:04:27 +00:00

113 lines
3.8 KiB
RPMSpec

#
# spec file for package perl-String-Diff
#
# Copyright (c) 2025 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define cpan_name String-Diff
Name: perl-String-Diff
Version: 0.100.0
Release: 0
# 0.10 -> normalize -> 0.100.0
%define cpan_version 0.10
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Simple diff to String
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/S/SC/SCHWIGON/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Algorithm::Diff)
BuildRequires: perl(Test::Base)
BuildRequires: perl(YAML)
Requires: perl(Algorithm::Diff)
Requires: perl(YAML)
Provides: perl(String::Diff) = %{version}
%undefine __perllib_provides
%{perl_requires}
# MANUAL BEGIN
BuildRequires: perl(HTML::Entities)
BuildRequires: perl(Module::Install::GithubMeta)
BuildRequires: perl(Module::Install::ReadmeFromPod)
BuildRequires: perl(Module::Install::ReadmeMarkdownFromPod)
BuildRequires: perl(Module::Install::Repository)
BuildRequires: perl(Test::Base)
Requires: perl(Capture::Tiny)
Requires: perl(HTML::Entities)
# MANUAL END
%description
String::Diff is the difference of a consecutive string is made. after
general diff is done, the difference in the line is searchable.
the mark of the addition and the deletion can be freely changed. the color
is colored to the terminal with ANSI, using the HTML display it.
after the line is divided, diff is taken when 'linebreak' option is
specified.
my($old_string, $new_string) = String::Diff::diff_fully('this is Perl', 'this is Ruby', linebreak => 1);
my($old_string, $new_string) = String::Diff::diff('this is Perl', 'this is Ruby', linebreak => 1);
my $string = String::Diff::diff_merge('this is Perl', 'this is Ruby', linebreak => 1);
my $string = String::Diff::diff_regexp('this is Perl', 'this is Ruby', linebreak => 1);
In diff and diff_merge methods the mark of the difference can be changed.
my $diff = String::Diff::diff('this is Perl', 'this is Ruby',
remove_open => '<del>',
remove_close => '</del>',
append_open => '<ins>',
append_close => '</ins>',
);
You can escape callback set to diff function and diff_merge function.
use HTML::Entities
my($diff_old, $diff_new) = String::Diff::diff(
'this is <b>Perl</b>',
'this is <b><BIG>R</BIG>uby</b>',
remove_open => '<del>',
remove_close => '</del>',
append_open => '<ins>',
append_close => '</ins>',
escape => sub { encode_entities($_[0]) },
});
is($diff_old, 'this is &lt;b&gt;<del>Perl</del>&lt;/b&gt;');
is($diff_new, 'this is &lt;b&gt;<ins>&lt;BIG&gt;R&lt;/BIG&gt;uby</ins>&lt;/b&gt;');
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README README.md
%license LICENSE
%changelog