spack.analyzers package


spack.analyzers.analyzer_base module

An analyzer base provides basic functions to run the analysis, save results, and (optionally) interact with a Spack Monitor

class spack.analyzers.analyzer_base.AnalyzerBase(spec, dirname=None)[source]

Bases: object

property output_dir

The full path to the output directory.

This includes the nested analyzer directory structure. This function does not create anything.


Given a spec with an installed package, run the analyzer on it.

save_result(result, overwrite=False)[source]

Save a result to the associated spack monitor, if defined.

This function is on the level of the analyzer because it might be the case that the result is large (appropriate for a single request) or that the data is organized differently (e.g., more than one request per result). If an analyzer subclass needs to over-write this function with a custom save, that is appropriate to do (see abi).

spack.analyzers.analyzer_base.get_analyzer_dir(spec, analyzer_dir=None)[source]

Given a spec, return the directory to save analyzer results.

We create the directory if it does not exist. We also check that the spec has an associated package. An analyzer cannot be run if the spec isn’t associated with a package. If the user provides a custom analyzer_dir, we use it over checking the config and the default at ~/.spack/analyzers

spack.analyzers.config_args module

A configargs analyzer is a class of analyzer that typically just uploads already existing metadata about config args from a package spec install directory.

class spack.analyzers.config_args.ConfigArgs(spec, dirname=None)[source]

Bases: AnalyzerBase

description = 'config args loaded from spack-configure-args.txt'
name = 'config_args'
outfile = 'spack-analyzer-config-args.json'

Load the configure-args.txt and save in json.

The run function will find the spack-config-args.txt file in the package install directory, and read it into a json structure that has the name of the analyzer as the key.

spack.analyzers.environment_variables module

An environment analyzer will read and parse the environment variables file in the installed package directory, generating a json file that has an index of key, value pairs for environment variables.

class spack.analyzers.environment_variables.EnvironmentVariables(spec, dirname=None)[source]

Bases: AnalyzerBase

description = 'environment variables parsed from spack-build-env.txt'
name = 'environment_variables'
outfile = 'spack-analyzer-environment-variables.json'

Load, parse, and save spack-build-env.txt to analyzers.

Read in the spack-build-env.txt file from the package install directory and parse the environment variables into key value pairs. The result should have the key for the analyzer, the name.

spack.analyzers.install_files module

The install files json file (install_manifest.json) already exists in the package install folder, so this analyzer simply moves it to the user analyzer folder for further processing.

class spack.analyzers.install_files.InstallFiles(spec, dirname=None)[source]

Bases: AnalyzerBase

description = 'install file listing read from install_manifest.json'
name = 'install_files'
outfile = 'spack-analyzer-install-files.json'

Load in the install_manifest.json and save to analyzers.

We write it out to the analyzers folder, with key as the analyzer name.

spack.analyzers.libabigail module

class spack.analyzers.libabigail.Libabigail(spec, dirname=None)[source]

Bases: AnalyzerBase

description = 'Application Binary Interface (ABI) features for objects'
name = 'libabigail'
outfile = 'spack-analyzer-libabigail.json'

Run libabigail, and save results to filename.

This run function differs in that we write as we generate and then return a dict with the analyzer name as the key, and the value of a dict of results, where the key is the object name, and the value is the output file written to.

save_result(result, overwrite=False)[source]

Read saved ABI results and upload to monitor server.

ABI results are saved to individual files, so each one needs to be read and uploaded. Result here should be the lookup generated in run(), the key is the analyzer name, and each value is the result file. We currently upload the entire xml as text because libabigail can’t easily read gzipped xml, but this will be updated when it can.

Module contents

This package contains code for creating analyzers to extract Application Binary Interface (ABI) information, along with simple analyses that just load existing metadata.


Courtesy function to retrieve an analyzer, and exit on error if it does not exist.


A helper function to list all analyzers and their descriptions