# Detect the distribution in use
%global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g'
%global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]'
%global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release)
%global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4})
%global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace})
# Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel
%if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl"
%global __distinit rhel
%endif
# Dist tag for Fedora is still "fc"
%if "%{__distinit}" == "f"
%global __distinit fc
%endif

Name:		perl-YAML-Tiny
Version:	1.76
Release:	1.%{__distinit}%{__distvers}
Summary:	Read/Write YAML files with as little code as possible
License:	GPL-1.0-or-later OR Artistic-1.0-Perl
URL:		https://metacpan.org/release/YAML-Tiny
Source0:	https://www.cpan.org/modules/by-module/YAML/YAML-Tiny-%{version}.tar.gz
Patch0:		YAML-Tiny-1.75-spelling.patch
BuildArch:	noarch
# Module Build
BuildRequires:	coreutils
BuildRequires:	findutils
BuildRequires:	make
BuildRequires:	perl-generators
BuildRequires:	perl-interpreter
BuildRequires:	perl(ExtUtils::MakeMaker)
# Module Runtime
BuildRequires:	perl(B)
BuildRequires:	perl(Carp)
BuildRequires:	perl(Config)
BuildRequires:	perl(Exporter)
BuildRequires:	perl(Fcntl)
BuildRequires:	perl(Scalar::Util)
BuildRequires:	perl(strict)
BuildRequires:	perl(warnings)
# Test Suite
BuildRequires:	perl(base)
BuildRequires:	perl(File::Basename)
BuildRequires:	perl(File::Find)
BuildRequires:	perl(File::Spec) >= 0.80
BuildRequires:	perl(File::Spec::Functions)
BuildRequires:	perl(File::Temp) >= 0.19
BuildRequires:	perl(Getopt::Long)
BuildRequires:	perl(IO::Dir)
BuildRequires:	perl(JSON::PP)
BuildRequires:	perl(lib)
BuildRequires:	perl(List::Util)
BuildRequires:	perl(open)
BuildRequires:	perl(Test::More) >= 0.88
BuildRequires:	perl(utf8)
BuildRequires:	perl(vars)
# Optional Tests
%if 0%{!?perl_bootstrap:1}
BuildRequires:	perl(CPAN::Meta) >= 2.120900
BuildRequires:	perl(JSON::MaybeXS) >= 1.001000
%endif
# Extra Tests
# perl-Test-Kwalitee → perl-Module-CPANTS-Analyse → perl-Test-CPAN-Meta-YAML → perl-Test-YAML-Valid → perl-YAML-Tiny
%if 0%{!?perl_bootstrap:1}
%if 0%{?fedora} > 23 || 0%{?rhel} > 7
BuildRequires:	glibc-langpack-en
%endif
BuildRequires:	perl(blib)
BuildRequires:	perl(Encode)
BuildRequires:	perl(IO::Handle)
BuildRequires:	perl(IPC::Open3)
BuildRequires:	perl(Pod::Coverage::TrustPod)
BuildRequires:	perl(Pod::Wordlist)
BuildRequires:	perl(Test::CleanNamespaces) >= 0.15
BuildRequires:	perl(Test::CPAN::Changes)
BuildRequires:	perl(Test::CPAN::Meta)
BuildRequires:	perl(Test::EOL)
BuildRequires:	perl(Test::Kwalitee) >= 1.21
BuildRequires:	perl(Test::MinimumVersion)
BuildRequires:	perl(Test::Mojibake)
BuildRequires:	perl(Test::More) >= 0.96
BuildRequires:	perl(Test::NoTabs)
BuildRequires:	perl(Test::Pod) >= 1.41
BuildRequires:	perl(Test::Pod::Coverage) >= 1.08
BuildRequires:	perl(Test::Portability::Files)
BuildRequires:	perl(Test::Spelling) >= 0.17, hunspell-en
BuildRequires:	perl(YAML)
BuildRequires:	perl(YAML::Syck)
BuildRequires:	perl(YAML::XS)
%endif
# Runtime
%if 0%{?fedora} < 38 && 0%{?rhel} < 10
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%endif
Requires:	perl(Carp)
Requires:	perl(Config)
Requires:	perl(Fcntl)

%description
YAML::Tiny is a Perl class for reading and writing YAML-style files,
written with as little code as possible, reducing load time and
memory overhead.

%prep
%setup -q -n YAML-Tiny-%{version}

# Add some stopwords for the POD spelling check
%patch -P 0

%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}

%install
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -delete
%{_fixperms} -c %{buildroot}

%check
make test

# Extra tests
%if 0%{!?perl_bootstrap:1}
LANG=en_US make test RELEASE_TESTING=1 TEST_FILES="$(echo $(find xt/ -name '*.t'))"
%endif

%files
%license LICENSE
%doc Changes CONTRIBUTING README
%{perl_vendorlib}/YAML/
%{_mandir}/man3/YAML::Tiny.3*

%changelog
* Mon Dec 16 2024 Paul Howarth <paul@city-fan.org> - 1.76-1
- Update to 1.76 (rhbz#2332646)
  - Revert change from GH#60: "yes", "y", etc. are not actually booleans (GH#66)

* Mon Dec 16 2024 Paul Howarth <paul@city-fan.org> - 1.75-1
- Update to 1.75 (rhbz#2332503)
  - Fixed regression in %%QUOTE (GH#60)
  - Fix version comparison logic for forward compatibility (GH#63)
- Switch source URL from cpan.metacpan.org to www.cpan.org

* Thu Mar 23 2023 Paul Howarth <paul@city-fan.org> - 1.74-1
- Update to 1.74
  - A few documentation tweaks
- Use SPDX-format license tag
- Avoid deprecated patch syntax

* Tue Apr  6 2021 Paul Howarth <paul@city-fan.org> - 1.73-7
- Work around mock locale issues by adding buildreq glibc-langpack-en when
  running extra tests
- Use %%license unconditionally

* Sun Jun  2 2019 Paul Howarth <paul@city-fan.org> - 1.73-6
- Perl 5.30 rebuild

* Fri Nov 16 2018 Paul Howarth <paul@city-fan.org> - 1.73-4
- Avoid optional test requirements when bootstrapping
- Switch upstream from search.cpan.org to metacpan.org

* Thu Feb 22 2018 Paul Howarth <paul@city-fan.org> - 1.73-1
- Update to 1.73
  - Perform correct stripping of leading white space in literal/folded text
    blocks (GH#44, CPAN RT#56045)
  - Fix compatibility with Test::Builder 0.94 in test shim
- BR: perl-generators unconditionally
- BR: perl-interpreter rather than perl

* Tue Jun 13 2017 Paul Howarth <paul@city-fan.org> - 1.70-3
- Drop support for EOL distributions prior to F-13
  - Drop BuildRoot: and Group: tags
  - Drop explicit buildroot cleaning in %%install section
  - Drop explicit %%clean section
  - Drop workaround for building with File::Temp < 0.19
  - Drop workaround for building with Test::More < 0.99

* Sun Jan 22 2017 Paul Howarth <paul@city-fan.org> - 1.70-1
- Update to 1.70
  - Some errors writing to a file were incorrectly reported
- Update spelling patch

* Tue Jan 10 2017 Paul Howarth <paul@city-fan.org> - 1.69-4
- Test::Kwalitee ≥ 1.21 now available back to Fedora 9

* Tue May 17 2016 Paul Howarth <paul@city-fan.org> - 1.69-3
- Fix FTBFS when perl(File::Temp) is not in the minimal buildroot
- BR: perl-generators where possible
- Simplify find command using -delete

* Sun Jul 26 2015 Paul Howarth <paul@city-fan.org> - 1.69-1
- Update to 1.69
  - Tests no longer print to stderr unnecessarily; this makes core perl builds
    (where this distribution is included as CPAN-Meta-YAML) a little quieter
  - The Test::More dependency has been reduced to 0.88 by emulating 'subtest'
    for those tests that need it

* Thu Jun 25 2015 Paul Howarth <paul@city-fan.org> - 1.67-3
- Perl 5.22 rebuild

* Tue May 12 2015 Paul Howarth <paul@city-fan.org> - 1.67-1
- Update to 1.67
  - Instead of erroring on duplicate keys found in a hash (introduced in
    version 1.63), now we only warn; this fixes an issue in Strawberry Perl
    (via CPAN::Meta::YAML) when parsing a configuration file
  - Updated File::Temp test prereq to 0.19 for 'newdir'

* Tue Mar 17 2015 Paul Howarth <paul@city-fan.org> - 1.66-1
- Update to 1.66
  - Removed bundled Test::TempDir::Tiny to rely on File::Temp for temporary
    directories during testing
- Revert to ExtUtils::MakeMaker flow
- Bundle a recent enough copy of File::Temp for testing on old distributions
- Update spelling patch

* Sat Mar 14 2015 Paul Howarth <paul@city-fan.org> - 1.65-1
- Update to 1.65
  - Artifacts left behind from testing are now cleaned up (GH#34)
- Update patches as needed

* Wed Oct  8 2014 Paul Howarth <paul@city-fan.org> - 1.64-1
- Update to 1.64
  - Remove silencing of any errors encountered while loading Scalar::Util
    (GH#33)
  - Now using JSON::MaybeXS in tests instead of JSON.pm
- Update patches as needed

* Fri Sep 12 2014 Paul Howarth <paul@city-fan.org> - 1.63-2
- Use %%license where possible

* Thu Jun 12 2014 Paul Howarth <paul@city-fan.org> - 1.63-1
- Update to 1.63
  - Incorrect error messages fixed, when $@ is clobbered when Carp wasn't
    loaded (GH#30, GH#31)
  - Now checking for, and erroring on, duplicate keys found in a hash (GH#32)
- Update patches as needed
- Drop %%defattr, redundant since rpm 4.4

* Sun Mar 16 2014 Paul Howarth <paul@city-fan.org> - 1.62-1
- Update to 1.62
  - Fix handling of trailing colon in key name (CPAN RT#92916)

* Tue Feb 25 2014 Paul Howarth <paul@city-fan.org> - 1.61-1
- Update to 1.61
  - Fixed a test for VMS (CPAN RT#93297)
- Update patches as needed

* Fri Feb 14 2014 Paul Howarth <paul@city-fan.org> - 1.60-1
- Update to 1.60
  - Numeric values are now quoted whenever they've been used as a string,
    which fixes inconsistent behaviour seen with numeric values, due to
    differences between the XS and pure-perl variants of Data::Dumper
    (GitHub Issue #24)
  - Numeric hash keys are now always quoted

* Wed Feb  5 2014 Paul Howarth <paul@city-fan.org> - 1.58-1
- Update to 1.58
  - 1.57 omitted a change entry for the following change:
  Incompatible change:
  - Previously, YAML::Tiny was sloppy about file encodings; it is now strict
  - The 'read' method and 'LoadFile' function expect UTF-8 encoded files
  - The 'write' method and 'DumpFile' function produce UTF-8 encoded files
  - The 'read_string' and 'write_string' methods and the 'Load' and 'Dump'
    functions expect or generate (decoded) character data

* Fri Jan 31 2014 Paul Howarth <paul@city-fan.org> - 1.57-1
- Update to 1.57
  Incompatible change:
  - Previously, some errors would throw exceptions and some would return the
    error condition in $YAML::Tiny::errstr, but now all errors throw
    exceptions; use of $errstr and the errstr method are deprecated
  Fixed:
  - Fixed write method to encode YAML file with UTF-8
  - Improved SYNOPSIS and documentation of new
  Testing:
  - Tests have been cleaned up and reorganized
  - Test coverage has been significantly improved
- Instead of trying to patch around the need for a recent version of
  Test::More, bundle the version upstream wants and use that if necessary
- Add patch to support building with old Module::Build::Tiny versions
- Update spelling patch
- Package docs CONTRIBUTING and README.md
- Update dependencies as needed
- Don't try to run the extra tests unless we have Perl ≥ 5.10, as some
  of the testing modules aren't available and I don't want to have to patch
  the test suite to work around that

* Wed Sep 25 2013 Paul Howarth <paul@city-fan.org> - 1.56-1
- Update to 1.56
  - read_string documentation error fixed (CPAN RT#74409)
  - Re-release with fixed compile test
- Go back to Module::Build::Tiny flow
- Drop redundant patch for building with old ExtUtils::MakeMaker versions
- Update other patches as needed
- Pod::Wordlist::hanekomu is not used, so we need to switch between aspell and
  hunspell based on where we're building

* Thu Sep 19 2013 Paul Howarth <paul@city-fan.org> - 1.55-1
- Update to 1.55
  - Revert to ExtUtils::MakeMaker flow
- Update buildreqs as needed
- Update patches as needed
- Skip the spell check if we have Pod::Spell 1.07
  (https://github.com/xenoterracide/Pod-Spell/issues/9)

* Wed Sep  4 2013 Paul Howarth <paul@city-fan.org> - 1.54-2
- Don't buildreq release test modules when bootstrapping

* Thu Aug 22 2013 Paul Howarth <paul@city-fan.org> - 1.54-1
- Update to 1.54
  - Convert to Dist::Zilla
  - Updated format to conform to CPAN::Changes::Spec
- Upstream shipping README again
- Switch to Module::Build::Tiny flow
- Classify buildreqs by usage
- Add buildreqs for, and explicitly run the extra tests
- Add patches to support testing with old versions of test modules

* Wed Aug 21 2013 Paul Howarth <paul@city-fan.org> - 1.53-1
- Update to 1.53
  - Updated repository metadata to reflect move to github
- This release by ETHER -> update source URL
- Upstream no longer shipping extra tests, so don't try to run them
- Upstream no longer shipping README
- Drop minperl patch since we're no longer running the minimum version test

* Thu Jul 18 2013 Paul Howarth <paul@city-fan.org> - 1.51-7
- Perl 5.18 rebuild

* Tue Jun 11 2013 Paul Howarth <paul@city-fan.org> - 1.51-5
- Build requires at least perl 5.6, not 5.4

* Mon Jul 16 2012 Paul Howarth <paul@city-fan.org> - 1.51-4
- Perl 5.16 post-bootstrap rebuild

* Mon Jul  2 2012 Paul Howarth <paul@city-fan.org> - 1.51-3
- BR: perl(Carp),perl(Exporter), perl(File::Spec::Functions) and perl(YAML::XS)

* Sun Mar 11 2012 Paul Howarth <paul@city-fan.org> - 1.51-1
- Update to 1.51
  - The fix described in 1.48 was incorrect; removed an additional "if $@" to
    fix it properly
  - Make the Scalar::Util version check resistant to bugs caused by
    development versions
- Drop patch for old Scalar::Util versions, no longer needed
- Don't need to remove empty directories from the buildroot
- Drop support for distributions prior to FC-3:
  - Don't need to define %%{perl_vendorlib}
  - Use DESTDIR rather than PERL_INSTALL_ROOT

* Thu Jun 30 2011 Paul Howarth <paul@city-fan.org> - 1.50-2
- Rebuild for perl 5.14.1 in Rawhide
- Add support for perl_bootstrap macro
- No need for %%{?perl_default_filter} in this package
- Fix dist tag for CentOS 6 and Scientific Linux

* Thu Jun 23 2011 Paul Howarth <paul@city-fan.org> - 1.50-1
- Update to 1.50
  - Major bug fix: all code that writes arbitrary data should upgrade
  - Simple scalars with no whitespace but ending in a colon like ABC: were not
    being quoted, which results in the parser confusing it with a mapping key
    and crashing
- Nobody else likes macros for commands

* Tue Feb  1 2011 Paul Howarth <paul@city-fan.org> - 1.48-1
- Update to 1.48
  - Fix to the refaddr compatibility where Scalar::Util is installed but is
    older than 1.18
- BR: perl(Scalar::Util)
- Add patch to fix operation with Scalar::Util < 1.18 properly

* Mon Jan 31 2011 Paul Howarth <paul@city-fan.org> - 1.47-1
- Update to 1.47
  - No functional changes
  - Only depend on the YAML implementations when we are release testing

* Thu Dec 16 2010 Paul Howarth <paul@city-fan.org> - 1.46-1
- Update to 1.46
  - Added support for trailing line comments
  - Added checks for some characters that are illegal/reserved in plain scalars
  - Minor cleaning up of some out of date POD
  - Updated AUTOMATED_TESTING dependencies to new versions
  - Added experimental support for exception->errstr conversion
  - Updated test suite yaml_error to not expect exceptions

* Sun Aug  8 2010 Paul Howarth <paul@city-fan.org> - 1.44-1
- Update to 1.44
  - No functional changes
  - Minor tweaks to Makefile.PL
  - Minor cleanup around the refaddr emulation code

* Mon Jul 19 2010 Paul Howarth <paul@city-fan.org> - 1.43-1
- Update to 1.43
  - No functional changes
  - Don't import Carp 'croak' any more, saving a few K

* Fri Jun 25 2010 Paul Howarth <paul@city-fan.org> - 1.42-1
- Update to 1.42
  - No functional changes
  - Clarified documentation regarding treatment of "bool" keywords
  - YAML::Perl comparison tests were behaving incorrectly
  - Author tests updated and moved into xt/
  - Updated the versions of the other YAML parsers for testing

* Wed Jun 23 2010 Paul Howarth <paul@city-fan.org> - 1.41-3
- Rebuild for perl 5.12.1 in Rawhide

* Wed May 12 2010 Paul Howarth <paul@city-fan.org> - 1.41-2
- Fix dist tag for RHEL-6 Beta

* Tue Dec 22 2009 Paul Howarth <paul@city-fan.org> - 1.41-1
- Update to 1.41 (performance fix for very long double-quoted strings)

* Tue Dec 22 2009 Paul Howarth <paul@city-fan.org> - 1.40-3
- Import from Fedora

* Mon Dec  7 2009 Stepan Kasal <skasal@redhat.com> - 1.40-2
- Rebuild against perl 5.10.1

* Sun Sep 27 2009 Chris Weyl <cweyl@alumni.drew.edu> - 1.40-1
- Auto-update to 1.40 (by cpan-spec-update 0.01)

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.39-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat May 23 2009 Chris Weyl <cweyl@alumni.drew.edu> - 1.39-1
- Auto-update to 1.39 (by cpan-spec-update 0.01)
- Added a new br on perl(File::Spec) (version 0.80)

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.36-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Jan 17 2009 Steven Pritchard <steve@kspei.com> - 1.36-1
- Update to 1.36
- BR Test::More

* Fri May 16 2008 Steven Pritchard <steve@kspei.com> - 1.32-1
- Update to 1.32

* Fri Feb  8 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.25-2
- Rebuild for new perl

* Mon Jan 28 2008 Steven Pritchard <steve@kspei.com> - 1.25-1
- Update to 1.25

* Tue Dec 11 2007 Steven Pritchard <steve@kspei.com> - 1.21-1
- Update to 1.21
- Update License tag
- BR Test::MinimumVersion

* Thu Aug 23 2007 Steven Pritchard <steve@kspei.com> - 1.14-1
- Update to 1.14

* Fri Jul 13 2007 Steven Pritchard <steve@kspei.com> - 1.13-1
- Update to 1.13

* Fri Jun 08 2007 Steven Pritchard <steve@kspei.com> - 1.12-1
- Update to 1.12

* Mon May 28 2007 Steven Pritchard <steve@kspei.com> - 1.09-1
- Update to 1.09

* Sat May 19 2007 Steven Pritchard <steve@kspei.com> - 1.08-1
- Update to 1.08
- Update description

* Tue Mar 13 2007 Steven Pritchard <steve@kspei.com> - 1.04-1
- Specfile autogenerated by cpanspec 1.70
- Drop redundant perl build dependency
- BR YAML, YAML::Syck, and Test::Pod for better test coverage