Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 872218 - app-portage/mirrorselect --all broken in (~amd64)
Summary: app-portage/mirrorselect --all broken in (~amd64)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-09-21 15:49 UTC by xpenev
Modified: 2023-07-06 08:12 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Potential Fix (dash-all.diff,1.49 KB, patch)
2022-09-21 15:55 UTC, xpenev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description xpenev 2022-09-21 15:49:51 UTC
r5@ryzen ~ $ mirrorselect --version; mirrorselect --all
Mirrorselect version: 2.3.0-r1
ERROR: Choose at most one of -s or -a


Reproducible: Always

Steps to Reproduce:
1. mirrorselect --all

Actual Results:  
ERROR: Choose at most one of -s or -a

Expected Results:  
A list of mirrors.

As a workaround, one may use the nonsensical incarnation

mirrorselect --all --servers 0

A patch that can be used to fix the issue is

ryzen ~ # cat /etc/portage/patches/app-portage/mirrorselect-2.3.0-r1/dash-all.patch
diff --git a/mirrorselect/main.py b/mirrorselect/main.py
index 0fbd7b2..444582a 100755
--- a/mirrorselect/main.py
+++ b/mirrorselect/main.py
@@ -145,6 +145,11 @@ class MirrorSelect(object):
                        self.output.white("      interactive:"),
                        "                # mirrorselect -i -r",
                        ))
+
+               def set_servers(option, opt_str, value, parser):
+                       set_servers.user_configured = True
+                       setattr(parser.values, option.dest, value)
+
                parser = OptionParser(
                        formatter=ColoredFormatter(self.output), description=desc,
                        version='Mirrorselect version: %s' % version)
@@ -236,8 +241,8 @@ class MirrorSelect(object):
                        "-q", "--quiet", action="store_const", const=0, dest="verbosity",
                        help="Quiet mode")
                group.add_option(
-                       "-s", "--servers", action="store", type="int", default=1,
-                       help="Specify Number of servers for Automatic Mode "
+                       "-s", "--servers", action="callback", callback=set_servers,
+                       type="int", default=1, help="Specify Number of servers for Automatic Mode "
                        "to select. this is only valid for download mirrors. "
                        "If this is not specified, a default of 1 is used.")
                group.add_option(
@@ -271,7 +276,7 @@ class MirrorSelect(object):
                if options.rsync and not (options.interactive or options.all_mirrors):
                        self.output.print_err('rsync servers can only be selected with -i or -a')

-               if options.servers and options.all_mirrors:
+               if options.all_mirrors and hasattr(set_servers, 'user_configured'):
                        self.output.print_err('Choose at most one of -s or -a')

                if options.interactive and (
Comment 1 xpenev 2022-09-21 15:55:19 UTC
Created attachment 813340 [details, diff]
Potential Fix
Comment 2 Greg Kubaryk 2022-09-22 03:12:28 UTC
can reproduce failure locally
Comment 3 Jack 2023-06-01 16:31:06 UTC
Note 2.3.0-r1 is now marked stable, not (~)
Comment 4 Larry the Git Cow gentoo-dev 2023-07-06 08:05:38 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=e0fbc2fb33762211aa5e64175d525e66f4c257d4

commit e0fbc2fb33762211aa5e64175d525e66f4c257d4
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-07-06 08:04:42 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-07-06 08:04:42 +0000

    main: Fix --all option parsing
    
    Avoid --all erroring out with "ERROR: Choose at most one of -s or -a".
    
    Bug: https://bugs.gentoo.org/872218
    Fixes: 7caac017833b01e13028658effc502430c56d770
    Thanks-to: <xpenev@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 mirrorselect/main.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
Comment 5 Larry the Git Cow gentoo-dev 2023-07-06 08:12:16 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6a0735a283ec84214d5226749bf590fe45e5cb28

commit 6a0735a283ec84214d5226749bf590fe45e5cb28
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-07-06 08:08:45 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-07-06 08:08:45 +0000

    app-portage/mirrorselect: backport --all parsing fix
    
    Bug: https://bugs.gentoo.org/872218
    Signed-off-by: Sam James <sam@gentoo.org>

 ...rselect-2.3.0-main-Fix-all-option-parsing.patch | 48 ++++++++++++++++++++++
 .../mirrorselect/mirrorselect-2.3.0-r2.ebuild      | 44 ++++++++++++++++++++
 2 files changed, 92 insertions(+)