# Run optional test %bcond_without perl_Image_Sane_enables_optional_test Name: perl-Image-Sane Version: 5 Release: 19%{?dist} Summary: Perl extension for the SANE (Scanner Access Now Easy) Project License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/Image-Sane Source0: https://cpan.metacpan.org/authors/id/R/RA/RATCLIFFE/Image-Sane-%{version}.tar.gz # Adapt to Perl 5.37.10, CPAN RT#148487 Patch0: Image-Sane-5-Replace-deprecated-given-and-when-operators.patch BuildRequires: coreutils BuildRequires: findutils BuildRequires: gcc BuildRequires: make BuildRequires: perl-devel BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(:VERSION) >= 5.8 BuildRequires: perl(Config) BuildRequires: perl(English) BuildRequires: perl(ExtUtils::Depends) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 BuildRequires: perl(ExtUtils::PkgConfig) BuildRequires: pkgconfig(sane-backends) >= 1.0.19 # Run-time: BuildRequires: perl(:VERSION) >= 5.8.5 BuildRequires: perl(base) BuildRequires: perl(Exception::Class) BuildRequires: perl(Exporter) BuildRequires: perl(Readonly) BuildRequires: perl(strict) BuildRequires: perl(warnings) BuildRequires: perl(XSLoader) # Tests: BuildRequires: perl(feature) BuildRequires: perl(File::Basename) BuildRequires: perl(Getopt::Long) BuildRequires: perl(if) BuildRequires: perl(IO::Handle) BuildRequires: perl(Readonly) BuildRequires: perl(sigtrap) BuildRequires: perl(Test::More) BuildRequires: perl(Test::Requires) BuildRequires: perl(Try::Tiny) %if %{with perl_Image_Sane_enables_optional_test} # Optional tests: # ImageMagick for identify tool BuildRequires: ImageMagick BuildRequires: perl(Test::Pod) >= 1.00 # sane-backensds for scanimage tool BuildRequires: sane-backends # sane-backends-drivers-scanners for "test" Sane driver BuildRequires: sane-backends-drivers-scanners %endif %description These Perl bindings for the SANE (Scanner Access Now Easy) Project allow you to access SANE-compatible scanners in a Perlish and object-oriented way, freeing you from the casting and memory management in C, yet remaining very close in spirit to original API. %package tests Summary: Tests for %{name} BuildArch: noarch Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: coreutils Requires: perl-Test-Harness %if %{with perl_Image_Sane_enables_optional_test} # ImageMagick for identify tool Requires: ImageMagick # sane-backensds for scanimage tool Requires: sane-backends # sane-backends-drivers-scanners for "test" Sane driver Requires: sane-backends-drivers-scanners %endif %description tests Tests from %{name}. Execute them with "%{_libexecdir}/%{name}/test". %prep %autosetup -p1 -n Image-Sane-%{version} # Remove author tests rm t/91_critic.t perl -i -ne 'print $_ unless m{\At/91_critic\.t}' MANIFEST # Correct file permissions chmod -x examples/* # Help generators to recognize Perl scripts for F in t/*.t; do perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F" chmod +x "$F" done %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="$RPM_OPT_FLAGS" %{make_build} %install %{make_install} find %{buildroot} -type f -name '*.bs' -size 0 -delete %{_fixperms} %{buildroot}/* # Install tests mkdir -p %{buildroot}%{_libexecdir}/%{name} cp -a examples t %{buildroot}%{_libexecdir}/%{name} # Minimize examples chmod +x %{buildroot}%{_libexecdir}/%{name}/examples/* rm %{buildroot}%{_libexecdir}/%{name}/examples/scanadf-perl # t/pod.t is usless on an empty ./blib rm %{buildroot}%{_libexecdir}/%{name}/t/pod.t # t/90_MANIFEST.t fails with empty ./lib rm %{buildroot}%{_libexecdir}/%{name}/t/90_MANIFEST.t cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' #!/bin/bash set -e # Many tests write into CWD DIR=$(mktemp -d) cp -a %{_libexecdir}/%{name}/* "$DIR" pushd "$DIR" prove -I . -j "$(getconf _NPROCESSORS_ONLN)" popd rm -r "$DIR" EOF chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files %doc Changes examples README %{perl_vendorarch}/auto/* %{perl_vendorarch}/Image* %{_mandir}/man3/* %files tests %{_libexecdir}/%{name} %changelog * Thu Jan 25 2024 Fedora Release Engineering - 5-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Sun Jan 21 2024 Fedora Release Engineering - 5-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Thu Jul 20 2023 Fedora Release Engineering - 5-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild * Thu Jul 13 2023 Jitka Plesnikova - 5-16 - Perl 5.38 re-rebuild updated packages * Wed Jul 12 2023 Petr Pisar - 5-15 - Adapt to Perl 5.37.10 (CPAN RT#148487) * Tue Jul 11 2023 Jitka Plesnikova - 5-14 - Perl 5.38 rebuild * Fri Jan 20 2023 Fedora Release Engineering - 5-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild * Mon Jan 02 2023 Petr Pisar - 5-12 - Remove skipped author tests - Package the tests * Fri Jul 22 2022 Fedora Release Engineering - 5-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild * Wed Jun 01 2022 Jitka Plesnikova - 5-10 - Perl 5.36 rebuild * Fri Jan 21 2022 Fedora Release Engineering - 5-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Thu Jul 22 2021 Fedora Release Engineering - 5-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Fri May 21 2021 Jitka Plesnikova - 5-7 - Perl 5.34 rebuild * Wed Jan 27 2021 Fedora Release Engineering - 5-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Tue Jul 28 2020 Fedora Release Engineering - 5-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Tue Jun 23 2020 Jitka Plesnikova - 5-4 - Perl 5.32 rebuild * Thu Mar 19 2020 Jitka Plesnikova - 5-3 - Specify all dependencies * Thu Jan 30 2020 Fedora Release Engineering - 5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild * Fri Nov 15 2019 Petr Pisar - 5-1 - Version 5 bump * Thu Sep 12 2019 Petr Pisar - 4-1 - Version 4 bump * Wed Sep 11 2019 Petr Pisar - 3-1 - Version 3 bump * Tue Sep 10 2019 Petr Pisar - 2-1 - Version 2 bump * Fri Jul 26 2019 Fedora Release Engineering - 0.14-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Fri May 31 2019 Jitka Plesnikova - 0.14-7 - Perl 5.30 rebuild * Fri Feb 01 2019 Fedora Release Engineering - 0.14-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Fri Jul 13 2018 Fedora Release Engineering - 0.14-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Fri Jun 29 2018 Jitka Plesnikova - 0.14-4 - Perl 5.28 rebuild * Thu Feb 08 2018 Fedora Release Engineering - 0.14-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 0.14-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Mon Jul 10 2017 Petr Pisar - 0.14-1 - 0.14 bump * Fri Jul 07 2017 Petr Pisar - 0.13-1 - 0.13 bump * Mon Jul 03 2017 Petr Pisar 0.12-1 - Specfile autogenerated by cpanspec 1.78.