aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2021-01-23 15:33:57 -0800
committerZac Medico <zmedico@gentoo.org>2021-02-07 16:58:17 -0800
commit443a108d545e79facd6916cbab38a10afdd212f2 (patch)
tree339f40e2a3c5403787568a223339b9810b800254
parentman/make.conf.5: FETCHCOMMAND DIGESTS placeholder uses colons (diff)
downloadportage-443a108d545e79facd6916cbab38a10afdd212f2.tar.gz
portage-443a108d545e79facd6916cbab38a10afdd212f2.tar.bz2
portage-443a108d545e79facd6916cbab38a10afdd212f2.zip
emaint --fix merges: add -y, --yes option
Since the emaint --fix merges uses emerge --ask, add a -y, --yes option to use --ask=n instead. Bug: https://bugs.gentoo.org/766767 Reviewed-by: Brian Dolbec <dolsen@gentoo.org> Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/portage/emaint/modules/merges/__init__.py14
-rw-r--r--lib/portage/emaint/modules/merges/merges.py11
-rw-r--r--man/emaint.16
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..682487c74 100644
--- a/man/emaint.1
+++ b/man/emaint.1
@@ -1,4 +1,4 @@
-.TH "EMAINT" "1" "Jan 2017" "Portage VERSION" "Portage"
+.TH "EMAINT" "1" "Feb 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