commit:     6a0735a283ec84214d5226749bf590fe45e5cb28
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  6 08:08:45 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul  6 08:08:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6a0735a2

app-portage/mirrorselect: backport --all parsing fix

Bug: https://bugs.gentoo.org/872218
Signed-off-by: Sam James <sam <AT> 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(+)

diff --git 
a/app-portage/mirrorselect/files/mirrorselect-2.3.0-main-Fix-all-option-parsing.patch
 
b/app-portage/mirrorselect/files/mirrorselect-2.3.0-main-Fix-all-option-parsing.patch
new file mode 100644
index 000000000000..0d0462c64752
--- /dev/null
+++ 
b/app-portage/mirrorselect/files/mirrorselect-2.3.0-main-Fix-all-option-parsing.patch
@@ -0,0 +1,48 @@
+From e0fbc2fb33762211aa5e64175d525e66f4c257d4 Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Thu, 6 Jul 2023 09:04:42 +0100
+Subject: [PATCH] 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: <[email protected]>
+Signed-off-by: Sam James <[email protected]>
+--- 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 (
+-- 
+2.41.0
+

diff --git a/app-portage/mirrorselect/mirrorselect-2.3.0-r2.ebuild 
b/app-portage/mirrorselect/mirrorselect-2.3.0-r2.ebuild
new file mode 100644
index 000000000000..42d5b60553c5
--- /dev/null
+++ b/app-portage/mirrorselect/mirrorselect-2.3.0-r2.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+DISTUTILS_USE_SETUPTOOLS=no
+PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_REQ_USE="xml(+)"
+
+inherit edo distutils-r1 prefix
+
+DESCRIPTION="Tool to help select distfiles mirrors for Gentoo"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Mirrorselect";
+SRC_URI="
+       https://dev.gentoo.org/~dolsen/releases/mirrorselect/${P}.tar.gz
+       https://dev.gentoo.org/~dolsen/releases/mirrorselect/mirrorselect-test
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+IUSE="ipv6"
+
+RDEPEND="
+       dev-util/dialog
+       >=net-analyzer/netselect-0.4[ipv6(+)?]
+       >=dev-python/ssl-fetch-0.3[${PYTHON_USEDEP}]
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-setup.py.patch
+       "${FILESDIR}"/${P}-main-Fix-all-option-parsing.patch
+)
+
+distutils_enable_tests setup.py
+
+python_prepare_all() {
+       python_setup
+
+       eprefixify setup.py mirrorselect/main.py
+       VERSION="${PVR}" edo "${PYTHON}" setup.py set_version
+
+       distutils-r1_python_prepare_all
+}

Reply via email to