lol

Merge pull request #265043 from stigtsp/perl/mousex-getopts-fix-gld

[staging-next] perlPackages.MouseXGetopt: add patch

authored by

Stig and committed by
GitHub
0dca3234 649a9312

+146
+143
pkgs/development/perl-modules/MouseX-Getopt-gld-tests.patch
··· 1 + From c1d1eed00099af8d858536b659864b7ccea41974 Mon Sep 17 00:00:00 2001 2 + From: Paul Howarth <paul@city-fan.org> 3 + Date: Sat, 13 Mar 2021 17:46:57 +0000 4 + Subject: [PATCH 1/2] Update for Getopt-Long-Descriptive 0.106 5 + 6 + GLD is now outputting text with wrapping depending on the terminal 7 + width. This update is enough to get the tests to pass when running 8 + within "expect", which provides a PTY. It's almost certainly not 9 + enough for general use. 10 + --- 11 + t/104_override_usage.t | 8 ++++++++ 12 + t/107_no_auto_help.t | 2 +- 13 + t/109_help_flag.t | 2 +- 14 + t/110_sort_usage_by_attr_order.t | 12 ++++++++++++ 15 + 4 files changed, 22 insertions(+), 2 deletions(-) 16 + 17 + diff --git a/t/104_override_usage.t b/t/104_override_usage.t 18 + index bc45029..6641540 100644 19 + --- a/t/104_override_usage.t 20 + +++ b/t/104_override_usage.t 21 + @@ -61,9 +61,17 @@ use Test::Exception; 22 + \t--foo INT A foo 23 + } 24 + : 25 + + $Getopt::Long::Descriptive::VERSION < 0.106 ? 26 + qq{usage: 104_override_usage.t [-?] [long options...] 27 + \t-? --[no-]usage --[no-]help Prints this usage information. 28 + \t--foo INT A foo 29 + +} 30 + + : 31 + + qq{usage: 104_override_usage.t [-?] [long options...] 32 + +\t--[no-]help (or -?) Prints 33 + +\t this usage information. 34 + +\t aka --usage 35 + +\t--foo INT A foo 36 + } 37 + 38 + ]; 39 + diff --git a/t/107_no_auto_help.t b/t/107_no_auto_help.t 40 + index 27f87f5..103df43 100644 41 + --- a/t/107_no_auto_help.t 42 + +++ b/t/107_no_auto_help.t 43 + @@ -60,7 +60,7 @@ END { 44 + warning_like { 45 + throws_ok { Class->new_with_options } 46 + #usage: 107_no_auto_help.t [-?] [long options...] 47 + - 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, 48 + + 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, 49 + 'usage information looks good'; 50 + } 51 + qr/^Specified configfile \'this_value_unimportant\' does not exist, is empty, or is not readable$/, 52 + diff --git a/t/109_help_flag.t b/t/109_help_flag.t 53 + index 8c658e2..58dbca6 100644 54 + --- a/t/109_help_flag.t 55 + +++ b/t/109_help_flag.t 56 + @@ -40,7 +40,7 @@ foreach my $args ( ['--help'], ['--usage'], ['--?'], ['-?'] ) 57 + local @ARGV = @$args; 58 + 59 + throws_ok { MyClass->new_with_options() } 60 + - qr/^usage: (?:[\d\w]+)\Q.t [-?] [long options...]\E.^\t\Q-? --\E(\[no-\])?usage --(\[no-\])?help\s+\QPrints this usage information.\E$/ms, 61 + + 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, 62 + 'Help request detected; usage information properly printed'; 63 + } 64 + 65 + diff --git a/t/110_sort_usage_by_attr_order.t b/t/110_sort_usage_by_attr_order.t 66 + index e7dd177..7ec0c99 100644 67 + --- a/t/110_sort_usage_by_attr_order.t 68 + +++ b/t/110_sort_usage_by_attr_order.t 69 + @@ -64,6 +64,18 @@ usage: 110_sort_usage_by_attr_order.t [-?] [long options...] 70 + --baz STR Documentation for "baz" 71 + USAGE 72 + } 73 + +if ( $Getopt::Long::Descriptive::VERSION >= 0.106 ) 74 + +{ 75 + +$expected = <<'USAGE'; 76 + +usage: 110_sort_usage_by_attr_order.t [-?] [long options...] 77 + + --[no-]help (or -?) Prints 78 + + this usage information. 79 + + aka --usage 80 + + --foo STR Documentation for "foo" 81 + + --bar STR Documentation for "bar" 82 + + --baz STR Documentation for "baz" 83 + +USAGE 84 + +} 85 + $expected =~ s/^[ ]{4}/\t/xmsg; 86 + is($obj->usage->text, $expected, 'Usage text has nicely sorted options'); 87 + 88 + 89 + From 45ae6aaabc5413e985860fbfcc8da3bdc929a054 Mon Sep 17 00:00:00 2001 90 + From: Paul Howarth <paul@city-fan.org> 91 + Date: Mon, 15 Mar 2021 10:43:14 +0000 92 + Subject: [PATCH 2/2] Update for Getopt-Long-Descriptive 0.107 93 + 94 + GLD's use of Term::ReadKey has been reverted, so this update should now 95 + work reliably. Use with GLD 0.106 is not supported. 96 + --- 97 + t/104_override_usage.t | 6 +++--- 98 + t/110_sort_usage_by_attr_order.t | 6 +++--- 99 + 2 files changed, 6 insertions(+), 6 deletions(-) 100 + 101 + diff --git a/t/104_override_usage.t b/t/104_override_usage.t 102 + index 6641540..f7c6a31 100644 103 + --- a/t/104_override_usage.t 104 + +++ b/t/104_override_usage.t 105 + @@ -61,15 +61,15 @@ use Test::Exception; 106 + \t--foo INT A foo 107 + } 108 + : 109 + - $Getopt::Long::Descriptive::VERSION < 0.106 ? 110 + + # Note: Getopt::Long::Descriptive 0.106 not supported 111 + + $Getopt::Long::Descriptive::VERSION < 0.107 ? 112 + qq{usage: 104_override_usage.t [-?] [long options...] 113 + \t-? --[no-]usage --[no-]help Prints this usage information. 114 + \t--foo INT A foo 115 + } 116 + : 117 + qq{usage: 104_override_usage.t [-?] [long options...] 118 + -\t--[no-]help (or -?) Prints 119 + -\t this usage information. 120 + +\t--[no-]help (or -?) Prints this usage information. 121 + \t aka --usage 122 + \t--foo INT A foo 123 + } 124 + diff --git a/t/110_sort_usage_by_attr_order.t b/t/110_sort_usage_by_attr_order.t 125 + index 7ec0c99..16cdaa1 100644 126 + --- a/t/110_sort_usage_by_attr_order.t 127 + +++ b/t/110_sort_usage_by_attr_order.t 128 + @@ -64,12 +64,12 @@ usage: 110_sort_usage_by_attr_order.t [-?] [long options...] 129 + --baz STR Documentation for "baz" 130 + USAGE 131 + } 132 + -if ( $Getopt::Long::Descriptive::VERSION >= 0.106 ) 133 + +# Note: Getopt::Long::Descriptive 0.106 not supported 134 + +if ( $Getopt::Long::Descriptive::VERSION >= 0.107 ) 135 + { 136 + $expected = <<'USAGE'; 137 + usage: 110_sort_usage_by_attr_order.t [-?] [long options...] 138 + - --[no-]help (or -?) Prints 139 + - this usage information. 140 + + --[no-]help (or -?) Prints this usage information. 141 + aka --usage 142 + --foo STR Documentation for "foo" 143 + --bar STR Documentation for "bar"
+3
pkgs/top-level/perl-packages.nix
··· 17343 17343 url = "mirror://cpan/authors/id/G/GF/GFUJI/MouseX-Getopt-0.38.tar.gz"; 17344 17344 hash = "sha256-3j6o70Ut2VAeqMTtqHRLciRgJgKwRpJgft19YrefA48="; 17345 17345 }; 17346 + patches = [ 17347 + ../development/perl-modules/MouseX-Getopt-gld-tests.patch 17348 + ]; 17346 17349 buildInputs = [ ModuleBuildTiny MouseXConfigFromFile MouseXSimpleConfig TestException TestWarn ]; 17347 17350 propagatedBuildInputs = [ GetoptLongDescriptive Mouse ]; 17348 17351 meta = {