Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Term-UI for openSUSE:Factory checked in at 2021-08-10 10:27:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Term-UI (Old) and /work/SRC/openSUSE:Factory/.perl-Term-UI.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Term-UI" Tue Aug 10 10:27:49 2021 rev:4 rq:911148 version:0.50 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Term-UI/perl-Term-UI.changes 2015-06-09 12:25:05.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Term-UI.new.1899/perl-Term-UI.changes 2021-08-10 10:28:34.321707488 +0200 @@ -1,0 +2,24 @@ +Sat Aug 7 03:08:02 UTC 2021 - Tina M??ller <[email protected]> + +- updated to 0.50 + see /usr/share/doc/packages/perl-Term-UI/CHANGES + + 0.50 Fri 6 Aug 17:52:26 BST 2021 + * Fix number of tests to skip + (Michal Josef ??pa??ek) + * Fix selecting the last choice + (Valery Kalesnik) + + 0.48 Tue 3 Aug 19:13:22 BST 2021 + * Allow to specify the preput argument for the Term::ReadLine::Gnu + (Constantin Kulikov) + * RT#134899 Regex metacharacters in the choices can cause breakage + (Valery Kalesnik) + * Better width for choice number field + (Valery Kalesnik) + * RT#68198 Better processing of 'default' holding numbers + (Valery Kalesnik) + * Modernisation of distribution and coding + (Valery Kalesnik) + +------------------------------------------------------------------- Old: ---- Term-UI-0.46.tar.gz New: ---- Term-UI-0.50.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Term-UI.spec ++++++ --- /var/tmp/diff_new_pack.IyVDTb/_old 2021-08-10 10:28:34.721706462 +0200 +++ /var/tmp/diff_new_pack.IyVDTb/_new 2021-08-10 10:28:34.721706462 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Term-UI # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,30 +12,30 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # +%define cpan_name Term-UI Name: perl-Term-UI -Version: 0.46 +Version: 0.50 Release: 0 -%define cpan_name Term-UI Summary: Term::ReadLine UI made easy -License: Artistic-1.0 or GPL-1.0+ -Group: Development/Libraries/Perl -Url: http://search.cpan.org/dist/Term-UI/ -Source0: http://www.cpan.org/authors/id/B/BI/BINGOS/%{cpan_name}-%{version}.tar.gz +License: Artistic-1.0 OR GPL-1.0-or-later +URL: https://metacpan.org/release/%{cpan_name} +Source0: https://cpan.metacpan.org/authors/id/B/BI/BINGOS/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Locale::Maketext::Simple) BuildRequires: perl(Log::Message::Simple) BuildRequires: perl(Params::Check) +BuildRequires: perl(parent) Requires: perl(Locale::Maketext::Simple) Requires: perl(Log::Message::Simple) Requires: perl(Params::Check) +Requires: perl(parent) %{perl_requires} %description @@ -49,14 +49,15 @@ For asking a yes or no question, there's even a shortcut. %prep -%setup -q -n %{cpan_name}-%{version} +%autosetup -n %{cpan_name}-%{version} +find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644 %build -%{__perl} Makefile.PL INSTALLDIRS=vendor -%{__make} %{?_smp_mflags} +perl Makefile.PL INSTALLDIRS=vendor +%make_build %check -%{__make} test +make test %install %perl_make_install @@ -64,7 +65,6 @@ %perl_gen_filelist %files -f %{name}.files -%defattr(-,root,root,755) %doc CHANGES README %changelog ++++++ Term-UI-0.46.tar.gz -> Term-UI-0.50.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/CHANGES new/Term-UI-0.50/CHANGES --- old/Term-UI-0.46/CHANGES 2015-05-25 19:47:51.000000000 +0200 +++ new/Term-UI-0.50/CHANGES 2021-08-06 18:53:40.000000000 +0200 @@ -1,3 +1,21 @@ +0.50 Fri 6 Aug 17:52:26 BST 2021 +* Fix number of tests to skip + (Michal Josef ??pa??ek) +* Fix selecting the last choice + (Valery Kalesnik) + +0.48 Tue 3 Aug 19:13:22 BST 2021 +* Allow to specify the preput argument for the Term::ReadLine::Gnu + (Constantin Kulikov) +* RT#134899 Regex metacharacters in the choices can cause breakage + (Valery Kalesnik) +* Better width for choice number field + (Valery Kalesnik) +* RT#68198 Better processing of 'default' holding numbers + (Valery Kalesnik) +* Modernisation of distribution and coding + (Valery Kalesnik) + 0.46 Mon May 25 18:47:04 BST 2015 * Fix test skip count for non-terminals (Alexandr Ciornii) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/META.json new/Term-UI-0.50/META.json --- old/Term-UI-0.46/META.json 2015-05-25 19:48:51.000000000 +0200 +++ new/Term-UI-0.50/META.json 2021-08-06 18:54:44.000000000 +0200 @@ -4,13 +4,13 @@ "Jos Boumans <kane[at]cpan.org>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001", + "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" + "version" : 2 }, "name" : "Term-UI", "no_index" : { @@ -37,7 +37,8 @@ "Params::Check" : "0", "Term::ReadLine" : "0", "Test::More" : "0.31", - "if" : "0" + "if" : "0", + "parent" : "0" } } }, @@ -49,5 +50,6 @@ "web" : "https://github.com/jib/term-ui" } }, - "version" : "0.46" + "version" : "0.50", + "x_serialization_backend" : "JSON::PP version 4.06" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/META.yml new/Term-UI-0.50/META.yml --- old/Term-UI-0.46/META.yml 2015-05-25 19:48:51.000000000 +0200 +++ new/Term-UI-0.50/META.yml 2021-08-06 18:54:44.000000000 +0200 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001' +generated_by: 'ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -24,6 +24,8 @@ Term::ReadLine: '0' Test::More: '0.31' if: '0' + parent: '0' resources: repository: git://github.com/jib/term-ui.git -version: '0.46' +version: '0.50' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/Makefile.PL new/Term-UI-0.50/Makefile.PL --- old/Term-UI-0.46/Makefile.PL 2015-05-25 13:08:57.000000000 +0200 +++ new/Term-UI-0.50/Makefile.PL 2021-08-03 20:12:01.000000000 +0200 @@ -19,6 +19,7 @@ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz' }, PREREQ_PM => { 'if' => 0, + 'parent' => 0, 'Test::More' => 0.31, 'Params::Check' => 0, 'Term::ReadLine' => 0, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/lib/Term/UI/History.pm new/Term-UI-0.50/lib/Term/UI/History.pm --- old/Term-UI-0.46/lib/Term/UI/History.pm 2015-05-25 19:48:17.000000000 +0200 +++ new/Term-UI-0.50/lib/Term/UI/History.pm 2021-08-06 18:52:11.000000000 +0200 @@ -1,11 +1,20 @@ package Term::UI::History; +$Term::UI::History::VERSION = '0.50'; use strict; -use vars qw[$VERSION]; -use base 'Exporter'; -use base 'Log::Message::Simple'; +use warnings; -$VERSION = '0.46'; +use parent + qw! Exporter + Log::Message::Simple + !; + +use Log::Message 'private' => 0; + +our $HISTORY_FH = \ *STDOUT; +our @EXPORT = qw[ history ]; + +my $log = Log::Message->new(); =pod @@ -48,32 +57,21 @@ =cut -BEGIN { - use Log::Message private => 0; +sub history { + my $msg = shift; - use vars qw[ @EXPORT $HISTORY_FH ]; - @EXPORT = qw[ history ]; - my $log = new Log::Message; - $HISTORY_FH = \*STDOUT; - - for my $func ( @EXPORT ) { - no strict 'refs'; - - *$func = sub { my $msg = shift; - $log->store( - message => $msg, - tag => uc $func, - level => $func, - extra => [@_] - ); - }; - } + $log + ->store( 'message' => $msg, + 'tag' => 'HISTORY', + 'level' => 'history', + 'extra' => [ @_ ], + ); +} - sub history_as_string { - my $class = shift; +sub history_as_string { + my $class = shift; - return join $/, map { $_->message } __PACKAGE__->stack; - } + return join $/, map { $_->message } __PACKAGE__->stack; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/lib/Term/UI.pm new/Term-UI-0.50/lib/Term/UI.pm --- old/Term-UI-0.46/lib/Term/UI.pm 2015-05-25 19:48:08.000000000 +0200 +++ new/Term-UI-0.50/lib/Term/UI.pm 2021-08-06 18:52:00.000000000 +0200 @@ -1,21 +1,20 @@ package Term::UI; +$Term::UI::VERSION = '0.50'; use if $] > 5.017, 'deprecate'; +use strict; +use warnings; + use Carp; use Params::Check qw[check allow]; use Term::ReadLine; use Locale::Maketext::Simple Style => 'gettext'; use Term::UI::History; -use strict; - -BEGIN { - use vars qw[$VERSION $AUTOREPLY $VERBOSE $INVALID]; - $VERBOSE = 1; - $VERSION = '0.46'; - $INVALID = loc('Invalid selection, please try again: '); -} +our $AUTOREPLY; +our $INVALID = loc( 'Invalid selection, please try again: ' ); +our $VERBOSE = 1; push @Term::ReadLine::Stub::ISA, __PACKAGE__ unless grep { $_ eq __PACKAGE__ } @Term::ReadLine::Stub::ISA; @@ -85,7 +84,7 @@ =head1 METHODS -=head2 $reply = $term->get_reply( prompt => 'question?', [choices => \@list, default => $list[0], multi => BOOL, print_me => "extra text to print & record", allow => $ref] ); +=head2 $reply = $term->get_reply( prompt => 'question?', [choices => \@list, default => $list[0], preput => "text to put as default user input", multi => BOOL, print_me => "extra text to print & record", allow => $ref] ); C<get_reply> asks a user a question, and then returns the reply to the caller. If the answer is invalid (more on that below), the question will @@ -99,6 +98,13 @@ C<$AUTOREPLY> is set to true, (see the C<GLOBAL VARIABLES> section further below), or when the user just hits C<enter>. +The C<preput> argument allows to specify a text that will be inserted to +the prompt line as the initial input which may be edited, deleted or +accepted by the user. If you supply the empty string as the C<preput> +argument then the C<default> value will be preputted. It will only work if +the underlying readline module provide support for it (now it is supported +only by the C<Term::Readline::Gnu>). + You can indicate that the user is allowed to enter multiple answers by toggling the C<multi> flag. Note that a list of answers will then be returned to you, rather than a simple string. @@ -123,6 +129,7 @@ my $tmpl = { default => { default => undef, strict_type => 0 }, + preput => { default => '', strict_type => 0 }, prompt => { default => '', strict_type => 1, required => 1 }, choices => { default => [], strict_type => 1 }, multi => { default => 0, allow => [0, 1] }, @@ -145,7 +152,23 @@ ### if you supplied several choices to pick from, ### we'll print them separately before the prompt if( @{$args->{choices}} ) { + # clean up 'default' of items not in 'choices' + if ( $args->{ 'default' } ) { + if ( $args->{ 'multi' } ) { + @{ $args->{ 'default' } } = + grep { + my $default = $_; + grep $default eq $_, @{ $args->{ 'choices' } }; + } + @{ $args->{ 'default' } }; + } else { + delete $args->{ 'default' } + unless grep $_ eq $args->{ 'default' }, @{ $args->{ 'choices' } } + } + } + my $i; + my $choices_width = length( sprintf( "%d", scalar @{ $args->{ 'choices' } } ) ); for my $choice ( @{$args->{choices}} ) { $i++; # the answer counter -- but humans start counting @@ -155,7 +178,7 @@ ### so we can construct a "foo? [DIGIT]" type prompt if (defined $args->{default}) { if ($args->{multi}) { - push @$prompt_add, $i if (scalar(grep { m/^$choice$/ } @{$args->{default}})); + push @$prompt_add, $i if grep { $_ eq $choice } @{ $args->{ 'default' } }; } else { $prompt_add = $i if ($choice eq $args->{default}); @@ -163,7 +186,7 @@ } ### create a "DIGIT> choice" type line - $args->{print_me} .= sprintf "\n%3s> %-s", $i, $choice; + $args->{print_me} .= sprintf "\n%*s> %-s", $choices_width, $i, $choice; } $prompt_add = join(" ", @$prompt_add) if ( $prompt_add && $args->{multi} ); @@ -264,11 +287,11 @@ local $Params::Check::VERBOSE = 0; # why is this? local $| = 1; # print ASAP - - my ($default, $prompt, $choices, $multi, $allow, $prompt_add, $print_me); + my ($default, $preput, $prompt, $choices, $multi, $allow, $prompt_add, $print_me); my $tmpl = { default => { default => undef, strict_type => 0, store => \$default }, + preput => { default => undef, strict_type => 0, store => \$preput}, prompt => { default => '', strict_type => 1, required => 1, store => \$prompt }, choices => { default => [], strict_type => 1, @@ -285,6 +308,18 @@ ### it can display wonky on some terminals. history( $print_me ) if $print_me; + my $preput_is_supported = + $term->ReadLine eq "Term::ReadLine::Gnu" ? 1 : undef; + + $preput = undef unless $preput_is_supported; + + ### If we are using Term::ReadLine:Gnu we can preput default value + if (defined $preput and $preput eq '') { + # if preput is the empty string we preput default + $preput = $prompt_add; + # We don't need to double information in the prompt in that case + $prompt_add = undef; + } if ($prompt_add) { ### we might have to add a default value to the prompt, to @@ -336,17 +371,20 @@ } ### pose the question - my $answer = $term->readline($prompt); + my $answer = defined $preput + ? $term->readline($prompt, $preput) + : $term->readline($prompt); + $answer = $default unless length $answer; $term->addhistory( $answer ) if length $answer; ### add both prompt and answer to the history - history( "$prompt $answer", 0 ); + history( defined $answer ? "$prompt $answer" : "$prompt", 0 ); ### if we're allowed to give multiple answers, split ### the answer on whitespace - my @answers = $multi ? split(/\s+/, $answer) : $answer; + my @answers = grep defined, $multi ? split(/\s+/, $answer) : ( $answer ); ### the return value list my @rv; @@ -357,7 +395,11 @@ ### a digit implies a multiple choice question, ### a non-digit is an open answer - if( $answer =~ /\D/ ) { + if ( $answer =~ /\D/ + || ( $answer =~ /^\d+$/ + && @$choices < $answer + ) + ) { push @rv, $answer if allow( $answer, $allow ); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/t/00_load.t new/Term-UI-0.50/t/00_load.t --- old/Term-UI-0.46/t/00_load.t 2013-05-12 17:18:46.000000000 +0200 +++ new/Term-UI-0.50/t/00_load.t 2021-08-03 20:01:06.000000000 +0200 @@ -1,5 +1,7 @@ -use Test::More 'no_plan'; +#!/usr/bin/env perl + use strict; +use warnings; BEGIN { chdir 't' if -d 't'; @@ -7,8 +9,11 @@ use lib File::Spec->catdir( qw[.. lib] ); } +use Test::More 'tests' => 1; + my $Class = 'Term::UI'; use_ok( $Class ); -diag "Testing $Class " . $Class->VERSION unless $ENV{PERL_CORE}; +diag "Testing $Class " . $Class->VERSION . ", Perl $], $^X" + unless $ENV{ 'PERL_CORE' }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/t/01_history.t new/Term-UI-0.50/t/01_history.t --- old/Term-UI-0.46/t/01_history.t 2013-05-12 17:18:46.000000000 +0200 +++ new/Term-UI-0.50/t/01_history.t 2021-08-03 20:01:06.000000000 +0200 @@ -1,5 +1,7 @@ -use Test::More 'no_plan'; +#!/usr/bin/env perl + use strict; +use warnings; BEGIN { chdir 't' if -d 't'; @@ -7,6 +9,8 @@ use lib File::Spec->catdir( qw[.. lib] ); } +use Test::More 'no_plan'; + my $Class = 'Term::UI::History'; my $Func = 'history'; my $Verbose = 0; # print to STDOUT? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Term-UI-0.46/t/02_ui.t new/Term-UI-0.50/t/02_ui.t --- old/Term-UI-0.46/t/02_ui.t 2015-05-25 19:46:26.000000000 +0200 +++ new/Term-UI-0.50/t/02_ui.t 2021-08-06 18:51:38.000000000 +0200 @@ -1,9 +1,13 @@ +#!/usr/bin/env perl + ### Term::UI test suite ### use strict; +use warnings; + use lib qw[../lib lib]; -use Test::More tests => 22; -use Term::ReadLine; +use Test::More 'tests' => 23; +use Term::ReadLine (); use_ok( 'Term::UI' ); @@ -14,7 +18,7 @@ # SKIP tests if we aren't on a terminal SKIP: { -skip 'not on a terminal', 21 unless -t; +skip 'not on a terminal', 22 unless -t; ### enable warnings $^W = 1; @@ -80,6 +84,20 @@ } { + my $args = + { 'prompt' => "What is your favourite colour?", + 'choices' => [ qw| blue red green [ | ], + 'multi' => 1, + 'default' => [ qw| blue red | ], + }; + + is_deeply( [ $term->get_reply( %$args ) ], [ qw| blue red | ], + q[Checking reply with multible defaults and choices (including a broken regex)], + ); +} + + +{ my $args = { prompt => 'Do you like cookies?', default => 'y',
