Files
perl-File-Slurp-Tree/perl-File-Slurp-Tree.spec
2025-08-12 18:14:10 +02:00

74 lines
2.3 KiB
RPMSpec

#
# spec file for package perl-File-Slurp-Tree
#
# Copyright (c) 2024 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 File-Slurp-Tree
Name: perl-File-Slurp-Tree
Version: 1.240.0
Release: 0
# 1.24 -> normalize -> 1.240.0
%define cpan_version 1.24
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Slurp and emit file trees as nested hashes
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/R/RC/RCLAMP/%{cpan_name}-%{cpan_version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(File::Find::Rule)
BuildRequires: perl(File::Slurp)
BuildRequires: perl(Module::Build)
Requires: perl(File::Find::Rule)
Requires: perl(File::Slurp)
Provides: perl(File::Slurp::Tree) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
File::Slurp::Tree provides functions for slurping and emitting trees of
files and directories.
# an example of use in a test suite
use Test::More tests => 1;
use File::Slurp::Tree;
is_deeply( slurp_tree( "t/some_path" ), { foo => {}, bar => "sample\n" },
"some_path contains a directory called foo, and a file bar" );
The tree datastructure is a hash of hashes. The keys of each hash are names
of directories or files. Directories have hash references as their value,
files have a scalar which holds the contents of the file.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Build.PL --installdirs=vendor
./Build build --flags=%{?_smp_mflags}
%check
./Build test
%install
./Build install --destdir=%{buildroot} --create_packlist=0
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%changelog