summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-03-23 23:16:37 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-06-24 16:38:36 -0700
commitc4c1d37fcdeb17680a85af25431314dae4fa3584 (patch)
tree8abe5909edf418ef0810a53771eb7871b6050d19 /share
parent6517dabbce06a7a62154e00ecea427116d9ef801 (diff)
downloadspack-c4c1d37fcdeb17680a85af25431314dae4fa3584.tar.gz
spack-c4c1d37fcdeb17680a85af25431314dae4fa3584.tar.bz2
spack-c4c1d37fcdeb17680a85af25431314dae4fa3584.tar.xz
spack-c4c1d37fcdeb17680a85af25431314dae4fa3584.zip
refactor: move templates from root to share/spack
- This complies with the unix directory hierarchy standard (which Spack attempts to follow) - Also unclutters the repo root directory.
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/modules/modulefile.dk31
-rw-r--r--share/spack/templates/modules/modulefile.lua91
-rw-r--r--share/spack/templates/modules/modulefile.tcl82
-rw-r--r--share/spack/templates/reports/cdash/Build.xml27
-rw-r--r--share/spack/templates/reports/cdash/Configure.xml8
-rw-r--r--share/spack/templates/reports/cdash/Site.xml7
-rw-r--r--share/spack/templates/reports/cdash/Update.xml11
-rw-r--r--share/spack/templates/reports/junit.xml51
8 files changed, 308 insertions, 0 deletions
diff --git a/share/spack/templates/modules/modulefile.dk b/share/spack/templates/modules/modulefile.dk
new file mode 100644
index 0000000000..c3f6d2dce1
--- /dev/null
+++ b/share/spack/templates/modules/modulefile.dk
@@ -0,0 +1,31 @@
+{% block header %}
+{% if category %}
+#c {{ category }}
+{% endif %}
+{% if short_description %}
+#d {{ short_description }}
+{% endif %}
+{% if long_description %}
+{{ long_description| textwrap(72)| prepend_to_line('#h ')| join() }}
+{% endif %}
+{% endblock %}
+
+{% block autoloads %}
+{% for module in autoload %}
+dk_op {{ module }}
+{% endfor %}
+{% endblock %}
+
+{% block environment %}
+{% for command_name, cmd in environment_modifications %}
+{% if command_name == 'PrependPath' %}
+dk_alter {{ cmd.name }} {{ cmd.value }}
+{% endif %}
+{% if command_name == 'RemovePath' %}
+dk_unalter {{ cmd.name }} {{ cmd.value }}
+{% endif %}
+{% if command_name == 'SetEnv' %}
+dk_setenv {{ cmd.name }} {{ cmd.value }}
+{% endif %}
+{% endfor %}
+{% endblock %}
diff --git a/share/spack/templates/modules/modulefile.lua b/share/spack/templates/modules/modulefile.lua
new file mode 100644
index 0000000000..cf37595228
--- /dev/null
+++ b/share/spack/templates/modules/modulefile.lua
@@ -0,0 +1,91 @@
+-- -*- lua -*-
+-- Module file created by spack (https://github.com/spack/spack) on {{ timestamp }}
+--
+-- {{ spec.short_spec }}
+--
+
+{% block header %}
+{% if short_description %}
+whatis([[Name : {{ spec.name }}]])
+whatis([[Version : {{ spec.version }}]])
+whatis([[Short description : {{ short_description }}]])
+{% endif %}
+{% if configure_options %}
+whatis([[Configure options : {{ configure_options }}]])
+{% endif %}
+
+{% if long_description %}
+help([[{{ long_description| textwrap(72)| join() }}]])
+{% endif %}
+{% endblock %}
+
+{% block provides %}
+{# Prepend the path I unlock as a provider of #}
+{# services and set the families of services I provide #}
+{% if has_modulepath_modifications %}
+-- Services provided by the package
+{% for name in provides %}
+family("{{ name }}")
+{% endfor %}
+
+-- Loading this module unlocks the path below unconditionally
+{% for path in unlocked_paths %}
+prepend_path("MODULEPATH", "{{ path }}")
+{% endfor %}
+
+{# Try to see if missing providers have already #}
+{# been loaded into the environment #}
+{% if has_conditional_modifications %}
+-- Try to load variables into path to see if providers are there
+{% for name in missing %}
+local {{ name }}_name = os.getenv("LMOD_{{ name|upper() }}_NAME")
+local {{ name }}_version = os.getenv("LMOD_{{ name|upper() }}_VERSION")
+{% endfor %}
+
+-- Change MODULEPATH based on the result of the tests above
+{% for condition, path in conditionally_unlocked_paths %}
+if {{ condition }} then
+ local t = pathJoin({{ path }})
+ prepend_path("MODULEPATH", t)
+end
+{% endfor %}
+
+-- Set variables to notify the provider of the new services
+{% for name in provides %}
+setenv("LMOD_{{ name|upper() }}_NAME", "{{ name_part }}")
+setenv("LMOD_{{ name|upper() }}_VERSION", "{{ version_part }}")
+{% endfor %}
+{% endif %}
+{% endif %}
+{% endblock %}
+
+{% block autoloads %}
+{% for module in autoload %}
+if not isloaded("{{ module }}") then
+{% if verbose %}
+ LmodMessage("Autoloading {{ module }}")
+{% endif %}
+ load("{{ module }}")
+end
+{% endfor %}
+{% endblock %}
+
+{% block environment %}
+{% for command_name, cmd in environment_modifications %}
+{% if command_name == 'PrependPath' %}
+prepend_path("{{ cmd.name }}", "{{ cmd.value }}")
+{% elif command_name == 'AppendPath' %}
+append_path("{{ cmd.name }}", "{{ cmd.value }}")
+{% elif command_name == 'RemovePath' %}
+remove_path("{{ cmd.name }}", "{{ cmd.value }}")
+{% elif command_name == 'SetEnv' %}
+setenv("{{ cmd.name }}", "{{ cmd.value }}")
+{% elif command_name == 'UnsetEnv' %}
+unsetenv("{{ cmd.name }}")
+{% endif %}
+{% endfor %}
+{% endblock %}
+
+{% block footer %}
+{# In case the module needs to be extended with custom LUA code #}
+{% endblock %}
diff --git a/share/spack/templates/modules/modulefile.tcl b/share/spack/templates/modules/modulefile.tcl
new file mode 100644
index 0000000000..833d8bf6c2
--- /dev/null
+++ b/share/spack/templates/modules/modulefile.tcl
@@ -0,0 +1,82 @@
+#%Module1.0
+## Module file created by spack (https://github.com/spack/spack) on {{ timestamp }}
+##
+## {{ spec.short_spec }}
+##
+{% if configure_options %}
+## Configure options: {{ configure_options }}
+##
+{% endif %}
+
+
+{% block header %}
+{% if short_description %}
+module-whatis "{{ short_description }}"
+{% endif %}
+
+{% if long_description %}
+proc ModulesHelp { } {
+{{ long_description| textwrap(72)| quote()| prepend_to_line('puts stderr ')| join() }}
+}
+{% endif %}
+{% endblock %}
+
+{% block autoloads %}
+{% for module in autoload %}
+if ![ is-loaded {{ module }} ] {{ '{' }}
+{% if verbose %}
+ puts stderr "Autoloading {{ module }}"
+{% endif %}
+ module load {{ module }}
+{{ '}' }}
+{% endfor %}
+{% endblock %}
+{# #}
+{% block prerequisite %}
+{% for module in prerequisites %}
+prereq {{ module }}
+{% endfor %}
+{% endblock %}
+{# #}
+{% block conflict %}
+{% for name in conflicts %}
+conflict {{ name }}
+{% endfor %}
+{% endblock %}
+
+{% block environment %}
+{% for command_name, cmd in environment_modifications %}
+{% if cmd.separator != ':' %}
+{# A non-standard separator is required #}
+{% if command_name == 'PrependPath' %}
+prepend-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'AppendPath' %}
+append-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'RemovePath' %}
+remove-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'SetEnv' %}
+setenv --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'UnsetEnv' %}
+unsetenv {{ cmd.name }}
+{% endif %}
+{% else %}
+{# We are using the usual separator #}
+{% if command_name == 'PrependPath' %}
+prepend-path {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'AppendPath' %}
+append-path {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'RemovePath' %}
+remove-path {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'SetEnv' %}
+setenv {{ cmd.name }} "{{ cmd.value }}"
+{% elif command_name == 'UnsetEnv' %}
+unsetenv {{ cmd.name }}
+{% endif %}
+{# #}
+{% endif %}
+{% endfor %}
+{% endblock %}
+
+{% block footer %}
+{# In case he module needs to be extended with custom TCL code #}
+{% endblock %}
diff --git a/share/spack/templates/reports/cdash/Build.xml b/share/spack/templates/reports/cdash/Build.xml
new file mode 100644
index 0000000000..1d184349b3
--- /dev/null
+++ b/share/spack/templates/reports/cdash/Build.xml
@@ -0,0 +1,27 @@
+ <Build>
+ <StartBuildTime>{{ build.starttime }}</StartBuildTime>
+ <BuildCommand>{{ install_command }}</BuildCommand>
+{% for warning in build.warnings %}
+ <Warning>
+ <BuildLogLine>{{ warning.line_no }}</BuildLogLine>
+ <Text>{{ warning.text }}</Text>
+ <SourceFile>{{ warning.source_file }}</SourceFile>
+ <SourceLineNumber>{{ warning.source_line_no }}</SourceLineNumber>
+ <PreContext>{{ warning.pre_context }}</PreContext>
+ <PostContext>{{ warning.post_context }}</PostContext>
+ </Warning>
+{% endfor %}
+{% for error in build.errors %}
+ <Error>
+ <BuildLogLine>{{ error.line_no }}</BuildLogLine>
+ <Text>{{ error.text }}</Text>
+ <SourceFile>{{ error.source_file }}</SourceFile>
+ <SourceLineNumber>{{ error.source_line_no }}</SourceLineNumber>
+ <PreContext>{{ error.pre_context }}</PreContext>
+ <PostContext>{{ error.post_context }}</PostContext>
+ </Error>
+{% endfor %}
+ <EndBuildTime>{{ build.endtime }}</EndBuildTime>
+ <ElapsedMinutes>0</ElapsedMinutes>
+ </Build>
+</Site>
diff --git a/share/spack/templates/reports/cdash/Configure.xml b/share/spack/templates/reports/cdash/Configure.xml
new file mode 100644
index 0000000000..0451279563
--- /dev/null
+++ b/share/spack/templates/reports/cdash/Configure.xml
@@ -0,0 +1,8 @@
+ <Configure>
+ <StartConfigureTime>{{ configure.starttime }}</StartConfigureTime>
+ <ConfigureCommand>{{ install_command }}</ConfigureCommand>
+ <Log>{{ configure.log }}</Log>
+ <ConfigureStatus>{{ configure.status }}</ConfigureStatus>
+ <EndConfigureTime>{{ configure.endtime }}</EndConfigureTime>
+ </Configure>
+</Site>
diff --git a/share/spack/templates/reports/cdash/Site.xml b/share/spack/templates/reports/cdash/Site.xml
new file mode 100644
index 0000000000..a47ffd34e6
--- /dev/null
+++ b/share/spack/templates/reports/cdash/Site.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Site BuildName="{{ install_command }}"
+ BuildStamp="{{ buildstamp }}"
+ Name="{{ hostname }}"
+ OSName="{{ osname }}"
+>
+
diff --git a/share/spack/templates/reports/cdash/Update.xml b/share/spack/templates/reports/cdash/Update.xml
new file mode 100644
index 0000000000..39f3d6a337
--- /dev/null
+++ b/share/spack/templates/reports/cdash/Update.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Update>
+ <Site>{{ hostname }}</Site>
+ <BuildName>{{ install_command }}</BuildName>
+ <BuildStamp>{{ buildstamp }}</BuildStamp>
+ <StartTime>{{ starttime }}</StartTime>
+ <EndTime>{{ endtime }}</EndTime>
+{% if msg %}
+ <UpdateReturnStatus>{{ msg }}</UpdateReturnStatus>
+{% endif %}
+</Update>
diff --git a/share/spack/templates/reports/junit.xml b/share/spack/templates/reports/junit.xml
new file mode 100644
index 0000000000..62e6db40c8
--- /dev/null
+++ b/share/spack/templates/reports/junit.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file has been modeled after the basic
+ specifications at this url:
+
+ http://help.catchsoftware.com/display/ET/JUnit+Format
+-->
+<testsuites>
+{% for spec in specs %}
+ <testsuite name="{{ spec.name }}"
+ errors="{{ spec.nerrors }}"
+ tests="{{ spec.npackages }}"
+ failures="{{ spec.nfailures }}"
+ time="{{ spec.time }}"
+ timestamp="{{ spec.timestamp }}" >
+ <properties>
+{% for property in spec.properties %}
+ <property name="{{ property.name }}" value="{{ property.value }}" />
+{% endfor %}
+ </properties>
+{% for package in spec.packages %}
+ <testcase classname="{{ package.name }}"
+ name="{{ package.id }}"
+ time="{{ package.elapsed_time }}">
+{% if package.result == 'failure' %}
+ <failure message="{{ package.message }}">
+{{ package.exception }}
+ </failure>
+{% elif package.result == 'error' %}
+ <error message="{{ package.message }}">
+{{ package.exception }}
+ </error>
+{% elif package.result == 'skipped' %}
+ <skipped />
+{% endif %}
+{% if package.stdout %}
+ <system-out>
+{{ package.stdout }}
+ </system-out>
+{% endif %}
+{% if package.stderr %}
+ <system-err>
+{{ package.stderr }}
+ </system-err>
+{% endif %}
+ </testcase>
+{% endfor %}
+{# Add an error tag? #}
+ </testsuite>
+{% endfor %}
+</testsuites>