11# Run optional tests
2- %if ! (0%{? rhel })
2+
33%{bcond_without perl_File_MimeInfo_enables_optional_test}
4- %else
5- %{bcond_with perl_File_MimeInfo_enables_optional_test}
6- %endif
7- # Require shared-mime-info to suppress warnings about missing
8- # /usr/share/mime/globs
9- %{bcond_without perl_File_MimeInfo_enables_shared_mime_info}
4+
5+ # Use IO::Scalar to support processing a standard input in a mimetype tool
6+ %{bcond_without perl_File_MimeInfo_enables_stdin}
7+ # Use Pod::Usage to support printing a usage text by a mimetype tool
8+ %{bcond_without perl_File_MimeInfo_enables_usage}
109
1110Name: perl-File-MimeInfo
12- Version: 0.29
13- Release: 7 %{?dist }
11+ Version: 0.35
12+ Release: 3 %{?dist }
1413Summary: Determine file type and open application
15- License: GPL+ or Artistic
14+ License: GPL-1.0-or-later OR Artistic-1.0 -Perl
1615Vendor: Microsoft Corporation
1716Distribution: Azure Linux
1817URL: https://metacpan.org/release/File-MimeInfo
1918Source0: https://cpan.metacpan.org/authors/id/M/MI/MICHIELB/File-MimeInfo-%{version }.tar.gz#/perl-File-MimeInfo-%{version}.tar.gz
2019BuildArch: noarch
21- BuildRequires: findutils
20+ BuildRequires: coreutils
2221BuildRequires: make
23- BuildRequires: perl-interpreter
2422BuildRequires: perl-generators
25- BuildRequires: perl(ExtUtils::MakeMaker)
23+ BuildRequires: perl-interpreter
24+ BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
2625BuildRequires: perl(strict)
2726BuildRequires: perl(warnings)
2827# Run-time:
2928BuildRequires: perl(bytes)
3029BuildRequires: perl(Carp)
30+ BuildRequires: perl(Encode)
31+ BuildRequires: perl(Encode::Locale)
3132BuildRequires: perl(Exporter)
3233BuildRequires: perl(Fcntl)
3334BuildRequires: perl(File::BaseDir) >= 0.03
3435BuildRequires: perl(File::DesktopEntry) >= 0.04
3536BuildRequires: perl(File::Spec)
37+ # Optional run-time:
38+ %if %{with perl_File_MimeInfo_enables_stdin }
39+ BuildRequires: perl(IO::Scalar)
40+ %endif
41+ %if %{with perl_File_MimeInfo_enables_usage }
42+ BuildRequires: perl(Pod::Usage)
43+ %endif
3644# Tests:
3745BuildRequires: perl(FindBin)
46+ BuildRequires: perl(File::Temp)
3847BuildRequires: perl(Test::More) >= 0.88
48+ # Needed for creating of mimeinfo.cache in tests
49+ BuildRequires: desktop-file-utils
50+ # t/11mimeinfo.t executes ./mimetype that returns an unexpected MIME type
51+ # without shared-mime-info database
52+ BuildRequires: shared-mime-info
3953%if %{with perl_File_MimeInfo_enables_optional_test }
4054# Optional tests:
4155%if ! %{defined perl_bootstrap }
4256# Break build cycle: perl-Path-Tiny → perl-Unicode-UTF8 →
43- # perl-Module-Install-ReademFromPod → perl-IO-All → perl-File-MimeInfo
57+ # perl-Module-Install-ReadmeFromPod → perl-IO-All → perl-File-MimeInfo
4458BuildRequires: perl(Path::Tiny)
4559%endif
4660BuildRequires: perl(Test::Pod) >= 1.00
4761BuildRequires: perl(Test::Pod::Coverage) >= 1.00
48- %if %{with perl_File_MimeInfo_enables_shared_mime_info }
49- # needed for some tests otherwise there are warnings
50- BuildRequires: shared-mime-info
62+ # Test::Pod::No404s not used
5163%endif
52- %endif
53- %if %{with perl_File_MimeInfo_enables_shared_mime_info }
54- # there is also a mimeinfo.cache file created by desktop-file-utils
55- # needed. It won't be there if building in a chroot, even if
56- # desktop-file-utils is installed if desktop-file-utils was never run.
57- Requires: shared-mime-info
58- %endif
59- Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
6064Requires: perl(File::BaseDir) >= 0.03
6165Requires: perl(File::DesktopEntry) >= 0.04
66+ %if %{with perl_File_MimeInfo_enables_stdin }
67+ Recommends: perl(IO::Scalar)
68+ %endif
69+ %if %{with perl_File_MimeInfo_enables_usage }
70+ Recommends: perl(Pod::Usage)
71+ %endif
72+ # It's optional, but without it File::MimeInfo produces an annoying warning
73+ # about a missing /usr/share/mime/globs and returns inaccurate results.
74+ Recommends: shared-mime-info
6275
6376# Filter under-specified dependencies
6477%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\((File::BaseDir|File::DesktopEntry)\\)$
@@ -67,19 +80,48 @@ Requires: perl(File::DesktopEntry) >= 0.04
6780This module can be used to determine the mime type of a file. It tries to
6881implement the freedesktop specification for a shared MIME database.
6982
83+ %package tests
84+ Summary: Tests for %{name }
85+ Requires: %{name } = %{?epoch:%{epoch }:}%{version }-%{release }
86+ Requires: desktop-file-utils
87+ Requires: perl-Test-Harness
88+ Requires: shared-mime-info
89+
90+ %description tests
91+ Tests from %{name }. Execute them
92+ with "%{_libexecdir }/%{name }/test".
93+
7094%prep
7195%setup -q -n File-MimeInfo-%{version }
96+ # Remove test, which tests tool app in different place.
97+ rm -f t/11mimeinfo.t
98+ # Fix permissions
99+ chmod -x t/default/binary_file
100+ chmod -x t/magic/application_x-executable
101+ # Help generators to recognize Perl scripts
102+ for F in t/* .t; do
103+ perl -i -MConfig -ple ' print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' " $F "
104+ chmod +x " $F "
105+ done
72106
73107%build
74- perl Makefile.PL INSTALLDIRS=vendor
75- make %{? _smp_mflags }
108+ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
109+ %{ make_build }
76110
77111%install
78- make pure_install DESTDIR=$RPM_BUILD_ROOT
79- find $RPM_BUILD_ROOT -type f -name .packlist -delete
80- %{_fixperms } $RPM_BUILD_ROOT /*
112+ %{make_install }
113+ %{_fixperms } %{buildroot }/*
114+ # Install tests
115+ mkdir -p %{buildroot }%{_libexecdir }/%{name }
116+ cp -a t %{buildroot }%{_libexecdir }/%{name }
117+ cat > %{buildroot }%{_libexecdir }/%{name }/test << 'EOF '
118+ #!/bin/sh
119+ cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
120+ EOF
121+ chmod +x %{buildroot }%{_libexecdir }/%{name }/test
81122
82123%check
124+ unset EXTENDED_TESTING
83125make test
84126
85127%files
@@ -90,9 +132,83 @@ make test
90132%{_mandir }/man1/*
91133%{_mandir }/man3/*
92134
135+ %files tests
136+ %{_libexecdir }/%{name }
137+
93138%changelog
94- *
Fri Oct 15 2021 Pawel Winogrodzki <[email protected] > -
0.29-7 95- - Initial CBL-Mariner import from Fedora 32 (license: MIT).
139+ *
Wed May 07 2025 Aninda Pradhan <[email protected] > -
0.35-3 140+ - Initial Azure Linux import from Fedora 41 (license: MIT)
141+ - License Verified
142+
143+ *
Fri Jul 19 2024 Fedora Release Engineering <[email protected] > -
0.35-2 144+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
145+
146+ *
Fri Apr 26 2024 Jitka Plesnikova <[email protected] > -
0.35-1 147+ - 0.35 bump (rhbz#2277224)
148+
149+ *
Thu Jan 25 2024 Fedora Release Engineering <[email protected] > -
0.34-3 150+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
151+
152+ *
Sun Jan 21 2024 Fedora Release Engineering <[email protected] > -
0.34-2 153+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
154+
155+ *
Mon Dec 04 2023 Jitka Plesnikova <[email protected] > -
0.34-1 156+ - 0.34 bump (rhbz#2252645)
157+
158+ *
Thu Jul 20 2023 Fedora Release Engineering <[email protected] > -
0.33-4 159+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
160+
161+ *
Fri Jan 20 2023 Fedora Release Engineering <[email protected] > -
0.33-3 162+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
163+
164+ *
Fri Jul 22 2022 Fedora Release Engineering <[email protected] > -
0.33-2 165+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
166+
167+ *
Wed Jul 13 2022 Jitka Plesnikova <[email protected] > -
0.33-1 168+ - 0.33 bump
169+
170+ *
Fri Jun 03 2022 Jitka Plesnikova <[email protected] > -
0.32-3 171+ - Perl 5.36 re-rebuild of bootstrapped packages
172+
173+ *
Wed Jun 01 2022 Jitka Plesnikova <[email protected] > -
0.32-2 174+ - Perl 5.36 rebuild
175+
176+ *
Mon Mar 07 2022 Michal Josef Špaček <[email protected] > -
0.32-1 177+ - 0.32 bump
178+ - Package tests
179+
180+ *
Fri Jan 21 2022 Fedora Release Engineering <[email protected] > -
0.31-2 181+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
182+
183+ *
Thu Jan 06 2022 Jitka Plesnikova <[email protected] > -
0.31-1 184+ - 0.31 bump
185+
186+ *
Thu Jul 22 2021 Fedora Release Engineering <[email protected] > -
0.30-5 187+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
188+
189+ *
Mon May 24 2021 Jitka Plesnikova <[email protected] > -
0.30-4 190+ - Perl 5.34 re-rebuild of bootstrapped packages
191+
192+ *
Fri May 21 2021 Jitka Plesnikova <[email protected] > -
0.30-3 193+ - Perl 5.34 rebuild
194+
195+ *
Wed Jan 27 2021 Fedora Release Engineering <[email protected] > -
0.30-2 196+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
197+
198+ *
Tue Oct 27 2020 Jitka Plesnikova <[email protected] > -
0.30-1 199+ - 0.30 bump
200+
201+ *
Tue Jul 28 2020 Fedora Release Engineering <[email protected] > -
0.29-10 202+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
203+
204+ *
Fri Jun 26 2020 Jitka Plesnikova <[email protected] > -
0.29-9 205+ - Perl 5.32 re-rebuild of bootstrapped packages
206+
207+ *
Tue Jun 23 2020 Jitka Plesnikova <[email protected] > -
0.29-8 208+ - Perl 5.32 rebuild
209+
210+ *
Tue Jun 23 2020 Petr Pisar <[email protected] > -
0.29-7 211+ - Specify all dependencies
96212
97213*
Thu Jan 30 2020 Fedora Release Engineering <[email protected] > -
0.29-6 98214- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
@@ -249,3 +365,4 @@ make test
249365
250366*
Wed Oct 11 2006 Patrice Dumas <[email protected] > 0.13-1 251367- Specfile autogenerated by cpanspec 1.69.
368+
0 commit comments