public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/sympa] f43: Add upstream patch to fix old style CLI
@ 2026-06-15 12:42 Xavier Bachelot
  0 siblings, 0 replies; only message in thread
From: Xavier Bachelot @ 2026-06-15 12:42 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/sympa
Branch : f43
Commit : 8d0c41c6c76badd6f44d2629010d37f13f472766
Author : Xavier Bachelot <xavier@bachelot.org>
Date   : 2026-06-15T14:41:46+02:00
Stats  : +260/-2 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/sympa/c/8d0c41c6c76badd6f44d2629010d37f13f472766?branch=f43

Log:
Add upstream patch to fix old style CLI

---
diff --git a/sympa-6.2.78-fix_old_style_cli.patch b/sympa-6.2.78-fix_old_style_cli.patch
new file mode 100644
index 0000000..d24c884
--- /dev/null
+++ b/sympa-6.2.78-fix_old_style_cli.patch
@@ -0,0 +1,251 @@
+From 2fb03a9d3220f55208aea7ad5149f5d3b2a13da3 Mon Sep 17 00:00:00 2001
+From: IKEDA Soji <mail@ikedas.net>
+Date: Thu, 23 Apr 2026 20:49:45 +0900
+Subject: [PATCH 1/2] correct broken refactoring occurred on #1984
+
+---
+ src/lib/Sympa/CLI.pm        | 58 +++++++++++++++++++------------------
+ src/lib/Sympa/CLI/create.pm |  2 +-
+ t/CLI_getoptions.t          |  7 ++---
+ 3 files changed, 34 insertions(+), 33 deletions(-)
+
+diff --git a/src/lib/Sympa/CLI.pm b/src/lib/Sympa/CLI.pm
+index 5b72cb9c5..e408bc4f5 100644
+--- a/src/lib/Sympa/CLI.pm
++++ b/src/lib/Sympa/CLI.pm
+@@ -75,14 +75,10 @@ sub run {
+         map {s/[.].*\z//r} grep {defined} @ENV{qw(LANGUAGE LC_ALL LANG)};
+     $language->set_lang(@langs, 'en-US', 'en');
+ 
+-    # Parse options if necessary.
++    # Parse command and options.
+     my %options;
+-    if ($options) {
+-        %options = %$options;
+-    } else {
+-        $class = $class->getoptions(\%options, \@argv);
+-        return undef unless $class;
+-    }
++    ($class, %options) = $class->getoptions($options, \@argv);
++    return undef unless $class;
+ 
+     # Suppress console output if specified.
+     # Setup language if specified.
+@@ -92,26 +88,24 @@ sub run {
+     $class->arrange(%options) if $class->_need_priv;
+ 
+     # Parse arguments.
+-    if (@argv) {
+-        @argv = $class->parseargs(@argv);
+-        return unless @argv;
+-    }
++    return undef unless $class->parseargs(\@argv);
+ 
+     $class->_run(\%options, @argv);
+ }
+ 
+ sub getoptions {
+-    my $class     = shift;
+-    my $options_r = shift;
+-    my $argv_r    = shift;
++    my $class   = shift;
++    my $options = shift;
++    my $argv_r  = shift;
++    my @argv    = @$argv_r;
+ 
+-    while (@$argv_r and ($argv_r->[0] // '') =~ /\A\w+\z/) {
++    while (@argv and ($argv[0] // '') =~ /\A\w+\z/) {
+         # Check if (sub-)command is implemented.
+         my $dir = $INC{($class =~ s|::|/|gr) . '.pm'} =~ s/[.]pm\z//r;
+-        last unless -e "$dir/$argv_r->[0].pm";
++        last unless -e "$dir/$argv[0].pm";
+ 
+         # Load module for the command.
+-        my $command = shift @$argv_r;
++        my $command = shift @argv;
+         my $subclass = sprintf '%s::%s', $class, $command;
+         unless (eval(sprintf 'require %s', $subclass)
+             and $subclass->isa($class)) {
+@@ -126,17 +120,21 @@ sub getoptions {
+         # No valid main command.
+         warn $language->gettext_sprintf(
+             'Invalid argument \'%s\' (command is expected)',
+-            ($argv_r->[0] // ''))
++            ($argv[0] // ''))
+             . "\n";
+         return undef;
+     }
+ 
+-    if (grep /^-/, $class->_options) {
++    # Parse options if necessary.
++    my %options;
++    if ($options) {
++        %options = %$options;
++    } elsif (grep /^-/, $class->_options) {
+         ;
+     } elsif (
+         not Getopt::Long::GetOptionsFromArray(
+-            $argv_r,
+-            $options_r,
++            \@argv,
++            \%options,
+             map {
+                 # If option name contains hyphen-minus, underscore is also
+                 # allowed and the latter will be used for keys in the hash.
+@@ -154,13 +152,16 @@ sub getoptions {
+         return undef;
+     }
+ 
+-    return $class;
++    @$argv_r = @argv;
++    return ($class, %options);
+ }
+ 
+-# Parse arguments.
+ sub parseargs {
+-    my $class = shift;
+-    my @argv  = @_;
++    my $class  = shift;
++    my $argv_r = shift;
++    my @argv   = @$argv_r;
++
++    return $argv_r unless @argv;
+ 
+     my @parsed_argv = ();
+     foreach my $argdefs ($class->_args) {
+@@ -176,7 +177,7 @@ sub parseargs {
+             warn $language->gettext_sprintf('Missing argument (%s)',
+                 _arg_expected($defs))
+                 . "\n";
+-            return;
++            return undef;
+         }
+         foreach my $arg (@a) {
+             my $val;
+@@ -233,12 +234,13 @@ sub parseargs {
+                     'Invalid argument \'%s\' (%s)',
+                     $arg, _arg_expected($defs))
+                     . "\n";
+-                return;
++                return undef;
+             }
+         }
+     }
+ 
+-    return (@parsed_argv, @argv);
++    @$argv_r = (@parsed_argv, @argv);
++    return $argv_r;
+ }
+ 
+ sub _options       {qw(config|f=s debug|d lang|l=s log_level=s mail|m noout)}
+diff --git a/src/lib/Sympa/CLI/create.pm b/src/lib/Sympa/CLI/create.pm
+index c9a73d406..4a060688e 100644
+--- a/src/lib/Sympa/CLI/create.pm
++++ b/src/lib/Sympa/CLI/create.pm
+@@ -31,7 +31,7 @@ use Sympa::Spindle::ProcessRequest;
+ 
+ use parent qw(Sympa::CLI);
+ 
+-use constant _options => qw(input-file=s);
++use constant _options => qw(input_file=s);
+ use constant _args    => qw(family|domain?);
+ 
+ sub _run {
+diff --git a/t/CLI_getoptions.t b/t/CLI_getoptions.t
+index afbaa772e..475128793 100644
+--- a/t/CLI_getoptions.t
++++ b/t/CLI_getoptions.t
+@@ -59,11 +59,10 @@ sub dotest {
+     my $wishedArgv    = shift;
+     my @argv          = @_;
+ 
+-    diag join(' ', @argv) =~ s/(.{73}).*/$1.../r;
+-    my %options;
+-    my $class = Sympa::CLI->getoptions(\%options, \@argv);
++    my ($class, %options) = Sympa::CLI->getoptions(undef, \@argv);
+ 
+-    is $class, $wishedClass, "Class $wishedClass";
++    ok $class, join(' ', @_) =~ s/(.{73}).*/$1.../r;
++    is $class, $wishedClass, $wishedClass;
+     is_deeply \%options, $wishedOptions, sprintf '{%s}',
+         join(', ', sort keys %$wishedOptions) =~ s/(.{65}).*/$1.../r;
+     is_deeply \@argv, $wishedArgv, sprintf '[%s]',
+
+From 13d027c86f0e729f4533663471994f6e3ff4e367 Mon Sep 17 00:00:00 2001
+From: IKEDA Soji <mail@ikedas.net>
+Date: Sun, 26 Apr 2026 12:42:19 +0900
+Subject: [PATCH 2/2] add more test cases
+
+---
+ cpanfile           |  2 +-
+ t/CLI_getoptions.t | 31 +++++++++++++++++++++++++------
+ 2 files changed, 26 insertions(+), 7 deletions(-)
+
+diff --git a/cpanfile b/cpanfile
+index 3c2cb1cc6..53041f405 100644
+--- a/cpanfile
++++ b/cpanfile
+@@ -334,7 +334,7 @@ feature 'safe-unicode', 'Sanitizes inputs with Unicode text.' => sub {
+ on 'test' => sub {
+     requires 'Test::Compile';
+     requires 'Test::Harness';
+-    requires 'Test::More';
++    requires 'Test::More', '>= 0.96';
+     requires 'Test::Pod', '>= 1.41';
+ };
+ 
+diff --git a/t/CLI_getoptions.t b/t/CLI_getoptions.t
+index 475128793..97d7b842c 100644
+--- a/t/CLI_getoptions.t
++++ b/t/CLI_getoptions.t
+@@ -48,25 +48,44 @@ dotest(
+     [], qw(upgrade outgoing -n)
+ );
+ 
++dotest('Sympa::CLI::create', {input_file => '<path_to_input>'},
++    [], qw(create --input-file=<path_to_input>));
++dotest('Sympa::CLI::create', {input_file => '<path_to_input>'},
++    [], qw(create --input-file <path_to_input>));
++dotest('Sympa::CLI::create', {input_file => '<path_to_input>'},
++    [], qw(create --input_file=<path_to_input>));
++
+ # PR #1344
+ dotest('Sympa::CLI::config', {}, [qw(unknown)], qw(config unknown));
+ dotest('Sympa::CLI::config::create', {}, [qw(unknown)],
+     qw(config create unknown));
+ 
++# Issue #1966
++dotest('Sympa::CLI::add', {config => '<path_to_config>', force => 1},
++    [qw(mylist@example.org)],
++    qw(add -F -f <path_to_config> mylist@example.org));
++
++# Unknown options
++dotest(undef, {}, [qw(config create --unknown)], qw(config create --unknown));
++
+ sub dotest {
+     my $wishedClass   = shift;
+     my $wishedOptions = shift;
+     my $wishedArgv    = shift;
+     my @argv          = @_;
+ 
+-    my ($class, %options) = Sympa::CLI->getoptions(undef, \@argv);
++    my @warnings;
++    local $SIG{__WARN__} = sub { push @warnings, @_ };
+ 
+-    ok $class, join(' ', @_) =~ s/(.{73}).*/$1.../r;
++    note join(' ', @_) =~ s/(.{73}).*/$1.../r;
++    my ($class, %options) = Sympa::CLI->getoptions(undef, \@argv);
+     is $class, $wishedClass, $wishedClass;
+-    is_deeply \%options, $wishedOptions, sprintf '{%s}',
+-        join(', ', sort keys %$wishedOptions) =~ s/(.{65}).*/$1.../r;
+-    is_deeply \@argv, $wishedArgv, sprintf '[%s]',
+-        join(', ', @$wishedArgv) =~ s/(.{65}).*/$1.../r;
++    is_deeply \%options, $wishedOptions,
++        join('', explain $wishedOptions) =~ s/\n\s*//gr;
++    is_deeply \@argv, $wishedArgv,
++        join('', explain $wishedArgv) =~ s/\n\s*//gr;
++
++    note map { '  ' . $_ } @warnings if @warnings;
+ }
+ 
+ done_testing;

diff --git a/sympa.spec b/sympa.spec
index ba03471..6cb4e01 100644
--- a/sympa.spec
+++ b/sympa.spec
@@ -87,13 +87,13 @@ ExcludeArch: %{ix86}
 
 Name:        sympa
 Version:     6.2.78
-Release:     %{?pre_rel:0.}2%{?pre_rel:.%pre_rel}%{?dist}
+Release:     %{?pre_rel:0.}3%{?pre_rel:.%pre_rel}%{?dist}
 Summary:     Powerful multilingual List Manager
 Summary(fr): Gestionnaire de listes électroniques
 Summary(ja): 高機能で多言語対応のメーリングリスト管理ソフトウェア
 # The License: tag depends on bundled code for a given distro/release
 License:     GPL-2.0-or-later%{licenses_bundled}
-URL:         http://www.sympa.org
+URL:         https://sympa.community
 Source0:     https://github.com/sympa-community/sympa/releases/download/%{version}%{?pre_rel}/%{name}-%{version}%{?pre_rel}.tar.gz
 
 Source101:   sympa-httpd24-spawn_fcgi.conf
@@ -110,6 +110,8 @@ Source131:   sympa-sysusers.conf
 
 # RPM specific customization of site defaults
 Patch13:     sympa-6.2.57b.1-confdef.patch
+# https://github.com/sympa-community/sympa/pull/2050
+Patch20:      sympa-6.2.78-fix_old_style_cli.patch
 
 BuildRequires: gcc
 BuildRequires: gettext
@@ -421,6 +423,7 @@ Sympa documentation for developers.
 %prep
 %setup -q -n %{name}-%{version}%{?pre_rel}
 %patch -P13 -p0 -b .confdef
+%patch -P20 -p1 -b .fix_old_cli
 
 
 %build
@@ -826,6 +829,10 @@ fi
 
 
 %changelog
+* Wed Jun 10 2026 Xavier Bachelot <xavier@bachelot.org> - 6.2.78-3
+- Add upstream patch to fix old style CLI
+- Update URL:
+
 * Wed May 27 2026 Jerry James <loganjerry@gmail.com> - 6.2.78-2
 - Unbundle FontAwesome on all Fedora releases
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-15 12:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-15 12:42 [rpms/sympa] f43: Add upstream patch to fix old style CLI Xavier Bachelot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox