Skip to content

Commit

Permalink
Skip self update logic when installation.TYPE != SYSTEM
Browse files Browse the repository at this point in the history
If we are running from source (git) or as a module installed via pip, we
don't need to worry about overwriting the existing system install via an
ebuild installation.

Signed-off-by: Mike Gilbert <[email protected]>
  • Loading branch information
floppym committed Nov 3, 2024
1 parent ac88048 commit 1e2df4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions lib/_emerge/Scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from portage import os
from portage import _encodings
from portage import _unicode_encode
from portage import installation
from portage.cache.mappings import slot_dict_class
from portage.elog.messages import eerror
from portage.output import colorize, create_color_func, red
Expand Down Expand Up @@ -339,6 +340,9 @@ def __init__(
)

def _handle_self_update(self):
if installation.TYPE != installation.TYPES.SYSTEM:
return os.EX_OK

if self._opts_no_self_update.intersection(self.myopts):
return os.EX_OK

Expand Down
16 changes: 10 additions & 6 deletions lib/portage/package/ebuild/doebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from portage import (
bsd_chflags,
eapi_is_supported,
installation,
merge,
os,
selinux,
Expand Down Expand Up @@ -3280,10 +3281,13 @@ def _prepare_self_update(settings):


def _handle_self_update(settings, vardb):
cpv = settings.mycpv
if settings["ROOT"] == "/" and portage.dep.match_from_list(
portage.const.PORTAGE_PACKAGE_ATOM, [cpv]
if installation.TYPE != installation.TYPES.SYSTEM:
return False
if settings["ROOT"] != "/":
return False
if not portage.dep.match_from_list(
portage.const.PORTAGE_PACKAGE_ATOM, [settings.mycpv]
):
_prepare_self_update(settings)
return True
return False
return False
_prepare_self_update(settings)
return True

0 comments on commit 1e2df4c

Please sign in to comment.