From dbb6f68f0fcaa582625348d68b96a55007d0b284 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 27 Mar 2024 20:15:37 +0000 Subject: [PATCH] import CS perl-CPAN-2.18-399.el8 --- SOURCES/CPAN-2.35-Add-verify-SSL.patch | 11 ++++ SPECS/perl-CPAN.spec | 88 ++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 SOURCES/CPAN-2.35-Add-verify-SSL.patch diff --git a/SOURCES/CPAN-2.35-Add-verify-SSL.patch b/SOURCES/CPAN-2.35-Add-verify-SSL.patch new file mode 100644 index 0000000..8222894 --- /dev/null +++ b/SOURCES/CPAN-2.35-Add-verify-SSL.patch @@ -0,0 +1,11 @@ +diff -up CPAN-2.16/lib/CPAN/HTTP/Client.pm.orig CPAN-2.16/lib/CPAN/HTTP/Client.pm +--- CPAN-2.16/lib/CPAN/HTTP/Client.pm.orig 2024-01-17 13:58:05.321031493 +0100 ++++ CPAN-2.16/lib/CPAN/HTTP/Client.pm 2024-01-17 14:07:36.657874287 +0100 +@@ -32,6 +32,7 @@ sub mirror { + + my $want_proxy = $self->_want_proxy($uri); + my $http = HTTP::Tiny->new( ++ verify_SSL => 1, + $want_proxy ? (proxy => $self->{proxy}) : () + ); + diff --git a/SPECS/perl-CPAN.spec b/SPECS/perl-CPAN.spec index 6a3d82d..3b7d0f0 100644 --- a/SPECS/perl-CPAN.spec +++ b/SPECS/perl-CPAN.spec @@ -12,7 +12,7 @@ Name: perl-CPAN Version: 2.18 -Release: 397%{?dist} +Release: 399%{?dist} Summary: Query, download and build perl modules from CPAN sites License: GPL+ or Artistic URL: http://search.cpan.org/dist/CPAN/ @@ -27,6 +27,8 @@ Patch2: CPAN-2.18-Replace-configuration-directory-string-with-a-marke.pa # Do not search cpan -j file in @INC, CPAN RT#116507, proposed in # Patch3: CPAN-2.18-For-cpan-j-make-the-file-an-absolute-path.patch +# CVE-2023-31484 - Add verify_SSL => 1 +Patch4: CPAN-2.35-Add-verify-SSL.patch BuildArch: noarch BuildRequires: coreutils BuildRequires: findutils @@ -110,6 +112,7 @@ BuildRequires: perl(Module::Build) %endif # Tests: +BuildRequires: perl(blib) # CPAN::Checksums not used BuildRequires: perl(FindBin) BuildRequires: perl(Pod::Usage) @@ -148,6 +151,14 @@ BuildRequires: perl(YAML) >= 0.60 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 Requires: perl(CPAN::Meta::Requirements) >= 2.121 Requires: perl(Data::Dumper) @@ -204,7 +215,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 @@ -212,18 +226,35 @@ 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 +Requires: tar + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n CPAN-%{cpan_version} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 +%patch -P0 -p1 +%patch -P1 -p1 +%patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 # Change configuration name find -type f -exec sed -i -e 's/XCPANCONFIGNAMEX/cpan/g' {} \; # Remove bundled modules rm -r ./inc/* sed -i -e '/inc\//d' 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 make %{?_smp_mflags} @@ -233,7 +264,42 @@ make pure_install DESTDIR=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -type f -name .packlist -delete %{_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/5*pod*.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-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}/* ./ +cp t/CPAN/TestConfig.pm t/CPAN/MyConfig.pm +prove -I . +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 @@ -243,7 +309,17 @@ make test %{_mandir}/man1/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Feb 05 2024 Jitka Plesnikova - 2.18-399 +- Fix tests to run in correct order + +* Thu Jan 18 2024 Jitka Plesnikova - 2.18-398 +- Fix CVE-2023-31484 +- Package tests + * Thu Feb 08 2018 Fedora Release Engineering - 2.18-397 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild