Upgrade to version 0.4234

This commit is contained in:
lyn1001 2023-12-28 17:27:46 +08:00
parent 60f70c703e
commit 469a62201f
5 changed files with 52 additions and 154 deletions

View File

@ -1,144 +0,0 @@
From 6b096ea5670ed291abac632b296222b56d9fadb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 1 Mar 2018 14:44:40 +0100
Subject: [PATCH] Do not need a compiler if c_source is an empty list
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
c_source used to be string, then it allowed a reference to an array.
But in case the array was empty, auto_require() still enabled
needs_compiler property and thus implied probing a compiler and
a failure if none was available.
Minilla generates these Build.PLs for pure-Perl distributions. See
KAZUHO/Server-Starter-0.34.
This patch makes Module::Build not require C compiler for
c_source = [].
Petr Písař: Ported to 0.4224.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/Module/Build/API.pod | 8 ++++----
lib/Module/Build/Base.pm | 6 +++++-
t/properties/needs_compiler.t | 46 ++++++++++++++++++++++++++++++++++++++++---
3 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/lib/Module/Build/API.pod b/lib/Module/Build/API.pod
index cd2021a..c9be539 100644
--- a/lib/Module/Build/API.pod
+++ b/lib/Module/Build/API.pod
@@ -209,10 +209,10 @@ created by Module::Build.
[version 0.04]
-An optional C<c_source> argument specifies a directory which contains
-C source files that the rest of the build may depend on. Any C<.c>
-files in the directory will be compiled to object files. The
-directory will be added to the search path during the compilation and
+An optional C<c_source> argument specifies a directory or a reference to array
+of directories which contain C source files that the rest of the build may
+depend on. Any C<.c> files in the directory will be compiled to object files.
+The directory will be added to the search path during the compilation and
linking phases of any C or XS files.
[version 0.3604]
diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm
index 984810a..a29c664 100644
--- a/lib/Module/Build/Base.pm
+++ b/lib/Module/Build/Base.pm
@@ -1520,7 +1520,11 @@ sub auto_require {
if ( $self->pureperl_only && $self->allow_pureperl ) {
$self->needs_compiler( 0 );
} else {
- $self->needs_compiler( keys %$xs_files || defined $self->c_source );
+ $self->needs_compiler( keys %$xs_files ||
+ ( defined $self->c_source &&
+ ( ref($self->c_source) ne 'ARRAY' || @{$self->c_source} )
+ )
+ );
}
}
if ($self->needs_compiler) {
diff --git a/t/properties/needs_compiler.t b/t/properties/needs_compiler.t
index f616dfc..c76d38f 100644
--- a/t/properties/needs_compiler.t
+++ b/t/properties/needs_compiler.t
@@ -5,7 +5,7 @@ use lib 't/lib';
use MBTest;
use DistGen;
-plan tests => 19;
+plan tests => 27;
# Ensure any Module::Build modules are loaded from correct directory
blib_load('Module::Build');
@@ -24,7 +24,7 @@ ok( ! exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
);
#--------------------------------------------------------------------------#
-# try with c_source
+# try with c_source as a string
#--------------------------------------------------------------------------#
$dist->change_build_pl({
module_name => $dist->name,
@@ -34,7 +34,7 @@ $dist->change_build_pl({
$dist->regen;
stderr_of(sub {
ok( $mb = $dist->new_from_context,
- "Build.PL with c_source"
+ "Build.PL with string c_source"
);
});
is( $mb->c_source, 'src', "c_source is set" );
@@ -44,6 +44,46 @@ ok( exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
);
#--------------------------------------------------------------------------#
+# try with c_source as an array
+#--------------------------------------------------------------------------#
+$dist->change_build_pl({
+ module_name => $dist->name,
+ license => 'perl',
+ c_source => ['src'],
+});
+$dist->regen;
+stderr_of(sub {
+ ok( $mb = $dist->new_from_context,
+ "Build.PL with non-empty array c_source"
+ );
+});
+is_deeply( $mb->c_source, ['src'], "c_source is set" );
+ok( $mb->needs_compiler, "needs_compiler is true" );
+ok( exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
+ "ExtUtils::CBuilder was added to build_requires"
+);
+
+#--------------------------------------------------------------------------#
+# try with c_source as an empty array
+#--------------------------------------------------------------------------#
+$dist->change_build_pl({
+ module_name => $dist->name,
+ license => 'perl',
+ c_source => [],
+});
+$dist->regen;
+stderr_of(sub {
+ ok( $mb = $dist->new_from_context,
+ "Build.PL with empty array c_source"
+ );
+});
+is_deeply( $mb->c_source, [], "c_source is set" );
+ok( ! $mb->needs_compiler, "needs_compiler is false" );
+ok( ! exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
+ "ExtUtils::CBuilder is not in build_requires"
+);
+
+#--------------------------------------------------------------------------#
# try with xs files
#--------------------------------------------------------------------------#
$dist = DistGen->new(dir => 'MBTest', xs => 1);
--
2.13.6

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

Binary file not shown.

BIN
Module-Build-0.4234.tar.gz Normal file

Binary file not shown.

View File

@ -4,13 +4,13 @@
Name: perl-Module-Build
Epoch: 2
Version: 0.42.31
Version: 0.42.34
Release: 1
Summary: Build and install Perl modules
License: GPL+ or Artistic
License: GPL-1.0-or-later OR Artistic-1.0-Perl
URL: https://metacpan.org/release/Module-Build
Source0: https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz
Patch0: Module-Build-0.4224-Do-not-need-a-compiler-if-c_source-is-an-empty-list.patch
Source0: https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4234.tar.gz
Patch0: Module-Build-0.4231-Do-not-die-on-missing-ExtUtils-CBuilder-in-have_c_co.patch
BuildArch: noarch
BuildRequires: coreutils, perl-interpreter, perl-devel, perl-generators, perl(Archive::Tar), perl(AutoSplit), perl(base), perl(Carp), perl(Config)
@ -23,7 +23,7 @@ BuildRequires: perl(Perl::OSType) >= 1, perl(strict), perl(Archive::Zip), perl(
BuildRequires: perl(Test::Harness) >= 3.29, perl(Test::More) >= 0.49, perl(Text::ParseWords), perl(utf8), perl(vars), perl(version) >= 0.87, perl(warnings)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)), perl(CPAN::Meta) >= 2.142060, perl(CPAN::Meta::Converter) >= 2.141170
Requires: perl(CPAN::Meta::Merge), perl(ExtUtils::Install) >= 0.3, perl(ExtUtils::Manifest) >= 1.54, perl(ExtUtils::Mkbootstrap), perl(ExtUtils::ParseXS) >= 2.21
Requires: perl(inc::latest), perl(Module::Metadata) >= 1.000002, perl(Perl::OSType) >= 1, perl(TAP::Harness::Env), perl(Test::Harness), perl(Software::License)
Requires: perl(inc::latest), perl(Module::Metadata) >= 1.000002, perl(Perl::OSType) >= 1, perl(TAP::Harness::Env), perl(Test::Harness), perl(Software::License), perl(blib)
Requires: perl(Pod::Html), perl(Pod::Man) >= 2.17, perl(Pod::Text)
Recommends: perl(ExtUtils::CBuilder) >= 0.27
@ -42,15 +42,15 @@ Requires: man
This package includes man files for %{name}.
%prep
%autosetup -n Module-Build-0.4231 -p1
%autosetup -n Module-Build-0.4234 -p1
%build
perl Build.PL installdirs=vendor
perl Build.PL --installdirs=vendor
./Build
%install
./Build install destdir=$RPM_BUILD_ROOT create_packlist=0
%{_fixperms} $RPM_BUILD_ROOT/*
./Build install --destdir=$RPM_BUILD_ROOT --create_packlist=0
%{_fixperms} -c $RPM_BUILD_ROOT/
%check
rm -f t/signature.t
@ -58,7 +58,7 @@ LANG=C TEST_SIGNATURE=1 MB_TEST_EXPERIMENTAL=1 ./Build test
%files
%license LICENSE
%doc contrib README
%doc contrib/ README Changes
%{_bindir}/config_data
%{perl_vendorlib}/*
@ -66,6 +66,9 @@ LANG=C TEST_SIGNATURE=1 MB_TEST_EXPERIMENTAL=1 ./Build test
%{_mandir}/man*/*
%changelog
* Thu Dec 28 2023 liyanan <liyanan61@h-partners.com> - 2:0.42.34-1
- upgrade version to 0.42.34
* Tue Feb 02 2021 shixuantong <shixuantong@huawei.com> - 2:0.42.31-1
- upgrade version to 0.42.31