[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: 0896ede9663d1ffb10434ee163205e7d9a909667 Author: Zac Medico gentoo org> AuthorDate: Mon Feb 26 00:12:13 2024 + Commit: Zac Medico gentoo org> CommitDate: Tue Feb 27 02:52:19 2024 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0896ede9 Scheduler: Support parallel-install with merge-wait For system packages, always serialize install regardless of parallel-install, in order to mitigate failures triggered by fragile states as in bug 256616. For other packages, continue to populate self._task_queues.merge, which will serialize install unless parallel-install is enabled. Fixes: 825db01b91a3 ("Add merge-wait FEATURES setting enabled by default") Bug: https://bugs.gentoo.org/256616 Bug: https://bugs.gentoo.org/925213 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/PackageMerge.py | 4 ++-- lib/_emerge/Scheduler.py| 44 +--- man/make.conf.5 | 9 ++--- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/lib/_emerge/PackageMerge.py b/lib/_emerge/PackageMerge.py index 82725c66a5..11d0ff2f37 100644 --- a/lib/_emerge/PackageMerge.py +++ b/lib/_emerge/PackageMerge.py @@ -1,4 +1,4 @@ -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from _emerge.CompositeTask import CompositeTask @@ -7,7 +7,7 @@ from portage.output import colorize class PackageMerge(CompositeTask): -__slots__ = ("merge", "postinst_failure") +__slots__ = ("is_system_pkg", "merge", "postinst_failure") def _should_show_status(self): return ( diff --git a/lib/_emerge/Scheduler.py b/lib/_emerge/Scheduler.py index 9950792dc9..5c318f89b9 100644 --- a/lib/_emerge/Scheduler.py +++ b/lib/_emerge/Scheduler.py @@ -1519,17 +1519,20 @@ class Scheduler(PollScheduler): self._deallocate_config(build.settings) elif build.returncode == os.EX_OK: self.curval += 1 -merge = PackageMerge(merge=build, scheduler=self._sched_iface) +merge = PackageMerge( +is_system_pkg=(build.pkg in self._deep_system_deps), +merge=build, +scheduler=self._sched_iface, +) self._running_tasks[id(merge)] = merge # By default, merge-wait only allows merge when no builds are executing. # As a special exception, dependencies on system packages are frequently # unspecified and will therefore force merge-wait. -is_system_pkg = build.pkg in self._deep_system_deps if not build.build_opts.buildpkgonly and ( -"merge-wait" in build.settings.features or is_system_pkg +"merge-wait" in build.settings.features or merge.is_system_pkg ): self._merge_wait_queue.append(merge) -if is_system_pkg: +if merge.is_system_pkg: merge.addStartListener(self._system_merge_started) else: self._task_queues.merge.add(merge) @@ -1804,13 +1807,32 @@ class Scheduler(PollScheduler): and not self._jobs and not self._task_queues.merge ): -task = self._merge_wait_queue.popleft() -task.scheduler = self._sched_iface -self._merge_wait_scheduled.append(task) -self._task_queues.merge.add(task) -task.addExitListener(self._merge_wait_exit_handler) -self._status_display.merges = len(self._task_queues.merge) -state_change += 1 +while self._merge_wait_queue: +# If we added non-system packages to the merge queue in a +# previous iteration of this loop, then for system packages we +# need to come back later when the merge queue is empty. +# TODO: Maybe promote non-system packages to the front of the +# queue and process them within the current loop, though that +# causes merge order to differ from the order builds finish. +if ( +self._task_queues.merge +and self._merge_wait_queue[0].is_system_pkg +): +break +task = self._merge_wait_queue.popleft() +task.scheduler = self._sched_iface +self._merge_wait_scheduled.append(task) +self._task_queues.merge.add(task) +task.addExitListener(self._merge_wait_exit_handler) +self._status_display.merges = len(self._task_queues.merge) +state_change += 1 +# For system packages, always serialize install regardless of +# parallel-install, in
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/, /
commit: fb8d44f02032a0c5ef64a84ac898c08104faf797 Author: Florian Schmaus gentoo org> AuthorDate: Tue Oct 10 06:52:29 2023 + Commit: Sam James gentoo org> CommitDate: Thu Oct 12 05:00:47 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fb8d44f0 emerge: Increase default number of maximum backtrack attempts from 10 to 20 Experience shows that 10 is too low and that in some cases a slighlty higher number results in a successful dependency calculation. Signed-off-by: Florian Schmaus gentoo.org> Closes: https://github.com/gentoo/portage/pull/1127 Signed-off-by: Sam James gentoo.org> NEWS| 2 ++ lib/_emerge/depgraph.py | 2 +- man/emerge.1| 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e437f481f6..9f93bfbf08 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ Features: * GNUMAKEFLAGS: also specify "-l $(nproc)", that is, limit by load average, per default. +* Increase default number of maximum backtrack attempts from 10 to 20. + Bug fixes: * bintree: Add another API member (invalid_errors) to allow eclean-pkg to suppress errors when cleaning invalid binpkgs (bug #900224). diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index a0d69ff305..ad835ac06a 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -11459,7 +11459,7 @@ def _backtrack_depgraph( ) -> tuple[Any, depgraph, list[str], int, int]: debug = "--debug" in myopts mydepgraph = None -max_retries = myopts.get("--backtrack", 10) +max_retries = myopts.get("--backtrack", 20) max_depth = max(1, (max_retries + 1) // 2) allow_backtracking = max_retries > 0 backtracker = Backtracker(max_depth) diff --git a/man/emerge.1 b/man/emerge.1 index ed3cf929fe..667138ff3a 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -440,7 +440,7 @@ precedence over existing changes. This option is automatically enabled with .BR \-\-backtrack=COUNT Specifies an integer number of times to backtrack if dependency calculation fails due to a conflict or an -unsatisfied dependency (default: \'10\'). +unsatisfied dependency (default: \'20\'). .TP .BR "\-\-binpkg\-changed\-deps [ y | n ]" Tells emerge to ignore binary packages for which the corresponding
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/, /, lib/portage/tests/resolver/
commit: c65bbcf7630f454ce84a4fa6b8ebff8488c6bfb2 Author: Tom Gillespie gmail com> AuthorDate: Sun Jan 15 22:46:25 2023 + Commit: Sam James gentoo org> CommitDate: Fri Feb 17 05:49:01 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c65bbcf7 emerge: add --onlydeps-with-ideps= option (bug 890777) Add --onlydeps-with-ideps option in order to include install-time dependencies with --onlydeps and --onlydeps-with-rdeps=n. The dependencies that get pulled in are those that are necessary for emerge --nodeps to succeed when run after the equivalent --onlydeps. The default --onlydeps --onlydeps-with-rdeps=n behavior is unchanged. This also adds a new test file test_onlydeps_ideps.py that is derived from test_onlydeps_minimal.py and tests the behavior for EAPI={7,8}. Additional tests have been added to test_onlydeps_minimal.py to ensure that the behavior at EAPI=0 remains unchanged. Bug: https://bugs.gentoo.org/890777 Signed-off-by: Tom Gillespie gmail.com> Closes: https://github.com/gentoo/portage/pull/979 Signed-off-by: Sam James gentoo.org> NEWS | 1 + lib/_emerge/depgraph.py| 3 +- lib/_emerge/main.py| 9 +- lib/portage/tests/resolver/test_onlydeps_ideps.py | 172 + .../tests/resolver/test_onlydeps_minimal.py| 25 +++ man/emerge.1 | 5 + 6 files changed, 212 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 3322fe32a..b1f317ce3 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ Features: * ebuild: Set GNUMAKEFLAGS="--output-sync=line" to ensure build logs are written to synchronously when running GNU make in parallel. This option is only set if MAKEOPTS and GNUMAKEFLAGS are left unset by the user. +* emerge: add --onlydeps-with-ideps= option (bug #890777). Bug fixes: * gpkg: Handle out-of-space errors (bug #891391). diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 9030b6543..1631ed126 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -3718,7 +3718,8 @@ class depgraph: ): edepend["RDEPEND"] = "" edepend["PDEPEND"] = "" -edepend["IDEPEND"] = "" +if self._frozen_config.myopts.get("--onlydeps-with-ideps") in ("n", None): +edepend["IDEPEND"] = "" ignore_build_time_deps = False if pkg.built and not removal_action: diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py index 921d8cae7..38233e05c 100644 --- a/lib/_emerge/main.py +++ b/lib/_emerge/main.py @@ -162,6 +162,7 @@ def insert_optional_args(args): "--jobs": valid_integers, "--keep-going": y_or_n, "--load-average": valid_floats, +"--onlydeps-with-ideps": y_or_n, "--onlydeps-with-rdeps": y_or_n, "--package-moves": y_or_n, "--quiet": y_or_n, @@ -573,8 +574,12 @@ def parse_opts(tmpcmdline, silent=False): + "Emerge will ignore matching binary packages. ", "action": "append", }, +"--onlydeps-with-ideps": { +"help": "modify interpretation of dependencies to include IDEPEND", +"choices": true_y_or_n, +}, "--onlydeps-with-rdeps": { -"help": "modify interpretation of depedencies", +"help": "modify interpretation of dependencies", "choices": true_y_or_n, }, "--rebuild-exclude": { @@ -671,7 +676,7 @@ def parse_opts(tmpcmdline, silent=False): "action": "store", }, "--root-deps": { -"help": "modify interpretation of depedencies", +"help": "modify interpretation of dependencies", "choices": ("True", "rdeps"), }, "--search-index": { diff --git a/lib/portage/tests/resolver/test_onlydeps_ideps.py b/lib/portage/tests/resolver/test_onlydeps_ideps.py new file mode 100644 index 0..e34ee2aed --- /dev/null +++ b/lib/portage/tests/resolver/test_onlydeps_ideps.py @@ -0,0 +1,172 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +class OnlydepsIdepsTestCase(TestCase): +def testOnlydepsIdepsEAPI7(self): +ebuilds = { +"dev-libs/A-1": { +"EAPI": "7", +"DEPEND": "dev-libs/B", +"RDEPEND": "dev-libs/C", +"PDEPEND": "dev-libs/D", +"IDEPEND": "dev-libs/E", +}, +"dev-libs/B-1": {}, +"dev-libs/C-1": {}, +"dev-libs/D-1": {}, +"dev-libs/E-1": {}, +} +ebuilds["dev-libs/F-1"] = ebuilds["dev-libs/A-1"] +installed = {} + +
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/, cnf/
commit: 353c61912b134b326da5ac16ef1d4bc74b8967d1 Author: KARBOWSKI Piotr gentoo org> AuthorDate: Mon Aug 1 20:55:41 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Wed Aug 3 15:57:38 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=353c6191 Scheduling policy switching Adds ability to control the scheduler policy that is used for emerge and all child processes. Mainly to interface the ability to switch to SCHED_IDLE as the solution to keep interactive tasks unaffected by building process happening in the background. On a test sample N=1 with AMD Ryzen 5950x and 64 GB of ram building sys-devel/gcc with lto enabled significantly reduces responsiveness of the system, even with CONFIG_SCHED_AUTOGROUP and PREEMPT enabled. Using a web browser result in visible lags, video playback in web browser, when using CPU decoding, also suffers greatly. Switching Portage to SCHED_IDLE (PORTAGE_SCHEDULING_POLICY="idle") results in no visible slowdowns and responsiveness is as if nothing in the background was happening. This is especially worthy feature when running on powerful CPUs, where users often opt in to build not only with parallel build jobs, but also with multiple packages at once. Anyone running with PORTAGE_NICENESS="19" will undoubtedly want to use this feature to force SCHED_IDLE policy. Closes: https://github.com/gentoo/portage/pull/861 Signed-off-by: KARBOWSKI Piotr gentoo.org> Signed-off-by: Mike Gilbert gentoo.org> cnf/make.conf.example | 17 + lib/_emerge/actions.py | 45 + man/make.conf.5| 16 3 files changed, 78 insertions(+) diff --git a/cnf/make.conf.example b/cnf/make.conf.example index 5b2229465..2e33a6e50 100644 --- a/cnf/make.conf.example +++ b/cnf/make.conf.example @@ -291,6 +291,23 @@ # unset. #PORTAGE_IONICE_COMMAND="ionice -c 3 -p \${PID}" # +# PORTAGE_SCHEDULING_POLICY allows changing the current scheduling policy. The +# supported options are 'other', 'batch', 'idle', 'fifo' and 'round-robin'. When +# unset, the scheduling policy remains unchanged, by default Linux uses 'other' +# policy. Users that wish to minimize the Portage's impact on system +# responsiveness should set scheduling policy to 'idle' which significantly +# reduces the disruption to the rest of the system by scheduling Portage as +# extremely low priority processes. +# +#PORTAGE_SCHEDULING_POLICY="idle" +# +# PORTAGE_SCHEDULING_PRIORITY allows changing the priority (1-99) of the current +# scheduling policy, only applies if PORTAGE_SCHEDULING_POLICY is set to 'fifo' +# or 'round-robin', for others the only supported priority is 0, If unset, +# defaults to lowest priority of the selected scheduling policy. +# +#PORTAGE_SCHEDULING_PRIORITY="99" +# # AUTOCLEAN enables portage to automatically clean out older or overlapping # packages from the system after every successful merge. This is the # same as running 'emerge -c' after every merge. Set with: "yes" or "no". diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index e2f3f2ccf..e79bb30c0 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -3054,6 +3054,7 @@ def config_protect_check(trees): def apply_priorities(settings): ionice(settings) nice(settings) +set_scheduling_policy(settings) def nice(settings): @@ -3094,6 +3095,50 @@ def ionice(settings): ) +def set_scheduling_policy(settings): +scheduling_policy = settings.get("PORTAGE_SCHEDULING_POLICY") +scheduling_priority = settings.get("PORTAGE_SCHEDULING_PRIORITY") + +if platform.system() != "Linux" or not scheduling_policy: +return os.EX_OK + +policies = { +"other": os.SCHED_OTHER, +"batch": os.SCHED_BATCH, +"idle": os.SCHED_IDLE, +"fifo": os.SCHED_FIFO, +"round-robin": os.SCHED_RR, +} + +out = portage.output.EOutput() + +if scheduling_policy in policies: +policy = policies[scheduling_policy] +else: +out.eerror("Invalid policy in PORTAGE_SCHEDULING_POLICY.") +out.eerror( +"See the make.conf(5) man page for PORTAGE_SCHEDULING_POLICY usage instructions." +) +return os.EX_USAGE + +if not scheduling_priority: +scheduling_priority = os.sched_get_priority_min(policy) +else: +scheduling_priority = int(scheduling_priority) +if scheduling_priority not in range( +os.sched_get_priority_min(policy), os.sched_get_priority_max(policy) + 1 +): +out.eerror("Invalid priority in PORTAGE_SCHEDULING_PRIORITY.") +out.eerror( +"See the make.conf(5) man page for PORTAGE_SCHEDULING_PRIORITY usage instructions." +) +return os.EX_USAGE + +os.sched_setscheduler(portage.getpid(), policy, os.sched_param(scheduling_priority)) + +return os.EX_OK + + def
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: e5be73709b1a42b40380fd336f9381452b01a723 Author: Christian Ruppert qasl de> AuthorDate: Wed Dec 22 09:12:06 2021 + Commit: Zac Medico gentoo org> CommitDate: Tue Dec 28 20:05:59 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e5be7370 Add -X shortopt for --exclude Closes: https://github.com/gentoo/portage/pull/780 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/main.py | 1 + man/emerge.1| 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py index 592a74692..8928f268d 100644 --- a/lib/_emerge/main.py +++ b/lib/_emerge/main.py @@ -472,6 +472,7 @@ def parse_opts(tmpcmdline, silent=False): "choices": y_or_n, }, "--exclude": { +"shortopt": "-X", "help": "A space separated list of package names or slot atoms. " + "Emerge won't install any ebuild or binary package that " + "matches any of the given package atoms.", diff --git a/man/emerge.1 b/man/emerge.1 index 8f6d12925..5ba88f3bc 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -1,4 +1,4 @@ -.TH "EMERGE" "1" "Nov 2021" "Portage VERSION" "Portage" +.TH "EMERGE" "1" "Dec 2021" "Portage VERSION" "Portage" .SH "NAME" emerge \- Command\-line interface to the Portage system .SH "SYNOPSIS" @@ -588,7 +588,7 @@ dependency tree, as though no packages are currently installed. You should run this with \fB\-\-pretend\fR first to make sure the result is what you expect. .TP -.BR "\-\-exclude " ATOMS +.BR "\-\-exclude, \-X ATOMS" A space separated list of package names or slot atoms. Emerge won't install any ebuild or binary package that matches any of the given package atoms.
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: 2c025e87bb6253f869f9e84e6eb0d98eecfd49c4 Author: Mike Gilbert gentoo org> AuthorDate: Mon Dec 20 16:16:30 2021 + Commit: Mike Gilbert gentoo org> CommitDate: Mon Dec 20 16:18:21 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2c025e87 Revert "emerge: Default enable soname dependencies (bug 687956)" This change seems to cause problems with emerge --depclean. Reverts: 6091fcd861034b9b20677098827eff7b7a148853 Bug: https://bugs.gentoo.org/687956 Bug: https://bugs.gentoo.org/829623 Signed-off-by: Mike Gilbert gentoo.org> lib/_emerge/create_depgraph_params.py | 2 +- man/emerge.1 | 7 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/_emerge/create_depgraph_params.py b/lib/_emerge/create_depgraph_params.py index 95c4c2035..11c3e3736 100644 --- a/lib/_emerge/create_depgraph_params.py +++ b/lib/_emerge/create_depgraph_params.py @@ -104,7 +104,7 @@ def create_depgraph_params(myopts, myaction): if ignore_built_slot_operator_deps is not None: myparams["ignore_built_slot_operator_deps"] = ignore_built_slot_operator_deps -myparams["ignore_soname_deps"] = myopts.get("--ignore-soname-deps", "n") +myparams["ignore_soname_deps"] = myopts.get("--ignore-soname-deps", "y") dynamic_deps = myopts.get("--dynamic-deps", "y") != "n" and "--nodeps" not in myopts if dynamic_deps: diff --git a/man/emerge.1 b/man/emerge.1 index ff565b46f..8f6d12925 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -639,10 +639,9 @@ supported beginning with \fBEAPI 5\fR. .TP .BR "\-\-ignore\-soname\-deps < y | n >" Ignore the soname dependencies of binary and installed packages. This -option may be useful when working with binary or installed packages -that lack appropriate soname dependency metadata because they were built -with a package manager that does not support soname dependencies (perhaps -an older version of portage). Soname +option is enabled by default, since soname dependencies are relatively +new, and the required metadata is not guaranteed to exist for binary and +installed packages built with older versions of portage. Also, soname dependencies will be automatically ignored for dependency calculations that can pull unbuilt ebuilds into the dependency graph, since unbuilt ebuilds do not have any soname dependency metadata, making it impossible
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: 6091fcd861034b9b20677098827eff7b7a148853 Author: Zac Medico gentoo org> AuthorDate: Mon Nov 29 01:11:51 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon Nov 29 01:11:51 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6091fcd8 emerge: Default enable soname dependencies (bug 687956) Default emerge --ignore-soname-deps=n, in order to enable soname dependencies by default. As always, soname dependencies remain inapplicable in the absence of the --usepkgonly option (or --getbinpkgonly). Therefore, this change only affects commands that specify --usepkgonly or --getbinpkgonly. Bug: https://bugs.gentoo.org/687956 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/create_depgraph_params.py | 2 +- man/emerge.1 | 7 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/_emerge/create_depgraph_params.py b/lib/_emerge/create_depgraph_params.py index 11c3e3736..95c4c2035 100644 --- a/lib/_emerge/create_depgraph_params.py +++ b/lib/_emerge/create_depgraph_params.py @@ -104,7 +104,7 @@ def create_depgraph_params(myopts, myaction): if ignore_built_slot_operator_deps is not None: myparams["ignore_built_slot_operator_deps"] = ignore_built_slot_operator_deps -myparams["ignore_soname_deps"] = myopts.get("--ignore-soname-deps", "y") +myparams["ignore_soname_deps"] = myopts.get("--ignore-soname-deps", "n") dynamic_deps = myopts.get("--dynamic-deps", "y") != "n" and "--nodeps" not in myopts if dynamic_deps: diff --git a/man/emerge.1 b/man/emerge.1 index 8f6d12925..ff565b46f 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -639,9 +639,10 @@ supported beginning with \fBEAPI 5\fR. .TP .BR "\-\-ignore\-soname\-deps < y | n >" Ignore the soname dependencies of binary and installed packages. This -option is enabled by default, since soname dependencies are relatively -new, and the required metadata is not guaranteed to exist for binary and -installed packages built with older versions of portage. Also, soname +option may be useful when working with binary or installed packages +that lack appropriate soname dependency metadata because they were built +with a package manager that does not support soname dependencies (perhaps +an older version of portage). Soname dependencies will be automatically ignored for dependency calculations that can pull unbuilt ebuilds into the dependency graph, since unbuilt ebuilds do not have any soname dependency metadata, making it impossible
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: 03520f0ac680d6af62176beb4a072750c11c0b49 Author: Zac Medico gentoo org> AuthorDate: Thu Jun 17 17:43:49 2021 + Commit: Zac Medico gentoo org> CommitDate: Thu Jun 17 17:45:00 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=03520f0a Revert "PORTAGE_NICENESS: Consider autogroup scheduling" This reverts commit 055abe523c2c3f6c8f1dccfb53565209222f90c1 due to another regression. See: https://github.com/gentoo/portage/pull/728 Bug: https://bugs.gentoo.org/777492 Bug: https://bugs.gentoo.org/785484 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/actions.py | 48 +++- man/make.conf.5| 10 +- 2 files changed, 4 insertions(+), 54 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index df5c86c6c..1946f49df 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -14,7 +14,6 @@ import textwrap import time import warnings from itertools import chain -from pathlib import Path import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -2635,55 +2634,14 @@ def apply_priorities(settings): nice(settings) def nice(settings): - nice_value: str = settings.get("PORTAGE_NICENESS", "").strip() - if not nice_value: - return - try: - current_nice_value = os.nice(int(nice_value)) - # Calling os.nice() with a value outside of the valid range of - # nice values, e.g. 20, caps the process's nice value. This is - # because the argument of os.nice() is not an absolute value, - # but the increment to the process's current nice - # value. Hence users may use PORTAGE_NICENESS=20 without any - # issues here. However, below we write nice_value potentially - # to /proc/self/autogroup, which will only accept valid nice - # values. Therefore we simply set nice_value to what os.nice() - # returned (i.e. the process's current nice value). - nice_value = str(current_nice_value) + os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) except (OSError, ValueError) as e: out = portage.output.EOutput() - out.eerror(f"Failed to change nice value to {nice_value}") + out.eerror("Failed to change nice value to '%s'" % \ + settings.get("PORTAGE_NICENESS", "0")) out.eerror("%s\n" % str(e)) - autogroup_file = Path("/proc/self/autogroup") - try: - f = autogroup_file.open("r+") - except EnvironmentError: - # Autogroup scheduling is not enabled on this system. - return - - with f: - line = f.readline() - original_autogroup_nice_value = line.split(" ")[2] - - # We need to restore the original nice value of the - # autogroup, as otherwise the session, e.g. the - # terminal where portage was executed in, would - # continue running with that value. - portage.atexit_register( - lambda value: autogroup_file.write_text(value), - original_autogroup_nice_value, - ) - - try: - f.write(nice_value) - except EnvironmentError as e: - out = portage.output.EOutput() - out.eerror(f"Failed to change autogroup's nice value to {nice_value}") - out.eerror("%s\n" % str(e)) - - def ionice(settings): ionice_cmd = settings.get("PORTAGE_IONICE_COMMAND") diff --git a/man/make.conf.5 b/man/make.conf.5 index 18573b5e2..1c72109ad 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -1,4 +1,4 @@ -.TH "MAKE.CONF" "5" "Jun 2021" "Portage VERSION" "Portage" +.TH "MAKE.CONF" "5" "May 2021" "Portage VERSION" "Portage" .SH "NAME" make.conf \- custom settings for Portage .SH "SYNOPSIS" @@ -1031,14 +1031,6 @@ The value of this variable will be added to the current nice level that emerge is running at. In other words, this will not set the nice level, it will increment it. For more information about nice levels and what are acceptable ranges, see \fBnice\fR(1). -.br -If set and portage is run under Linux with autogroup scheduling (see -\fBsched\fR(7)) enabled, then portage will set the nice value of its -autogroup to PORTAGE_NICENESS. Upon exiting, portage will restore the -original value. Note that if the function responsible for restoring the -original value is not run, e.g., because portage's process was killed, -then the autogroup will stay niced. In such a case, the value can be -reset via corresponding autogroup pseudo\-file in /proc. .TP \fBPORTAGE_RO_DISTDIRS\fR = \fI[space delimited list of directories]\fR When a given file does not exist in \fBDISTDIR\fR, search for
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: 055abe523c2c3f6c8f1dccfb53565209222f90c1 Author: Florian Schmaus geekplace eu> AuthorDate: Sun Mar 21 11:07:38 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon Jun 14 21:20:06 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=055abe52 PORTAGE_NICENESS: Consider autogroup scheduling With Linux's autogroup scheduling feature (CONFIG_SCHED_AUTOGROUP) setting a nice value on a per-process base has only an effect for scheduling decisions relative to the other threads in the same session (typically: the same terminal window). See the section "The nice value and group scheduling" in the sched(7) man page. Basically this means that portage "just" setting the nice value, has no effect in presence of autogroup scheduling being active (which is probably true for most (desktop) user systems). This commit changes emerge to set the autogroup's nice value, instead of the processes' nice value, in case autogroups are present (detected by the existence of /proc/self/autogroup). The tricky part about autogroup nice values is that we want restore the orignal nice value once we are finished. As otherwise, the session, e.g. your terminal, would continue using this value, and so would subsequently executed processes. For that we use Python's atexit functinaly, to register a function that will restore the orignal nice value of the autogroup. Users may have set PORTAGE_NICENESS to a value outside of the range of valid nice values [-20, 19]. Calling os.nice() with such a value will simply cap the process's nice value, but writing this invalid value to the autogoup pseudo-file will fail with "Invalid argument". Since os.nice() returns the current nice value, we simply use the returned value to set the autogroup nice value. Portage would previously always change the nice value to zero, even if the user did not explicitly request so. Now we do not change the nice value unless requested. Closes: https://github.com/gentoo/portage/pull/727 Bug: https://bugs.gentoo.org/777492 Signed-off-by: Florian Schmaus geekplace.eu> Signed-off-by: Zac Medico gentoo.org> lib/_emerge/actions.py | 48 +--- man/make.conf.5| 10 +- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 1946f49df..df5c86c6c 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -14,6 +14,7 @@ import textwrap import time import warnings from itertools import chain +from pathlib import Path import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -2634,14 +2635,55 @@ def apply_priorities(settings): nice(settings) def nice(settings): + nice_value: str = settings.get("PORTAGE_NICENESS", "").strip() + if not nice_value: + return + try: - os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) + current_nice_value = os.nice(int(nice_value)) + # Calling os.nice() with a value outside of the valid range of + # nice values, e.g. 20, caps the process's nice value. This is + # because the argument of os.nice() is not an absolute value, + # but the increment to the process's current nice + # value. Hence users may use PORTAGE_NICENESS=20 without any + # issues here. However, below we write nice_value potentially + # to /proc/self/autogroup, which will only accept valid nice + # values. Therefore we simply set nice_value to what os.nice() + # returned (i.e. the process's current nice value). + nice_value = str(current_nice_value) except (OSError, ValueError) as e: out = portage.output.EOutput() - out.eerror("Failed to change nice value to '%s'" % \ - settings.get("PORTAGE_NICENESS", "0")) + out.eerror(f"Failed to change nice value to {nice_value}") out.eerror("%s\n" % str(e)) + autogroup_file = Path("/proc/self/autogroup") + try: + f = autogroup_file.open("r+") + except EnvironmentError: + # Autogroup scheduling is not enabled on this system. + return + + with f: + line = f.readline() + original_autogroup_nice_value = line.split(" ")[2] + + # We need to restore the original nice value of the + # autogroup, as otherwise the session, e.g. the + # terminal where portage was executed in, would + # continue running with that value. + portage.atexit_register( + lambda value: autogroup_file.write_text(value), + original_autogroup_nice_value, + ) + + try: + f.write(nice_value) + except EnvironmentError as e: +
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: ac4f07b4b04aadf57f78cb21729e1f5439609f81 Author: Zac Medico gentoo org> AuthorDate: Mon Jun 14 06:23:56 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon Jun 14 06:26:00 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ac4f07b4 Revert "PORTAGE_NICENESS: Consider autogroup scheduling" This reverts commit a4d882964ee1931462f911d0c46a80e27e59fa48. It triggered this regression: # PORTAGE_NICENESS=20 emerge -av --depclean OSError: [Errno 22] Invalid argument During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python-exec/python3.9/emerge", line 51, in retval = emerge_main() File "/usr/lib/python3.9/site-packages/_emerge/main.py", line 1319, in emerge_main return run_action(emerge_config) File "/usr/lib/python3.9/site-packages/_emerge/actions.py", line 2999, in run_action apply_priorities(emerge_config.target_config.settings) File "/usr/lib/python3.9/site-packages/_emerge/actions.py", line 2635, in apply_priorities nice(settings) File "/usr/lib/python3.9/site-packages/_emerge/actions.py", line 2672, in nice out.eerror("%s\n" % str(e)) OSError: [Errno 22] Invalid argument Bug: https://bugs.gentoo.org/777492#c4 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/actions.py | 36 +++- man/make.conf.5| 10 +- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index bfb08ed6b..1946f49df 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -14,7 +14,6 @@ import textwrap import time import warnings from itertools import chain -from pathlib import Path import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -2635,43 +2634,14 @@ def apply_priorities(settings): nice(settings) def nice(settings): - nice_value: str = settings.get("PORTAGE_NICENESS", "0") - try: - os.nice(int(nice_value)) + os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) except (OSError, ValueError) as e: out = portage.output.EOutput() - out.eerror(f"Failed to change nice value to {nice_value}") + out.eerror("Failed to change nice value to '%s'" % \ + settings.get("PORTAGE_NICENESS", "0")) out.eerror("%s\n" % str(e)) - autogroup_file = Path("/proc/self/autogroup") - try: - f = autogroup_file.open("r+") - except EnvironmentError: - # Autogroup scheduling is not enabled on this system. - return - - with f: - line = f.readline() - original_autogroup_nice_value = line.split(" ")[2] - - # We need to restore the original nice value of the - # autogroup, as otherwise the session, e.g. the - # terminal where portage was executed in, would - # continue running with that value. - portage.atexit_register( - lambda value: autogroup_file.write_text(value), - original_autogroup_nice_value, - ) - - try: - f.write(nice_value) - except EnvironmentError as e: - out = portage.output.EOutput() - out.eerror(f"Failed to change autogroup's nice value to {nice_value}") - out.eerror("%s\n" % str(e)) - - def ionice(settings): ionice_cmd = settings.get("PORTAGE_IONICE_COMMAND") diff --git a/man/make.conf.5 b/man/make.conf.5 index 18573b5e2..1c72109ad 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -1,4 +1,4 @@ -.TH "MAKE.CONF" "5" "Jun 2021" "Portage VERSION" "Portage" +.TH "MAKE.CONF" "5" "May 2021" "Portage VERSION" "Portage" .SH "NAME" make.conf \- custom settings for Portage .SH "SYNOPSIS" @@ -1031,14 +1031,6 @@ The value of this variable will be added to the current nice level that emerge is running at. In other words, this will not set the nice level, it will increment it. For more information about nice levels and what are acceptable ranges, see \fBnice\fR(1). -.br -If set and portage is run under Linux with autogroup scheduling (see -\fBsched\fR(7)) enabled, then portage will set the nice value of its -autogroup to PORTAGE_NICENESS. Upon exiting, portage will restore the -original value. Note that if the function responsible for restoring the -original value is not run, e.g., because portage's process was killed, -then the autogroup will stay niced. In such a case, the value can be -reset via corresponding autogroup pseudo\-file in /proc. .TP \fBPORTAGE_RO_DISTDIRS\fR = \fI[space delimited list of directories]\fR When a given file does not exist in \fBDISTDIR\fR, search for the file
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/, lib/portage/util/, lib/portage/package/ebuild/_config/, ...
commit: 222adeecbd72f070eaa05e39b0951cabd6ba8026 Author: Petr Šabata redhat com> AuthorDate: Sat Nov 7 11:55:46 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Nov 22 00:35:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=222adeec Typofix: Use just one definite article I first noticed this in make.conf(5) but it turned out there were many more occurences of these; fixed with find & sed. Closes: https://github.com/gentoo/portage/pull/634 Signed-off-by: Petr Šabata redhat.com> Signed-off-by: Zac Medico gentoo.org> doc/package/ebuild/eapi/4.docbook | 2 +- lib/_emerge/depgraph.py | 2 +- lib/portage/cache/template.py | 2 +- lib/portage/package/ebuild/_config/KeywordsManager.py | 2 +- lib/portage/package/ebuild/_config/UseManager.py | 4 ++-- lib/portage/package/ebuild/config.py | 2 +- lib/portage/util/netlink.py | 2 +- man/make.conf.5 | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/package/ebuild/eapi/4.docbook b/doc/package/ebuild/eapi/4.docbook index 8dd0f1487..9120c0ff0 100644 --- a/doc/package/ebuild/eapi/4.docbook +++ b/doc/package/ebuild/eapi/4.docbook @@ -153,7 +153,7 @@ This new REQUIRED_USE metadata key is used to specify what USE flag combinations It's a semi common occurrence that an ebuild may need to state that they disallow USE flags in specific combinations- either mysql or sqlite for example, but not both. -Existing solutions rely on checking the the USE configuration in pkg_setup which is non-optimal due to pkg_setup being ran potentially hours after the initial emerge -p invocation. +Existing solutions rely on checking the USE configuration in pkg_setup which is non-optimal due to pkg_setup being ran potentially hours after the initial emerge -p invocation. Current versions of EAPI4 support a phase hook pkg_pretend that is intended to move pre-build checks to just after resolution. It has been proposed that pkg_pretend should continue the tradition of adhoc shell code validating the USE state- this too is non optimal for the following reasons- diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 6aaacfe44..a994caea7 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -10061,7 +10061,7 @@ def _resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner): # If this package was pulled in by a parent # package scheduled for merge, removing this - # package may cause the the parent package's + # package may cause the parent package's # dependency to become unsatisfied. for parent_node, atom in \ mydepgraph._dynamic_config._parent_atoms.get(pkg, []): diff --git a/lib/portage/cache/template.py b/lib/portage/cache/template.py index 31a4acc44..55b8dc40c 100644 --- a/lib/portage/cache/template.py +++ b/lib/portage/cache/template.py @@ -293,7 +293,7 @@ def serialize_eclasses(eclass_dict, chf_type='mtime', paths=True): """takes a dict, returns a string representing said dict""" """The "new format", which causes older versions of
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/, lib/portage/tests/emerge/
commit: 15ac405fecf3e52ffd93d9a34e472bdc18604a4f Author: Zac Medico gentoo org> AuthorDate: Sun Nov 1 05:19:02 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Nov 1 22:25:27 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=15ac405f emerge: add --quickpkg-direct-root option Specify the root to use as the --quickpkg-direct package source. This root is assumed to be immutable during the entire emerge operation. The default is set to "/". Bug: https://bugs.gentoo.org/752066 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/actions.py | 19 --- lib/_emerge/depgraph.py | 11 +-- lib/_emerge/main.py | 5 + lib/portage/tests/emerge/test_simple.py | 3 ++- man/emerge.1| 10 -- 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 5e8a46957..239bf6f47 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -49,7 +49,7 @@ from portage.package.ebuild._ipc.QueryCommand import QueryCommand from portage.package.ebuild.fetch import _hide_url_passwd from portage._sets import load_default_config, SETPREFIX from portage._sets.base import InternalPackageSet -from portage.util import cmp_sort_key, writemsg, varexpand, \ +from portage.util import cmp_sort_key, normalize_path, writemsg, varexpand, \ writemsg_level, writemsg_stdout from portage.util.digraph import digraph from portage.util.SlotObject import SlotObject @@ -106,13 +106,26 @@ def action_build(emerge_config, trees=DeprecationWarning, # before we get here, so warn if they're not (bug #267103). chk_updated_cfg_files(settings['EROOT'], ['/etc/portage']) + quickpkg_root = normalize_path(os.path.abspath( + emerge_config.opts.get('--quickpkg-direct-root', + emerge_config.running_config.settings['ROOT']))).rstrip(os.path.sep) + os.path.sep quickpkg_direct = ("--usepkg" in emerge_config.opts and emerge_config.opts.get('--quickpkg-direct', 'n') == 'y' and - emerge_config.target_config is not emerge_config.running_config) + emerge_config.target_config.settings['ROOT'] != quickpkg_root) if '--getbinpkg' in emerge_config.opts or quickpkg_direct: kwargs = {} if quickpkg_direct: - kwargs['add_repos'] = (emerge_config.running_config.trees['vartree'].dbapi,) + if quickpkg_root == emerge_config.running_config.settings['ROOT']: + quickpkg_vardb = emerge_config.running_config.trees['vartree'].dbapi + else: + quickpkg_settings = portage.config( + config_root=emerge_config.target_config.settings['PORTAGE_CONFIGROOT'], + target_root=quickpkg_root, + env=emerge_config.target_config.settings.backupenv.copy(), + sysroot=emerge_config.target_config.settings['SYSROOT'], + eprefix=emerge_config.target_config.settings['EPREFIX']) + quickpkg_vardb = portage.vartree(settings=quickpkg_settings).dbapi + kwargs['add_repos'] = (quickpkg_vardb,) try: emerge_config.target_config.trees['bintree'].populate( diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 0bb0352e7..6aaacfe44 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -41,7 +41,7 @@ from portage._sets import SETPREFIX from portage._sets.base import InternalPackageSet from portage.util import ConfigProtect, shlex_split, new_protect_filename from portage.util import cmp_sort_key, writemsg, writemsg_stdout -from portage.util import ensure_dirs +from portage.util import ensure_dirs, normalize_path from portage.util import writemsg_level, write_atomic from portage.util.digraph import digraph from portage.util.futures import asyncio @@ -4567,8 +4567,15 @@ class depgraph: self._dynamic_config._skip_restart = True return False, myfavorites + # Since --quickpkg-direct assumes that --quickpkg-direct-root is + # immutable, assert that there are no merge or unmerge tasks + # for --quickpkg-direct-root. + quickpkg_root = normalize_path(os.path.abspath( + self._frozen_config.myopts.get('--quickpkg-direct-root', + self._frozen_config._running_root.settings['ROOT']))).rstrip(os.path.sep) + os.path.sep if (self._frozen_config.myopts.get('--quickpkg-direct', 'n') == 'y' and -
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
commit: 03ae0d95797f68cf86748ae3da184f3018e8c64c Author: Zac Medico gentoo org> AuthorDate: Tue Sep 1 02:49:50 2020 + Commit: Zac Medico gentoo org> CommitDate: Tue Sep 8 00:17:54 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=03ae0d95 emerge --search: auto-detect regular expressions (bug 737480) Automatically detect regular expressions when the search string contains any of these regular expression characters or character sequences: ^ $ * [ ] { } | ? .+ This simplifies usage, so that users no longer have to remember to prefix regular expressions with the % character. The new behavior can be disabled by --regex-search-auto=n, in case the regular expressions interpretation causes some kind of problem. Note that fuzzy search and regular expression search are mutually exclusive, and fuzzy search remains the default for search strings that do not contain any regular expression characters. Bug: https://bugs.gentoo.org/737480 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/actions.py | 1 + lib/_emerge/main.py| 6 ++ lib/_emerge/search.py | 12 +++- man/emerge.1 | 12 +++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index a4ecfe43d..f57269817 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -2036,6 +2036,7 @@ def action_search(root_config, myopts, myfiles, spinner): search_index=myopts.get("--search-index", "y") != "n", search_similarity=myopts.get("--search-similarity"), fuzzy=myopts.get("--fuzzy-search") != "n", + regex_auto=myopts.get("--regex-search-auto") != "n", ) for mysearch in myfiles: try: diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py index 975738762..5075f7f57 100644 --- a/lib/_emerge/main.py +++ b/lib/_emerge/main.py @@ -709,6 +709,12 @@ def parse_opts(tmpcmdline, silent=False): "action" : "store" }, + "--regex-search-auto": { + "help" : "Enable or disable automatic regular expression detection for search actions", + "choices": y_or_n, + "default": "y", + }, + "--root": { "help" : "specify the target root filesystem for merging packages", "action" : "store" diff --git a/lib/_emerge/search.py b/lib/_emerge/search.py index a59191c1a..61eed0827 100644 --- a/lib/_emerge/search.py +++ b/lib/_emerge/search.py @@ -28,7 +28,7 @@ class search: # def __init__(self, root_config, spinner, searchdesc, verbose, usepkg, usepkgonly, search_index=True, - search_similarity=None, fuzzy=True): + search_similarity=None, fuzzy=True, regex_auto=False): """Searches the available and installed packages for the supplied search key. The list of available and installed packages is created at object instantiation. This makes successive searches faster.""" @@ -42,6 +42,7 @@ class search: self.spinner = None self.root_config = root_config self.setconfig = root_config.setconfig + self.regex_auto = regex_auto self.fuzzy = fuzzy self.search_similarity = (80 if search_similarity is None else search_similarity) @@ -259,6 +260,15 @@ class search: if '/' in self.searchkey: match_category = 1 fuzzy = False + + if self.regex_auto and not regexsearch and re.search(r'[\^\$\*\[\]\{\}\|\?]|\.\+', self.searchkey) is not None: + try: + re.compile(self.searchkey, re.I) + except Exception: + pass + else: + regexsearch = True + if regexsearch: self.searchre=re.compile(self.searchkey,re.I) else: diff --git a/man/emerge.1 b/man/emerge.1 index fe7d05a21..c1bcd0220 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -229,7 +229,9 @@ explicitly discarded by running `emaint \-\-fix cleanresume` (see .BR \-\-search ", " \-s Searches for matches of the supplied string in the ebuild repository. By default emerge uses a case-insensitive simple search, but you can -enable a regular expression search by prefixing the search string with %. +enable a regular expression search by prefixing the search string with % +(the % prefix can often be omitted if the +\fB\-\-regex\-search\-auto\fR option is enabled). For example, \fBemerge \-\-search "%^kde"\fR searches for any package whose name starts with "kde"; \fBemerge
[gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/, lib/portage/dbapi/, lib/portage/tests/emerge/
commit: 8faad11a18fcc33329931a75002f293e8fa462eb Author: Zac Medico gentoo org> AuthorDate: Mon Nov 25 05:08:14 2019 + Commit: Zac Medico gentoo org> CommitDate: Wed Nov 27 03:19:20 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8faad11a emerge: add --quickpkg-direct option Enable use of installed packages directly as binary packages. This is similar to using binary packages produced by quickpkg(1), but installed packages are used directly as though they are binary packages. This option only works in combination with the --root=DIR option, and it comes with the caveat that packages are only allowed to be installed into the root that is specified by the --root=DIR option. The other root which serves as a source of packages is assumed to be immutable during the entire operation (similar to --buildpkgonly mode). Default behavior for handling of protected configuration files is controlled by the QUICKPKG_DEFAULT_OPTS variable. When a configuration file is not included because it is protected, an ewarn message is logged. Suggested use cases: * Install packages from a buildtime container into an empty root, in order to create a minimal runtime container (which need not include a package manager). In a multi-stage Dockerfile, install runtime files to an empty directory in the build stage, and in the final stage use COPY to populate a container with the contents of that directory. For greater efficiency, use buildah to install directly into a mounted container, avoiding the COPY step. Use the emerge --usepkgonly and --ignore-soname-deps=n options to account for soname dependencies, allowing implicit system dependencies such as glibc to be automatically pulled into the runtime image. * Enable a live usb, iso, or pxe image to act as a binary installer that uses packages installed in the live image as a source of binary packages. Bug: https://bugs.gentoo.org/699986 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/Binpkg.py | 59 +--- lib/_emerge/Scheduler.py| 7 +- lib/_emerge/actions.py | 37 -- lib/_emerge/depgraph.py | 19 ++ lib/_emerge/main.py | 7 +- lib/portage/dbapi/__init__.py | 5 +- lib/portage/dbapi/bintree.py| 112 -- lib/portage/dbapi/vartree.py| 117 ++-- lib/portage/tests/emerge/test_simple.py | 3 +- man/emerge.1| 19 +- 10 files changed, 338 insertions(+), 47 deletions(-) diff --git a/lib/_emerge/Binpkg.py b/lib/_emerge/Binpkg.py index f9cffa26d..b5a69f8e7 100644 --- a/lib/_emerge/Binpkg.py +++ b/lib/_emerge/Binpkg.py @@ -7,7 +7,6 @@ import _emerge.emergelog from _emerge.EbuildPhase import EbuildPhase from _emerge.BinpkgFetcher import BinpkgFetcher from _emerge.BinpkgEnvExtractor import BinpkgEnvExtractor -from _emerge.BinpkgExtractorAsync import BinpkgExtractorAsync from _emerge.CompositeTask import CompositeTask from _emerge.BinpkgVerifier import BinpkgVerifier from _emerge.EbuildMerge import EbuildMerge @@ -16,6 +15,7 @@ from _emerge.SpawnProcess import SpawnProcess from portage.eapi import eapi_exports_replace_vars from portage.util import ensure_dirs from portage.util._async.AsyncTaskFuture import AsyncTaskFuture +from portage.util.futures.compat_coroutine import coroutine import portage from portage import os from portage import shutil @@ -135,11 +135,14 @@ class Binpkg(CompositeTask): pkg = self.pkg pkg_count = self.pkg_count - fetcher = BinpkgFetcher(background=self.background, - logfile=self.settings.get("PORTAGE_LOG_FILE"), pkg=self.pkg, - pretend=self.opts.pretend, scheduler=self.scheduler) + fetcher = None if self.opts.getbinpkg and self._bintree.isremote(pkg.cpv): + + fetcher = BinpkgFetcher(background=self.background, + logfile=self.settings.get("PORTAGE_LOG_FILE"), pkg=self.pkg, + pretend=self.opts.pretend, scheduler=self.scheduler) + msg = " --- (%s of %s) Fetching Binary (%s::%s)" %\ (pkg_count.curval, pkg_count.maxval, pkg.cpv, fetcher.pkg_path) @@ -160,7 +163,7 @@ class Binpkg(CompositeTask): # The fetcher only has a returncode when # --getbinpkg is enabled. - if fetcher.returncode is not None: + if fetcher is not None: self._fetched_pkg = fetcher.pkg_path if self._default_exit(fetcher) != os.EX_OK: self._async_unlock_builddir(returncode=self.returncode) @@ -209,7 +212,8 @@ class Binpkg(CompositeTask):