From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] emaint --fix merges: add -y, --yes option
Date: Thu, 28 Jan 2021 17:50:09 -0500 [thread overview]
Message-ID: <20210128175009.23e39b90@rogue1> (raw)
In-Reply-To: <20210123233849.44785-1-zmedico@gentoo.org>
On Sat, 23 Jan 2021 15:38:49 -0800
Zac Medico <zmedico@gentoo.org> wrote:
> Since the emaint --fix merges uses emerge --ask, add
> a -y, --yes option to use --ask=n instead.
Looks good to me
>
> Bug: https://bugs.gentoo.org/766767
> Signed-off-by: Zac Medico <zmedico@gentoo.org>
> ---
> lib/portage/emaint/modules/merges/__init__.py | 14 ++++++++++++--
> lib/portage/emaint/modules/merges/merges.py | 11 +++++++----
> man/emaint.1 | 6 +++++-
> 3 files changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/lib/portage/emaint/modules/merges/__init__.py
> b/lib/portage/emaint/modules/merges/__init__.py index
> 89aa758a0..449f39dce 100644 ---
> a/lib/portage/emaint/modules/merges/__init__.py +++
> b/lib/portage/emaint/modules/merges/__init__.py @@ -1,4 +1,4 @@
> -# Copyright 2005-2014 Gentoo Foundation
> +# Copyright 2005-2021 Gentoo Authors
> # Distributed under the terms of the GNU General Public License v2
>
> doc = """Scan for failed merges and fix them."""
> @@ -26,7 +26,17 @@ module_spec = {
> 'action': 'store_true',
> 'func': 'purge'
> }
> - }
> + },
> + 'opt_desc': {
> + 'yes': {
> + "short": "-y",
> + "long": "--yes",
> + "help": ("(merges submodule
> only): Do not prompt for "
> + "emerge
> invocations"),
> + "action": "store_true",
> + "dest": "yes",
> + }
> + },
> }
> }
> }
> diff --git a/lib/portage/emaint/modules/merges/merges.py
> b/lib/portage/emaint/modules/merges/merges.py index
> 775dc59d2..d60916f1e 100644 ---
> a/lib/portage/emaint/modules/merges/merges.py +++
> b/lib/portage/emaint/modules/merges/merges.py @@ -1,4 +1,4 @@
> -# Copyright 2005-2020 Gentoo Authors
> +# Copyright 2005-2021 Gentoo Authors
> # Distributed under the terms of the GNU General Public License v2
>
> import portage
> @@ -186,7 +186,7 @@ class MergesHandler:
> pkg_atoms.add(pkg_atom)
>
>
> - def _emerge_pkg_atoms(self, module_output, pkg_atoms):
> + def _emerge_pkg_atoms(self, module_output, pkg_atoms,
> yes=False): """
> Emerge the specified packages atoms.
>
> @@ -194,6 +194,8 @@ class MergesHandler:
> @type module_output: Class
> @param pkg_atoms: packages atoms to emerge
> @type pkg_atoms: set
> + @param yes: do not prompt for emerge invocations
> + @type yes: bool
> @rtype: list
> @return: List of results
> """
> @@ -206,7 +208,7 @@ class MergesHandler:
> portage._python_interpreter,
> '-b',
> os.path.join(EPREFIX or '/', 'usr', 'bin',
> 'emerge'),
> - '--ask',
> + '--ask=n' if yes else '--ask',
> '--quiet',
> '--oneshot',
> '--complete-graph=y'
> @@ -265,7 +267,8 @@ class MergesHandler:
> errors.append(', '.join(sorted(failed_pkgs)))
> return (False, errors)
> self._remove_failed_dirs(failed_pkgs)
> - results = self._emerge_pkg_atoms(module_output,
> pkg_atoms)
> + results = self._emerge_pkg_atoms(module_output,
> pkg_atoms,
> + yes=kwargs.get('options', {}).get("yes",
> False)) # list any new failed merges
> for pkg in sorted(self._scan()):
> results.append("'%s' still found as a failed
> merge." % pkg) diff --git a/man/emaint.1 b/man/emaint.1
> index d244756e9..c9f8ab939 100644
> --- a/man/emaint.1
> +++ b/man/emaint.1
> @@ -1,4 +1,4 @@
> -.TH "EMAINT" "1" "Jan 2017" "Portage VERSION" "Portage"
> +.TH "EMAINT" "1" "Jan 2021" "Portage VERSION" "Portage"
> .SH NAME
> emaint \- performs package management related system health checks
> and maintenance .SH SYNOPSIS
> @@ -82,6 +82,10 @@ OPTION
> .BR \-t \ \fINUM\fR,\ \-\-time \ \fINUM\fR
> Changes the minimum age \fINUM\fR (in days) of the logs to be listed
> or deleted.
> +.SH OPTIONS merges command only
> +.TP
> +.BR \-y ", " \-\-yes
> +Do not prompt for emerge invocations.
> .SH OPTIONS sync command only
> .TP
> .BR \-a ", " \-\-auto
prev parent reply other threads:[~2021-01-28 22:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 23:38 [gentoo-portage-dev] [PATCH] emaint --fix merges: add -y, --yes option Zac Medico
2021-01-28 22:50 ` Brian Dolbec [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210128175009.23e39b90@rogue1 \
--to=dolsen@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox