Fix compatibility with GLD 0.106

This commit is contained in:
Paul Howarth 2021-03-13 16:02:51 +00:00
parent 06271027bc
commit a34ed4f99e
2 changed files with 79 additions and 2 deletions

View File

@ -0,0 +1,64 @@
--- t/104_override_usage.t
+++ t/104_override_usage.t
@@ -61,10 +61,18 @@ use Test::Exception;
\t--foo INT A foo
}
:
+ $Getopt::Long::Descriptive::VERSION < 0.106 ?
qq{usage: 104_override_usage.t [-?] [long options...]
\t-? --[no-]usage --[no-]help Prints this usage information.
\t--foo INT A foo
}
+ :
+ qq{usage: 104_override_usage.t [-?] [long options...]
+\t--[no-]help (or -?) Prints
+\t this usage information.
+\t aka --usage
+\t--foo INT A foo
+}
];
--- t/107_no_auto_help.t
+++ t/107_no_auto_help.t
@@ -60,7 +60,7 @@ END {
warning_like {
throws_ok { Class->new_with_options }
#usage: 107_no_auto_help.t [-?] [long options...]
- qr/^usage: [\d\w]+\Q.t [-?] [long options...]\E.\s+\Q-? --\E(\[no-\])?usage --(\[no-\])?\Qhelp\E\s+\QPrints this usage information.\E.\s+--configfile/ms,
+ qr/^usage: [\d\w]+\Q.t [-?] [long options...]\E.\s+(\Q-? --\E(\[no-\])?usage )?--(\[no-\])?\Qhelp\E(\Q (or -?)\E)?\s+\QPrints this usage information.\E.(\s+\Qaka --usage\E.)?\s+--configfile/ms,
'usage information looks good';
}
qr/^Specified configfile \'this_value_unimportant\' does not exist, is empty, or is not readable$/,
--- t/109_help_flag.t
+++ t/109_help_flag.t
@@ -40,7 +40,7 @@ foreach my $args ( ['--help'], ['--usage
local @ARGV = @$args;
throws_ok { MyClass->new_with_options() }
- qr/^usage: (?:[\d\w]+)\Q.t [-?] [long options...]\E.^\t\Q-? --\E(\[no-\])?usage --(\[no-\])?help\s+\QPrints this usage information.\E$/ms,
+ qr/^usage: (?:[\d\w]+)\Q.t [-?] [long options...]\E.^\s+(\Q-? --\E(\[no-\])?usage )?--(\[no-\])?help(\Q (or -?)\E)?\s+Prints ?(.\s+)?\Qthis usage information.\E.(\s+\Qaka --usage\E.)?$/ms,
'Help request detected; usage information properly printed';
}
--- t/110_sort_usage_by_attr_order.t
+++ t/110_sort_usage_by_attr_order.t
@@ -64,6 +64,18 @@ usage: 110_sort_usage_by_attr_order.t [-
--baz STR Documentation for "baz"
USAGE
}
+if ( $Getopt::Long::Descriptive::VERSION >= 0.106 )
+{
+$expected = <<'USAGE';
+usage: 110_sort_usage_by_attr_order.t [-?] [long options...]
+ --[no-]help (or -?) Prints
+ this usage information.
+ aka --usage
+ --foo STR Documentation for "foo"
+ --bar STR Documentation for "bar"
+ --baz STR Documentation for "baz"
+USAGE
+}
$expected =~ s/^[ ]{4}/\t/xmsg;
is($obj->usage->text, $expected, 'Usage text has nicely sorted options');

View File

@ -1,10 +1,11 @@
Name: perl-MouseX-Getopt
Summary: Mouse role for processing command line options
Version: 0.38
Release: 10%{?dist}
Release: 11%{?dist}
License: GPL+ or Artistic
URL: https://metacpan.org/release/MouseX-Getopt
Source0: https://cpan.metacpan.org/modules/by-module/MouseX/MouseX-Getopt-%{version}.tar.gz
Patch0: MouseX-Getopt-0.38-GLD-0.106.patch
BuildArch: noarch
# Module Build
BuildRequires: perl-generators
@ -21,6 +22,7 @@ BuildRequires: perl(Mouse::Meta::Attribute)
BuildRequires: perl(Mouse::Role)
BuildRequires: perl(Mouse::Util::TypeConstraints)
# Test Suite
BuildRequires: expect
BuildRequires: perl(File::Spec)
BuildRequires: perl(Mouse::Meta::Class)
BuildRequires: perl(Scalar::Util)
@ -48,6 +50,9 @@ objects using parameters passed in from the command line.
%prep
%setup -q -n MouseX-Getopt-%{version}
# Fix compatibility with GLD 0.106
%patch0
%build
perl Build.PL --installdirs=vendor
./Build
@ -56,7 +61,12 @@ perl Build.PL --installdirs=vendor
./Build install --destdir=%{buildroot} --create_packlist=0
%check
./Build test
# Expect is used so that we get a PTY, as if we were in a real terminal
expect -c '
spawn ./Build test
expect eof
exit [lindex [wait] 3]
'
%files
# Note: malformed LICENSE file in 0.35 .. 0.38 not shipped
@ -75,6 +85,9 @@ perl Build.PL --installdirs=vendor
%{_mandir}/man3/MouseX::Getopt::Strict.3*
%changelog
* Sat Mar 13 2021 Paul Howarth <paul@city-fan.org> - 0.38-11
- Fix compatibility with GLD 0.106
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.38-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild