From b6376c1731b650fdd60df544df377f80af1ffb71 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 10 Feb 2022 13:40:55 +0100 Subject: [PATCH] Resolves: rhbz#2037211 - perl-CPAN: Bypass of verification of signatures in CHECKSUMS files --- .fmf/version | 1 + .gitignore | 1 + CPAN-2.32-s-dev-null-devnull.patch | 26 + ...pg-in-system-add-quotes-where-needed.patch | 29 + perl-CPAN.spec | 75 ++- plans/sanity.fmf | 5 + sources | 2 +- tests/CPAN-2.32-s-dev-null-devnull.patch | 26 + ...pg-in-system-add-quotes-where-needed.patch | 29 + tests/perl-CPAN.spec | 497 ++++++++++++++++++ tests/sources | 1 + tests/upstream-tests.fmf | 4 + 12 files changed, 692 insertions(+), 4 deletions(-) create mode 100644 .fmf/version create mode 100644 CPAN-2.32-s-dev-null-devnull.patch create mode 100644 CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch create mode 100644 plans/sanity.fmf create mode 100644 tests/CPAN-2.32-s-dev-null-devnull.patch create mode 100644 tests/CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch create mode 100644 tests/perl-CPAN.spec create mode 100644 tests/sources create mode 100644 tests/upstream-tests.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index fc6be62..872c0e3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /CPAN-2.26.tar.gz /CPAN-2.27.tar.gz /CPAN-2.28.tar.gz +/CPAN-2.29.tar.gz diff --git a/CPAN-2.32-s-dev-null-devnull.patch b/CPAN-2.32-s-dev-null-devnull.patch new file mode 100644 index 0000000..56063d8 --- /dev/null +++ b/CPAN-2.32-s-dev-null-devnull.patch @@ -0,0 +1,26 @@ +From 89b13baf1d46e4fb10023af30ef305efec4fd603 Mon Sep 17 00:00:00 2001 +From: Andreas Koenig +Date: Wed, 12 Jan 2022 21:53:35 +0100 +Subject: [PATCH 2/2] s,/dev/null,$devnull, + +- another thanks to Tomas Hoger for spotting that +--- + lib/CPAN/Distribution.pm | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/CPAN/Distribution.pm b/lib/CPAN/Distribution.pm +index d837b8ad..6ca1b434 100644 +--- a/lib/CPAN/Distribution.pm ++++ b/lib/CPAN/Distribution.pm +@@ -1554,7 +1554,7 @@ sub CHECKSUM_check_file { + my $devnull = File::Spec->devnull; + my $gpg = $CPAN::Config->{gpg} or + $CPAN::Frontend->mydie("Your configuration suggests that you do not have 'gpg' installed. This is needed to verify checksums with the config variable 'check_sigs' on. Please configure it with 'o conf init gpg'"); +- my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "/dev/null"}; ++ my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "$devnull"}; + 0 == system $system or $CPAN::Frontend->mydie("gpg run was failing, cannot continue: $system"); + open $fh, $tempfile or $CPAN::Frontend->mydie("Could not open $tempfile: $!"); + local $/; +-- +2.34.1 + diff --git a/CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch b/CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch new file mode 100644 index 0000000..56216e7 --- /dev/null +++ b/CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch @@ -0,0 +1,29 @@ +From 7d4d5e32bcd9b75f7bf70a395938a48ca4a06d25 Mon Sep 17 00:00:00 2001 +From: Andreas Koenig +Date: Mon, 10 Jan 2022 21:47:30 +0100 +Subject: [PATCH 1/2] s/gpg/$gpg/ in system, add quotes where needed + +- thanks to Tomas Hoger for spotting the missing sigil +--- + lib/CPAN/Distribution.pm | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/CPAN/Distribution.pm b/lib/CPAN/Distribution.pm +index b262b6f6..d837b8ad 100644 +--- a/lib/CPAN/Distribution.pm ++++ b/lib/CPAN/Distribution.pm +@@ -1551,9 +1551,10 @@ sub CHECKSUM_check_file { + } + my $tempfile = File::Spec->catfile($tempdir, "CHECKSUMS.$$"); + unlink $tempfile; # ignore missing file ++ my $devnull = File::Spec->devnull; + my $gpg = $CPAN::Config->{gpg} or + $CPAN::Frontend->mydie("Your configuration suggests that you do not have 'gpg' installed. This is needed to verify checksums with the config variable 'check_sigs' on. Please configure it with 'o conf init gpg'"); +- my $system = "gpg --verify --batch --no-tty --output $tempfile $chk_file 2> /dev/null"; ++ my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "/dev/null"}; + 0 == system $system or $CPAN::Frontend->mydie("gpg run was failing, cannot continue: $system"); + open $fh, $tempfile or $CPAN::Frontend->mydie("Could not open $tempfile: $!"); + local $/; +-- +2.34.1 + diff --git a/perl-CPAN.spec b/perl-CPAN.spec index aebd73c..f814c04 100644 --- a/perl-CPAN.spec +++ b/perl-CPAN.spec @@ -9,8 +9,8 @@ %endif Name: perl-CPAN -Version: 2.28 -Release: 8%{?dist} +Version: 2.29 +Release: 1%{?dist} Summary: Query, download and build perl modules from CPAN sites License: GPL+ or Artistic URL: https://metacpan.org/release/CPAN @@ -19,6 +19,9 @@ Source0: https://cpan.metacpan.org/authors/id/A/AN/ANDK/CPAN-%{version}.t Patch0: CPAN-2.18-Attemp-to-create-site-library-directories-on-first-t.patch # Change configuration directory name Patch1: CPAN-2.18-Replace-configuration-directory-string-with-a-marke.patch +# Some syntax fixes +Patch2: CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch +Patch3: CPAN-2.32-s-dev-null-devnull.patch BuildArch: noarch BuildRequires: coreutils BuildRequires: findutils @@ -69,6 +72,7 @@ BuildRequires: perl(Getopt::Std) # HTTP::Request is optional BuildRequires: perl(HTTP::Tiny) >= 0.005 BuildRequires: perl(if) +# IO::Socket::SSL 1.56 is optional # YAML::XS or YAML::Syck or JSON::PP, we already use YAML::Syck at a different # place, keep JSON::PP optional BuildRequires: perl(lib) @@ -81,6 +85,7 @@ BuildRequires: perl(lib) # Net::Config not used at tests # Net::FTP not used at tests # Net::Ping is required but >= 2.13 version is a soft dependency +# Net::SSLeay 1.49 is optional BuildRequires: perl(Net::Ping) BuildRequires: perl(overload) # Pod::Perldoc is optional @@ -205,6 +210,11 @@ Requires: perl(Digest::SHA) Requires: perl(Dumpvalue) Requires: perl(ExtUtils::CBuilder) %if ! %{defined perl_bootstrap} +Requires: perl(IO::Socket::SSL) >= 1.56 +Requires: perl(Net::SSLeay) >= 1.49 +Requires: perl(Module::Signature) +%endif +%if ! %{defined perl_bootstrap} # Avoid circular deps local::lib -> Module::Install -> CPAN when bootstraping # local::lib recommended by CPAN::FirstTime default choice, bug #1122498 Requires: perl(local::lib) @@ -228,7 +238,10 @@ Provides: cpan = %{version} %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Mac::BuildTools\\) # Filter under-specified dependencies %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(CPAN::Meta::Requirements\\) - +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{__requires_exclude}|^perl\\(CPAN::MyConfig\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(local_utils\\) %description The CPAN module automates or at least simplifies the make and install of @@ -236,16 +249,33 @@ perl modules and extensions. It includes some primitive searching capabilities and knows how to use LWP, HTTP::Tiny, Net::FTP and certain external download clients to fetch distributions from the net. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n CPAN-%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 # Change configuration name find -type f -exec perl -i -pe 's/XCPANCONFIGNAMEX/cpan/g' {} \; # Remove bundled modules rm -r ./inc/* perl -i -ne 'print $_ unless m{^inc/}' MANIFEST +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} @@ -254,6 +284,38 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_install} %{_fixperms} $RPM_BUILD_ROOT/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t distroprefs %{buildroot}%{_libexecdir}/%{name} +# Does not work with system module +rm %{buildroot}%{_libexecdir}/%{name}/t/51pod.t +# Remove the tests which need ./lib and ./blib +rm %{buildroot}%{_libexecdir}/%{name}/t/03pkgs.t +rm %{buildroot}%{_libexecdir}/%{name}/t/04clean_load.t +# Needed internet connection +rm %{buildroot}%{_libexecdir}/%{name}/t/31sessions.t +# Use system modules for tests +perl -i -ple 's{-Mblib}{}' %{buildroot}%{_libexecdir}/%{name}/t/97-run.t +perl -i -ple 's{-Mblib}{}' %{buildroot}%{_libexecdir}/%{name}/t/97-return_values.t +mkdir -p %{buildroot}%{_libexecdir}/%{name}/blib/script +ln -s %{_bindir}/cpan %{buildroot}%{_libexecdir}/%{name}/blib/script +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +set -e +unset AUTHOR_TEST CPAN_EXPECT_TIMEOUT CPAN_RUN_SHELL_TEST_WITHOUT_EXPECT \ + ftp_proxy http_proxy no_proxy \ + PERL5_CPAN_IS_RUNNING PERL5_CPAN_IS_RUNNING_IN_RECURSION PERL_CORE VERBOSE +# Some tests write into temporary files/directories. The easiest solution +# is to copy the tests into a writable directory and execute them from there. +DIR=$(mktemp -d) +pushd "$DIR" +cp -a %{_libexecdir}/%{name}/* ./ +prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +popd +rm -rf "$DIR" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test + %check unset AUTHOR_TEST CPAN_EXPECT_TIMEOUT CPAN_RUN_SHELL_TEST_WITHOUT_EXPECT \ ftp_proxy http_proxy no_proxy \ @@ -267,7 +329,14 @@ make test %{_mandir}/man1/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Feb 07 2022 Jitka Plesnikova - 2.29-1 +- 2.29 bump; Package tests +- Resolves: rhbz#2037211 + * Mon Aug 09 2021 Mohan Boddu - 2.28-8 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688 diff --git a/plans/sanity.fmf b/plans/sanity.fmf new file mode 100644 index 0000000..a72ded4 --- /dev/null +++ b/plans/sanity.fmf @@ -0,0 +1,5 @@ +summary: Sanity tests +discover: + how: fmf +execute: + how: tmt diff --git a/sources b/sources index 8779bed..0aeb189 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (CPAN-2.28.tar.gz) = 1b79bf08ab46be12f0c5cc8cd5c893cf5b77b02f76c1d118d6c8af5370ce0beb6bef7071a35b2b53e520a102f09e2c915c7aa52127a80e4f594452e50bbfaa82 +SHA512 (CPAN-2.29.tar.gz) = ef25f4575e41d11064e516739af95808d5d425fefb2693db1f91733e6d3064650273712325a0b862e8d88105c79d323e1f6f14430608effe0f2a04534d7213a1 diff --git a/tests/CPAN-2.32-s-dev-null-devnull.patch b/tests/CPAN-2.32-s-dev-null-devnull.patch new file mode 100644 index 0000000..56063d8 --- /dev/null +++ b/tests/CPAN-2.32-s-dev-null-devnull.patch @@ -0,0 +1,26 @@ +From 89b13baf1d46e4fb10023af30ef305efec4fd603 Mon Sep 17 00:00:00 2001 +From: Andreas Koenig +Date: Wed, 12 Jan 2022 21:53:35 +0100 +Subject: [PATCH 2/2] s,/dev/null,$devnull, + +- another thanks to Tomas Hoger for spotting that +--- + lib/CPAN/Distribution.pm | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/CPAN/Distribution.pm b/lib/CPAN/Distribution.pm +index d837b8ad..6ca1b434 100644 +--- a/lib/CPAN/Distribution.pm ++++ b/lib/CPAN/Distribution.pm +@@ -1554,7 +1554,7 @@ sub CHECKSUM_check_file { + my $devnull = File::Spec->devnull; + my $gpg = $CPAN::Config->{gpg} or + $CPAN::Frontend->mydie("Your configuration suggests that you do not have 'gpg' installed. This is needed to verify checksums with the config variable 'check_sigs' on. Please configure it with 'o conf init gpg'"); +- my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "/dev/null"}; ++ my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "$devnull"}; + 0 == system $system or $CPAN::Frontend->mydie("gpg run was failing, cannot continue: $system"); + open $fh, $tempfile or $CPAN::Frontend->mydie("Could not open $tempfile: $!"); + local $/; +-- +2.34.1 + diff --git a/tests/CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch b/tests/CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch new file mode 100644 index 0000000..56216e7 --- /dev/null +++ b/tests/CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch @@ -0,0 +1,29 @@ +From 7d4d5e32bcd9b75f7bf70a395938a48ca4a06d25 Mon Sep 17 00:00:00 2001 +From: Andreas Koenig +Date: Mon, 10 Jan 2022 21:47:30 +0100 +Subject: [PATCH 1/2] s/gpg/$gpg/ in system, add quotes where needed + +- thanks to Tomas Hoger for spotting the missing sigil +--- + lib/CPAN/Distribution.pm | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/CPAN/Distribution.pm b/lib/CPAN/Distribution.pm +index b262b6f6..d837b8ad 100644 +--- a/lib/CPAN/Distribution.pm ++++ b/lib/CPAN/Distribution.pm +@@ -1551,9 +1551,10 @@ sub CHECKSUM_check_file { + } + my $tempfile = File::Spec->catfile($tempdir, "CHECKSUMS.$$"); + unlink $tempfile; # ignore missing file ++ my $devnull = File::Spec->devnull; + my $gpg = $CPAN::Config->{gpg} or + $CPAN::Frontend->mydie("Your configuration suggests that you do not have 'gpg' installed. This is needed to verify checksums with the config variable 'check_sigs' on. Please configure it with 'o conf init gpg'"); +- my $system = "gpg --verify --batch --no-tty --output $tempfile $chk_file 2> /dev/null"; ++ my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "/dev/null"}; + 0 == system $system or $CPAN::Frontend->mydie("gpg run was failing, cannot continue: $system"); + open $fh, $tempfile or $CPAN::Frontend->mydie("Could not open $tempfile: $!"); + local $/; +-- +2.34.1 + diff --git a/tests/perl-CPAN.spec b/tests/perl-CPAN.spec new file mode 100644 index 0000000..823f1e3 --- /dev/null +++ b/tests/perl-CPAN.spec @@ -0,0 +1,497 @@ +# Don not run gnupg1 tests by default, they need network access +# (Socket::inet_aton('pool.sks-keyservers.net')). +%bcond_with perl_CPAN_enables_gnupg_test +# Run optional test +%if ! (0%{?rhel}) +%bcond_without perl_CPAN_enables_optional_test +%else +%bcond_with perl_CPAN_enables_optional_test +%endif + +Name: perl-CPAN +Version: 2.29 +Release: 1%{?dist} +Summary: Query, download and build perl modules from CPAN sites +License: GPL+ or Artistic +URL: https://metacpan.org/release/CPAN +Source0: https://cpan.metacpan.org/authors/id/A/AN/ANDK/CPAN-%{version}.tar.gz +# Create site paths for the first time, bug #1158873, CPAN RT#99905 +Patch0: CPAN-2.18-Attemp-to-create-site-library-directories-on-first-t.patch +# Change configuration directory name +Patch1: CPAN-2.18-Replace-configuration-directory-string-with-a-marke.patch +# Some syntax fixes +Patch2: CPAN-2.32-s-gpg-gpg-in-system-add-quotes-where-needed.patch +Patch3: CPAN-2.32-s-dev-null-devnull.patch +BuildArch: noarch +BuildRequires: coreutils +BuildRequires: findutils +BuildRequires: make +BuildRequires: perl-generators +BuildRequires: perl-interpreter +BuildRequires: perl(Config) +BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 +BuildRequires: perl(File::Basename) +BuildRequires: perl(File::Path) +# Module::Signature not used +BuildRequires: perl(strict) +BuildRequires: perl(vars) +# Optional: +BuildRequires: perl(File::Spec) +# YAML::Syck is not used because @ST_PREFS is empty in Makefile.PL + +# Run-time: +# Prefer Archive::Tar and Compress::Zlib over tar and gzip +BuildRequires: perl(Archive::Tar) >= 1.50 +%if !%{defined perl_bootstrap} +# Prefer Archive::Zip over unzip +BuildRequires: perl(Archive::Zip) +%endif +BuildRequires: perl(autouse) +BuildRequires: perl(base) +BuildRequires: perl(Carp) +BuildRequires: perl(constant) +BuildRequires: perl(Compress::Zlib) +BuildRequires: perl(CPAN::Meta::Requirements) >= 2.121 +BuildRequires: perl(Cwd) +BuildRequires: perl(Data::Dumper) +# Devel::Size not used at tests +BuildRequires: perl(DirHandle) +BuildRequires: perl(Dumpvalue) +BuildRequires: perl(Errno) +BuildRequires: perl(Exporter) +# ExtUtils::Manifest not used at tests +BuildRequires: perl(Fcntl) +BuildRequires: perl(File::Copy) +BuildRequires: perl(File::Find) +# File::HomeDir 0.65 not used at tests +BuildRequires: perl(File::Spec::Functions) +BuildRequires: perl(File::Temp) >= 0.16 +BuildRequires: perl(FileHandle) +BuildRequires: perl(Getopt::Std) +# HTTP::Date is optional, prefer in-core Time::Local +# HTTP::Request is optional +BuildRequires: perl(HTTP::Tiny) >= 0.005 +BuildRequires: perl(if) +# IO::Socket::SSL 1.56 is optional +# YAML::XS or YAML::Syck or JSON::PP, we already use YAML::Syck at a different +# place, keep JSON::PP optional +BuildRequires: perl(lib) +# local::lib is optional +# LWP is optional, prefer HTTP::Tiny and Net::FTP +# LWP::UserAgent is optional +# Mac::BuildTools not needed +# Mac::Files not needed +# Module::Signature is optional +# Net::Config not used at tests +# Net::FTP not used at tests +# Net::Ping is required but >= 2.13 version is a soft dependency +# Net::SSLeay 1.49 is optional +BuildRequires: perl(Net::Ping) +BuildRequires: perl(overload) +# Pod::Perldoc is optional +BuildRequires: perl(POSIX) +BuildRequires: perl(Safe) +BuildRequires: perl(Sys::Hostname) +BuildRequires: perl(Term::ReadLine) +BuildRequires: perl(Text::ParseWords) +BuildRequires: perl(Text::Wrap) +# Time::Local not used at tests +# URI not used at tests +# URI::Escape not used at tests +# URI::URL 0.08 is optional +# User::pwent not used at tests +BuildRequires: perl(warnings) +# Optional: +#%%if !%%{defined perl_bootstrap} +# CPAN::DistnameInfo not used at tests +#%%endif +BuildRequires: perl(CPAN::Meta) >= 2.110350 +# Crypt::OpenPGP not used at tests +# Digest::MD5 not used at tests +BuildRequires: perl(Digest::SHA) +# Keep Log::Log4perl optional +# Keep MIME::Base64 optional +%if !%{defined perl_bootstrap} +BuildRequires: perl(Module::Build) +%endif + +# Tests: +BuildRequires: perl(blib) +# CPAN::Checksums not used +BuildRequires: perl(FindBin) +BuildRequires: perl(Pod::Usage) +BuildRequires: perl(Test::More) +BuildRequires: perl(version) + +%if %{with perl_CPAN_enables_optional_test} +# Optional tests: +%if %{with perl_CPAN_enables_gnupg_test} +BuildRequires: %{_bindir}/gpg +# CPAN::Perl::Releases is helpfull only on RC or TRIAL Perl interpreters +# Digest::SHA1 not needed if Digest::SHA is available +# Digest::SHA::PurePerl not needed if Digest::SHA is available +%endif +%if !%{defined perl_bootstrap} +BuildRequires: perl(Expect) +%endif +BuildRequires: perl(Hash::Util) +%if !%{defined perl_bootstrap} +# Kwalify not yet packaged +%if %{with perl_CPAN_enables_gnupg_test} +BuildRequires: perl(Module::Signature) >= 0.66 +%endif +BuildRequires: perl(Perl::Version) +%endif +BuildRequires: perl(Pod::Perldoc::ToMan) +%if %{with perl_CPAN_enables_gnupg_test} +BuildRequires: perl(Socket) +%endif +%if !%{defined perl_bootstrap} +BuildRequires: perl(Sort::Versions) +# Test::MinimumVersion not used +# Test::Perl::Critic not used +BuildRequires: perl(Test::Pod) >= 1.00 +BuildRequires: perl(Test::Pod::Coverage) >= 0.18 +BuildRequires: perl(YAML) >= 0.60 +%endif +%endif + +Requires: make +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +# Some subpackages modules are not dual-lived. E.g. "open". If a distribution +# on CPAN declares a dependency on such a module, CPAN client will fail +# because the only provider is perl distribution. +# Another issue is with dual-lived modules whose distribution actually does +# not declare all needed core dependencies and the installation would also +# fail. +# As a result, any CPAN client must run-require the complete perl. +Requires: perl +Requires: perl(Archive::Tar) >= 1.50 +%if !%{defined perl_bootstrap} +Recommends: perl(CPAN::DistnameInfo) +%endif +Requires: perl(CPAN::Meta::Requirements) >= 2.121 +Requires: perl(Data::Dumper) +%if !%{defined perl_bootstrap} +Requires: perl(Devel::Size) +%endif +Requires: perl(ExtUtils::Manifest) +%if !%{defined perl_bootstrap} +Requires: perl(File::HomeDir) >= 0.65 +%endif +Requires: perl(File::Temp) >= 0.16 +# YAML::XS or YAML::Syck or JSON::PP, we already use YAML::Syck at a different +# place, keep JSON::PP optional +Requires: perl(lib) +%if !%{defined perl_bootstrap} +Suggests: perl(Log::Log4perl) +%endif +Requires: perl(Net::Config) +Requires: perl(Net::FTP) +Requires: perl(POSIX) +Requires: perl(Term::ReadLine) +Requires: perl(Time::Local) +%if !%{defined perl_bootstrap} +Requires: perl(URI) +Requires: perl(URI::Escape) +%endif +Requires: perl(User::pwent) +# Optional but highly recommended: +%if !%{defined perl_bootstrap} +# Prefer Archive::Zip over unzip +Requires: perl(Archive::Zip) +Requires: perl(Compress::Bzip2) +Requires: perl(CPAN::Meta) >= 2.110350 +%endif +Requires: perl(Compress::Zlib) +Requires: perl(Digest::MD5) +# CPAN encourages Digest::SHA strongly because of integrity checks +Requires: perl(Digest::SHA) +Requires: perl(Dumpvalue) +Requires: perl(ExtUtils::CBuilder) +%if ! %{defined perl_bootstrap} +Requires: perl(IO::Socket::SSL) >= 1.56 +Requires: perl(Net::SSLeay) >= 1.49 +Requires: perl(Module::Signature) +%endif +%if ! %{defined perl_bootstrap} +# Avoid circular deps local::lib -> Module::Install -> CPAN when bootstraping +# local::lib recommended by CPAN::FirstTime default choice, bug #1122498 +Requires: perl(local::lib) +%endif +%if ! %{defined perl_bootstrap} +Requires: perl(Module::Build) +%endif +Recommends: perl(Pod::Perldoc) +%if ! %{defined perl_bootstrap} +Recommends: perl(Term::ReadKey) +Requires: perl(Text::Glob) +# Text::Levenshtein::XS or Text::Levenshtein::Damerau::XS or Text::Levenshtein +# or Text::Levenshtein::Damerau::PP +Suggests: perl(Text::Levenshtein::Damerau::XS) +# YAML::Syck or YAML or Data::Dumper or overload +Suggests: perl(YAML::Syck) +%endif +Provides: cpan = %{version} + +# Filter non-Linux dependencies +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Mac::BuildTools\\) +# Filter under-specified dependencies +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(CPAN::Meta::Requirements\\) +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{__requires_exclude}|^perl\\(CPAN::MyConfig\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(local_utils\\) + +%description +The CPAN module automates or at least simplifies the make and install of +perl modules and extensions. It includes some primitive searching +capabilities and knows how to use LWP, HTTP::Tiny, Net::FTP and certain +external download clients to fetch distributions from the net. + +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + +%prep +%setup -q -n CPAN-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +# Change configuration name +find -type f -exec perl -i -pe 's/XCPANCONFIGNAMEX/cpan/g' {} \; +# Remove bundled modules +rm -r ./inc/* +perl -i -ne 'print $_ unless m{^inc/}' MANIFEST + +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + +%build +perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 +%{make_build} + +%install +%{make_install} +%{_fixperms} $RPM_BUILD_ROOT/* + +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t distroprefs %{buildroot}%{_libexecdir}/%{name} +# Does not work with system module +rm %{buildroot}%{_libexecdir}/%{name}/t/51pod.t +# Remove the tests which need ./lib and ./blib +rm %{buildroot}%{_libexecdir}/%{name}/t/03pkgs.t +rm %{buildroot}%{_libexecdir}/%{name}/t/04clean_load.t +# Needed internet connection +rm %{buildroot}%{_libexecdir}/%{name}/t/31sessions.t +# Use system modules for tests +perl -i -ple 's{-Mblib}{}' %{buildroot}%{_libexecdir}/%{name}/t/97-run.t +perl -i -ple 's{-Mblib}{}' %{buildroot}%{_libexecdir}/%{name}/t/97-return_values.t +mkdir -p %{buildroot}%{_libexecdir}/%{name}/blib/script +ln -s %{_bindir}/cpan %{buildroot}%{_libexecdir}/%{name}/blib/script +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +set -e +unset AUTHOR_TEST CPAN_EXPECT_TIMEOUT CPAN_RUN_SHELL_TEST_WITHOUT_EXPECT \ + ftp_proxy http_proxy no_proxy \ + PERL5_CPAN_IS_RUNNING PERL5_CPAN_IS_RUNNING_IN_RECURSION PERL_CORE VERBOSE +# Some tests write into temporary files/directories. The easiest solution +# is to copy the tests into a writable directory and execute them from there. +DIR=$(mktemp -d) +pushd "$DIR" +cp -a %{_libexecdir}/%{name}/* ./ +prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +popd +rm -rf "$DIR" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test + +%check +unset AUTHOR_TEST CPAN_EXPECT_TIMEOUT CPAN_RUN_SHELL_TEST_WITHOUT_EXPECT \ + ftp_proxy http_proxy no_proxy \ + PERL5_CPAN_IS_RUNNING PERL5_CPAN_IS_RUNNING_IN_RECURSION PERL_CORE VERBOSE +make test + +%files +%doc Changes PAUSE*.pub README Todo +%{_bindir}/* +%{perl_vendorlib}/* +%{_mandir}/man1/* +%{_mandir}/man3/* + +%files tests +%{_libexecdir}/%{name} + +%changelog +* Mon Feb 07 2022 Jitka Plesnikova - 2.29-1 +- 2.29 bump; Package tests +- Resolves: rhbz# 2037211 + +* Mon Aug 09 2021 Mohan Boddu - 2.28-8 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Apr 16 2021 Mohan Boddu - 2.28-7 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 2.28-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Sep 23 2020 Petr Pisar - 2.28-5 +- Run-require complete perl + +* Tue Jul 28 2020 Fedora Release Engineering - 2.28-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri Jun 26 2020 Jitka Plesnikova - 2.28-3 +- Perl 5.32 re-rebuild of bootstrapped packages + +* Mon Jun 22 2020 Jitka Plesnikova - 2.28-2 +- Perl 5.32 rebuild + +* Mon Jun 15 2020 Petr Pisar - 2.28-1 +- 2.28 bump + +* Fri Jan 31 2020 Petr Pisar - 2.27-4 +- Enable loading objects from session YAML files (CPAN RT#131615) + +* Wed Jan 29 2020 Fedora Release Engineering - 2.27-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Jul 26 2019 Fedora Release Engineering - 2.27-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jul 04 2019 Petr Pisar - 2.27-1 +- 2.27 bump + +* Sun Jun 02 2019 Jitka Plesnikova - 2.26-3 +- Perl 5.30 re-rebuild of bootstrapped packages + +* Thu May 30 2019 Jitka Plesnikova - 2.26-2 +- Perl 5.30 rebuild + +* Tue Mar 19 2019 Petr Pisar - 2.26-1 +- 2.26 bump + +* Mon Mar 04 2019 Petr Pisar - 2.25-1 +- 2.25 bump + +* Fri Feb 01 2019 Fedora Release Engineering - 2.22-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Wed Jan 02 2019 Petr Pisar - 2.22-1 +- 2.22 bump + +* Fri Jul 13 2018 Fedora Release Engineering - 2.20-418 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Sun Jul 01 2018 Jitka Plesnikova - 2.20-417 +- Perl 5.28 re-rebuild of bootstrapped packages + +* Tue Jun 26 2018 Jitka Plesnikova - 2.20-416 +- Increase release to favour standalone package + +* Wed May 23 2018 Jitka Plesnikova - 2.20-1 +- Upgrade to 2.20 as provided in perl-5.28.0 + +* Thu Feb 08 2018 Fedora Release Engineering - 2.18-397 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Dec 19 2017 Petr Pisar - 2.18-396 +- Rebase patches to prevent from installing back-up files + +* Thu Jul 27 2017 Fedora Release Engineering - 2.18-395 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Jun 07 2017 Jitka Plesnikova - 2.18-394 +- Perl 5.26 re-rebuild of bootstrapped packages + +* Sat Jun 03 2017 Jitka Plesnikova - 2.18-393 +- Perl 5.26 rebuild + +* Fri May 12 2017 Jitka Plesnikova - 2.18-2 +- Don't BR: perl(Module::Build) when bootstrapping + +* Wed May 10 2017 Petr Pisar - 2.18-1 +- Upgrade to CPAN-2.18 as provided in perl-5.25.12 + +* Wed Feb 15 2017 Petr Pisar - 2.16-1 +- 2.16 bump + +* Sat Feb 11 2017 Fedora Release Engineering - 2.14-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Jan 09 2017 Petr Pisar - 2.14-4 +- Use Perl porter's fix for searching cpan -j file (CPAN RT#116507) +- Fix logging fatal errors (https://github.com/andk/cpanpm/pull/104) + +* Tue Oct 18 2016 Petr Pisar - 2.14-3 +- Apply remains of CVE-2016-1238 fix from perl (CPAN RT#116507) +- Do not search cpan -j file in @INC (CPAN RT#116507) + +* Wed Oct 12 2016 Petr Pisar - 2.14-2 +- Fix CVE-2016-1238 properly (CPAN RT#116507) + +* Mon Jun 27 2016 Petr Pisar - 2.14-1 +- 2.14 bump +- Fix installation from a working directory (CPAN RT#115734) +- Fix "cpan -O" invocation (CPAN RT#115786) +- Do not use Net::FTP if ftp_proxy variable points to an HTTP server + (CPAN RT#110833) +- Recognize URL schemata disregarding the case +- Fix CVE-2016-1238 (loading optional modules from current working directory) +- Recognize exact version dependency operator (CPAN RT#47934) +- Cope with non-digit version strings + +* Wed May 18 2016 Jitka Plesnikova - 2.11-366 +- Perl 5.24 re-rebuild of bootstrapped packages + +* Sat May 14 2016 Jitka Plesnikova - 2.11-365 +- Increase release to favour standalone package + +* Thu Feb 04 2016 Fedora Release Engineering - 2.11-349 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Dec 15 2015 Petr Pisar - 2.11-348 +- Require make package + +* Thu Jun 18 2015 Fedora Release Engineering - 2.11-347 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Jun 10 2015 Jitka Plesnikova - 2.11-346 +- Perl 5.22 re-rebuild of bootstrapped packages + +* Thu Jun 04 2015 Jitka Plesnikova - 2.11-345 +- Increase release to favour standalone package + +* Thu Jun 04 2015 Jitka Plesnikova - 2.11-2 +- Perl 5.22 rebuild + +* Wed May 06 2015 Petr Pisar - 2.11-1 +- 2.11 bump in order to dual-live with perl 5.22 + +* Fri Mar 13 2015 Petr Pisar - 2.10-1 +- 2.10 bump + +* Wed Jan 28 2015 Petr Pisar - 2.05-309 +- Allow changing the configuration directory name + +* Thu Oct 30 2014 Petr Pisar - 2.05-308 +- Create site paths for the first time (bug #1158873) + +* Wed Sep 10 2014 Petr Pisar 2.05-307 +- Synchronize to perl.spec modifications +- Disable non-core modules when bootstrapping + +* Tue Apr 22 2014 Petr Pisar 2.05-1 +- Specfile autogenerated by cpanspec 1.78. diff --git a/tests/sources b/tests/sources new file mode 100644 index 0000000..0aeb189 --- /dev/null +++ b/tests/sources @@ -0,0 +1 @@ +SHA512 (CPAN-2.29.tar.gz) = ef25f4575e41d11064e516739af95808d5d425fefb2693db1f91733e6d3064650273712325a0b862e8d88105c79d323e1f6f14430608effe0f2a04534d7213a1 diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..4582dc3 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-CPAN +require: perl-CPAN-tests +test: /usr/libexec/perl-CPAN/test