commit: 7bfddc6b9ce724d141713223669490d4b46f76da Author: steering7253 <steering7253 <AT> proton <DOT> me> AuthorDate: Sat Jul 5 09:56:01 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Thu Sep 11 00:52:56 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7bfddc6b
Hostname support in titles for all titles Move hostname support to the xtermTitle function, instead of (some of) the places that call it. Notably, this adds the hostname to the initial static "emerge" display when syncing or calculating dependencies. It also removes duplicated code. Signed-off-by: John Runyon <steering7253 <AT> proton.me> Part-of: https://github.com/gentoo/portage/pull/1448 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/_emerge/JobStatusDisplay.py | 6 ------ lib/_emerge/emergelog.py | 2 -- lib/portage/output.py | 3 +++ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/_emerge/JobStatusDisplay.py b/lib/_emerge/JobStatusDisplay.py index b98d4a8327..eefb72c49b 100644 --- a/lib/_emerge/JobStatusDisplay.py +++ b/lib/_emerge/JobStatusDisplay.py @@ -296,11 +296,5 @@ class JobStatusDisplay: self._update(color_output.getvalue()) if self.xterm_titles: - # If the HOSTNAME variable is exported, include it - # in the xterm title, just like emergelog() does. - # See bug #390699. title_str = " ".join(plain_output.split()) - hostname = os.environ.get("HOSTNAME") - if hostname is not None: - title_str = f"{hostname}: {title_str}" xtermTitle(title_str) diff --git a/lib/_emerge/emergelog.py b/lib/_emerge/emergelog.py index 30e27a8114..0b73ce98d2 100644 --- a/lib/_emerge/emergelog.py +++ b/lib/_emerge/emergelog.py @@ -27,8 +27,6 @@ def emergelog(xterm_titles, mystr, short_msg=None): short_msg = _unicode_decode(short_msg) if xterm_titles and short_msg: - if "HOSTNAME" in os.environ: - short_msg = os.environ["HOSTNAME"] + ": " + short_msg xtermTitle(short_msg) try: file_path = os.path.join(_emerge_log_dir, "emerge.log") diff --git a/lib/portage/output.py b/lib/portage/output.py index 42eb5062cf..27da869b86 100644 --- a/lib/portage/output.py +++ b/lib/portage/output.py @@ -282,6 +282,9 @@ def xtermTitle(mystr, raw=False): ) if dotitles and not _disable_xtermTitle: + if "HOSTNAME" in os.environ and not raw: + hostname = os.environ["HOSTNAME"] + mystr = f"{hostname}: {mystr}" # If the title string is too big then the terminal can # misbehave. Therefore, truncate it if it's too big. if len(mystr) > _max_xtermTitle_len:
