Skip to content

Commit

Permalink
reduce extractions down to only what we need
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Apr 17, 2021
1 parent 75da930 commit 8cd1df5
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 230 deletions.
26 changes: 17 additions & 9 deletions lib/spack/spack/analyzers/clingo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class Clingo(AnalyzerBase):

name = "clingo"
outfile = "abi-facts.json"
outfile = "abi-facts.lp"
description = "Dwarf and ELF Symbols in a logic program for a library."

def run(self):
Expand All @@ -37,27 +37,35 @@ def run(self):

# The manifest includes the spec binar(y|(ies)
# We extract facts for all binaries, even if they get used separately
# We also keep track of these "main" binaries that are being assessed
manifest = spack.binary_distribution.get_buildfile_manifest(spec)
libs = manifest['binary_to_relocate_fullpath']
main = manifest['binary_to_relocate_fullpath']

# We need the compiler too
compiler = which(spec.compiler.name).path
compilers = {compiler}

# Find all needed libraries
libs = []
for dep in spec.dependencies():
manifest = spack.binary_distribution.get_buildfile_manifest(dep)
libs += manifest['binary_to_relocate_fullpath']
compiler = which(dep.compiler.name).path
compilers.add(compiler)

libs += list(compilers)
facts = generate_facts(libs)
outfile = os.path.join(self.output_dir, "abi-facts.lp")

# Only try to create the results directory if we have a result
# Generate facts, writing to file as we go
outfile = os.path.join(self.output_dir, self.outfile)
if not os.path.exists(self.output_dir):
os.makedirs(self.output_dir)
libs += list(compilers)
generate_facts(main, libs, outfile)
return {self.name: outfile}

spack.monitor.write_file(facts, outfile)
return {self.name: facts}
def save_result(self, result, overwrite=False):
"""
Read saved fact results and upload to monitor server.
We haven't written this yet because we don't know what we would want
to upload.
"""
pass

0 comments on commit 8cd1df5

Please sign in to comment.