Handle missing ExtUtils::CBuilder as a missing compiler

This commit is contained in:
Petr Písař 2022-03-28 11:27:31 +02:00
parent cd5b9241d8
commit 44420066ef
2 changed files with 46 additions and 3 deletions

View File

@ -0,0 +1,39 @@
From 043add527dd6bc05d5ef5750839ab21c2fdab9e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 28 Mar 2022 11:18:38 +0200
Subject: [PATCH] Do not die on missing ExtUtils::CBuilder in have_c_compiler()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In Fedora, ExtUtils::CBuilder is optional to allow installing perl
without gcc (bug #1547165). Module::Build::have_c_compiler() uses
ExtUtils::CBuilder to detect a presence of a C compiler. If
ExtUtils::CBuilder was not installed, have_c_compiler() died instead
of returning a false value.
This error manifested in perl-Alien-Base-ModuleBuild tests. This patch
changes have_c_compiler() to return true if ExtUtils::CBuilder is not
available.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/Module/Build/Base.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm
index 1352fcf..4e0f843 100644
--- a/lib/Module/Build/Base.pm
+++ b/lib/Module/Build/Base.pm
@@ -5315,7 +5315,7 @@ sub have_c_compiler {
return $p->{_have_c_compiler} if defined $p->{_have_c_compiler};
$self->log_verbose("Checking if compiler tools configured... ");
- my $b = $self->cbuilder;
+ my $b = eval { $self->cbuilder };
my $have = $b && eval { $b->have_compiler };
$self->log_verbose($have ? "ok.\n" : "failed.\n");
return $p->{_have_c_compiler} = $have;
--
2.34.1

View File

@ -12,7 +12,7 @@
Name: perl-Module-Build Name: perl-Module-Build
Epoch: 2 Epoch: 2
Version: %{cpan_version_major}%{?cpan_version_minor:.%cpan_version_minor} Version: %{cpan_version_major}%{?cpan_version_minor:.%cpan_version_minor}
Release: 11%{?dist} Release: 12%{?dist}
Summary: Build and install Perl modules Summary: Build and install Perl modules
License: GPL+ or Artistic License: GPL+ or Artistic
URL: https://metacpan.org/release/Module-Build URL: https://metacpan.org/release/Module-Build
@ -21,6 +21,8 @@ Source0: https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-%{c
# CPAN RT#124625, # CPAN RT#124625,
# <https://lists.fedoraproject.org/archives/list/perl-devel@lists.fedoraproject.org/message/UWQ6SDRKNTX6SM6RBJ35CDBGRCV3ZSKP/> # <https://lists.fedoraproject.org/archives/list/perl-devel@lists.fedoraproject.org/message/UWQ6SDRKNTX6SM6RBJ35CDBGRCV3ZSKP/>
Patch0: Module-Build-0.4224-Do-not-need-a-compiler-if-c_source-is-an-empty-list.patch Patch0: Module-Build-0.4224-Do-not-need-a-compiler-if-c_source-is-an-empty-list.patch
# Handle missing ExtUtils::CBuilder as a missing compiler, bug #1547165.
Patch1: Module-Build-0.4231-Do-not-die-on-missing-ExtUtils-CBuilder-in-have_c_co.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: perl-interpreter BuildRequires: perl-interpreter
@ -136,8 +138,7 @@ only prerequisites are modules that are included with perl 5.6.0, and it
works fine on perl 5.005 if you can install a few additional modules. works fine on perl 5.005 if you can install a few additional modules.
%prep %prep
%setup -q -n Module-Build-%{cpan_version} %autosetup -p1 -n Module-Build-%{cpan_version}
%patch0 -p1
%build %build
perl Build.PL installdirs=vendor perl Build.PL installdirs=vendor
@ -160,6 +161,9 @@ LANG=C TEST_SIGNATURE=1 MB_TEST_EXPERIMENTAL=1 ./Build test
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Mon Mar 28 2022 Petr Pisar <ppisar@redhat.com> - 2:0.42.31-12
- Handle missing ExtUtils::CBuilder as a missing compiler (bug #1547165)
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:0.42.31-11 * Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:0.42.31-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild