diff options
Diffstat (limited to 'lib/spack/spack/installer.py')
-rw-r--r-- | lib/spack/spack/installer.py | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index b9ae0f46fa..d5d15f4f99 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -215,18 +215,18 @@ def _hms(seconds): def _install_from_cache(pkg, cache_only, explicit, unsigned=False): """ - Install the package from binary cache + Extract the package from binary cache Args: pkg (PackageBase): the package to install from the binary cache - cache_only (bool): only install from binary cache + cache_only (bool): only extract from binary cache explicit (bool): ``True`` if installing the package was explicitly requested by the user, otherwise, ``False`` unsigned (bool): ``True`` if binary package signatures to be checked, otherwise, ``False`` Return: - (bool) ``True`` if the package was installed from binary cache, + (bool) ``True`` if the package was extract from binary cache, ``False`` otherwise """ installed_from_cache = _try_install_from_binary_cache(pkg, explicit, @@ -237,10 +237,10 @@ def _install_from_cache(pkg, cache_only, explicit, unsigned=False): if cache_only: tty.die('{0} when cache-only specified'.format(pre)) - tty.debug('{0}: installing from source'.format(pre)) + tty.msg('{0}: installing from source'.format(pre)) return False - tty.debug('Successfully installed {0} from binary cache'.format(pkg_id)) + tty.debug('Successfully extracted {0} from binary cache'.format(pkg_id)) _print_installed_pkg(pkg.spec.prefix) spack.hooks.post_install(pkg.spec) return True @@ -275,17 +275,17 @@ def _process_external_package(pkg, explicit): if spec.external_module: tty.msg('{0} has external module in {1}' .format(pre, spec.external_module)) - tty.msg('{0} is actually installed in {1}' - .format(pre, spec.external_path)) + tty.debug('{0} is actually installed in {1}' + .format(pre, spec.external_path)) else: - tty.msg("{0} externally installed in {1}" + tty.msg('{0} externally installed in {1}' .format(pre, spec.external_path)) try: # Check if the package was already registered in the DB. # If this is the case, then just exit. rec = spack.store.db.get_record(spec) - tty.msg('{0} already registered in DB'.format(pre)) + tty.debug('{0} already registered in DB'.format(pre)) # Update the value of rec.explicit if it is necessary _update_explicit_entry_in_db(pkg, rec, explicit) @@ -294,11 +294,11 @@ def _process_external_package(pkg, explicit): # If not, register it and generate the module file. # For external packages we just need to run # post-install hooks to generate module files. - tty.msg('{0} generating module file'.format(pre)) + tty.debug('{0} generating module file'.format(pre)) spack.hooks.post_install(spec) # Add to the DB - tty.msg('{0} registering into DB'.format(pre)) + tty.debug('{0} registering into DB'.format(pre)) spack.store.db.add(spec, None, explicit=explicit) @@ -314,7 +314,7 @@ def _process_binary_cache_tarball(pkg, binary_spec, explicit, unsigned): otherwise, ``False`` Return: - (bool) ``True`` if the package was installed from binary cache, + (bool) ``True`` if the package was extracted from binary cache, else ``False`` """ tarball = binary_distribution.download_tarball(binary_spec) @@ -325,7 +325,7 @@ def _process_binary_cache_tarball(pkg, binary_spec, explicit, unsigned): return False pkg_id = package_id(pkg) - tty.msg('Installing {0} from binary cache'.format(pkg_id)) + tty.msg('Extracting {0} from binary cache'.format(pkg_id)) binary_distribution.extract_tarball(binary_spec, tarball, allow_root=False, unsigned=unsigned, force=False) pkg.installed_from_binary_cache = True @@ -335,10 +335,10 @@ def _process_binary_cache_tarball(pkg, binary_spec, explicit, unsigned): def _try_install_from_binary_cache(pkg, explicit, unsigned=False): """ - Try to install the package from binary cache. + Try to extract the package from binary cache. Args: - pkg (PackageBase): the package to be installed from binary cache + pkg (PackageBase): the package to be extracted from binary cache explicit (bool): the package was explicitly requested by the user unsigned (bool): ``True`` if binary package signatures to be checked, otherwise, ``False`` @@ -369,7 +369,7 @@ def _update_explicit_entry_in_db(pkg, rec, explicit): with spack.store.db.write_transaction(): rec = spack.store.db.get_record(pkg.spec) message = '{s.name}@{s.version} : marking the package explicit' - tty.msg(message.format(s=pkg.spec)) + tty.debug(message.format(s=pkg.spec)) rec.explicit = True @@ -452,7 +452,8 @@ def install_msg(name, pid): Return: (str) Colorized installing message """ - return '{0}: '.format(pid) + colorize('@*{Installing} @*g{%s}' % name) + pre = '{0}: '.format(pid) if tty.show_pid() else '' + return pre + colorize('@*{Installing} @*g{%s}' % name) def log(pkg): @@ -1064,7 +1065,8 @@ class PackageInstaller(object): pkg.run_tests = (tests is True or tests and pkg.name in tests) - pre = '{0}: {1}:'.format(self.pid, pkg.name) + pid = '{0}: '.format(self.pid) if tty.show_pid() else '' + pre = '{0}{1}:'.format(pid, pkg.name) def build_process(): """ @@ -1083,8 +1085,8 @@ class PackageInstaller(object): pkg.do_stage() pkg_id = package_id(pkg) - tty.msg('{0} Building {1} [{2}]' - .format(pre, pkg_id, pkg.build_system_class)) + tty.debug('{0} Building {1} [{2}]' + .format(pre, pkg_id, pkg.build_system_class)) # get verbosity from do_install() parameter or saved value echo = verbose @@ -1105,8 +1107,8 @@ class PackageInstaller(object): if install_source and os.path.isdir(source_path): src_target = os.path.join(pkg.spec.prefix, 'share', pkg.name, 'src') - tty.msg('{0} Copying source to {1}' - .format(pre, src_target)) + tty.debug('{0} Copying source to {1}' + .format(pre, src_target)) fs.install_tree(pkg.stage.source_path, src_target) # Do the real install in the source directory. @@ -1128,7 +1130,7 @@ class PackageInstaller(object): pass # cache debug settings - debug_enabled = tty.is_debug() + debug_level = tty.debug_level() # Spawn a daemon that reads from a pipe and redirects # everything to log_path @@ -1137,11 +1139,11 @@ class PackageInstaller(object): pkg.phases, pkg._InstallPhase_phases): with logger.force_echo(): - inner_debug = tty.is_debug() - tty.set_debug(debug_enabled) + inner_debug_level = tty.debug_level() + tty.set_debug(debug_level) tty.msg("{0} Executing phase: '{1}'" .format(pre, phase_name)) - tty.set_debug(inner_debug) + tty.set_debug(inner_debug_level) # Redirect stdout and stderr to daemon pipe phase = getattr(pkg, phase_attr) @@ -1157,11 +1159,11 @@ class PackageInstaller(object): pkg._total_time = time.time() - start_time build_time = pkg._total_time - pkg._fetch_time - tty.msg('{0} Successfully installed {1}' - .format(pre, pkg_id), - 'Fetch: {0}. Build: {1}. Total: {2}.' - .format(_hms(pkg._fetch_time), _hms(build_time), - _hms(pkg._total_time))) + tty.debug('{0} Successfully installed {1}' + .format(pre, pkg_id), + 'Fetch: {0}. Build: {1}. Total: {2}.' + .format(_hms(pkg._fetch_time), _hms(build_time), + _hms(pkg._total_time))) _print_installed_pkg(pkg.prefix) # preserve verbosity across runs @@ -1192,7 +1194,8 @@ class PackageInstaller(object): except spack.build_environment.StopPhase as e: # A StopPhase exception means that do_install was asked to # stop early from clients, and is not an error at this point - tty.debug('{0} {1}'.format(self.pid, str(e))) + pre = '{0}'.format(self.pid) if tty.show_pid() else '' + tty.debug('{0}{1}'.format(pid, str(e))) tty.debug('Package stage directory : {0}' .format(pkg.stage.source_path)) |