Skip to content

Commit 49069e4

Browse files
authored
installer: Fix cosmetic problem with terminal title (spack#29070)
The status displayed in the terminal title could be wrong when doing distributed builds. For instance, doing `spack install glib` in two different terminals could lead to the current package being reported as `40/29` due to the way Spack handles retrying locks. Work around this by keeping track of the package IDs that were already encountered to avoid counting packages twice.
1 parent 20471b8 commit 49069e4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/spack/spack/installer.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,14 @@ def __init__(self, pkg_count):
632632
# Counters used for showing status information in the terminal title
633633
self.pkg_num = 0
634634
self.pkg_count = pkg_count
635+
self.pkg_ids = set()
635636

636-
def next_pkg(self):
637-
self.pkg_num += 1
637+
def next_pkg(self, pkg):
638+
pkg_id = package_id(pkg)
639+
640+
if pkg_id not in self.pkg_ids:
641+
self.pkg_num += 1
642+
self.pkg_ids.add(pkg_id)
638643

639644
def set(self, text):
640645
if not spack.config.get('config:terminal_title', False):
@@ -1548,8 +1553,6 @@ def install(self):
15481553
term_status = TermStatusLine(enabled=sys.stdout.isatty() and not tty.is_debug())
15491554

15501555
while self.build_pq:
1551-
term_title.next_pkg()
1552-
15531556
task = self._pop_task()
15541557
if task is None:
15551558
continue
@@ -1559,6 +1562,7 @@ def install(self):
15591562
keep_prefix = install_args.get('keep_prefix')
15601563

15611564
pkg, pkg_id, spec = task.pkg, task.pkg_id, task.pkg.spec
1565+
term_title.next_pkg(pkg)
15621566
term_title.set('Processing {0}'.format(pkg.name))
15631567
tty.debug('Processing {0}: task={1}'.format(pkg_id, task))
15641568
# Ensure that the current spec has NO uninstalled dependencies,

0 commit comments

Comments
 (0)