diff options
author | Michael Kuhn <michael.kuhn@ovgu.de> | 2022-03-03 14:21:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-03 14:21:15 +0100 |
commit | 49069e4f5887e2ff6de0754cfd855163e524feab (patch) | |
tree | b6607390363b488bd54e333072b1af6d32a2461c /lib/spack | |
parent | 20471b8420ff1c6f35f6e71434b9d18694ea6e0f (diff) | |
download | spack-49069e4f5887e2ff6de0754cfd855163e524feab.tar.gz spack-49069e4f5887e2ff6de0754cfd855163e524feab.tar.bz2 spack-49069e4f5887e2ff6de0754cfd855163e524feab.tar.xz spack-49069e4f5887e2ff6de0754cfd855163e524feab.zip |
installer: Fix cosmetic problem with terminal title (#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.
Diffstat (limited to 'lib/spack')
-rw-r--r-- | lib/spack/spack/installer.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index d08e828c80..41e29814e0 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -632,9 +632,14 @@ class TermTitle(object): # Counters used for showing status information in the terminal title self.pkg_num = 0 self.pkg_count = pkg_count + self.pkg_ids = set() - def next_pkg(self): - self.pkg_num += 1 + def next_pkg(self, pkg): + pkg_id = package_id(pkg) + + if pkg_id not in self.pkg_ids: + self.pkg_num += 1 + self.pkg_ids.add(pkg_id) def set(self, text): if not spack.config.get('config:terminal_title', False): @@ -1548,8 +1553,6 @@ class PackageInstaller(object): term_status = TermStatusLine(enabled=sys.stdout.isatty() and not tty.is_debug()) while self.build_pq: - term_title.next_pkg() - task = self._pop_task() if task is None: continue @@ -1559,6 +1562,7 @@ class PackageInstaller(object): keep_prefix = install_args.get('keep_prefix') pkg, pkg_id, spec = task.pkg, task.pkg_id, task.pkg.spec + term_title.next_pkg(pkg) term_title.set('Processing {0}'.format(pkg.name)) tty.debug('Processing {0}: task={1}'.format(pkg_id, task)) # Ensure that the current spec has NO uninstalled dependencies, |