-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_packages_yaml.sh
More file actions
32 lines (25 loc) · 922 Bytes
/
Copy pathgenerate_packages_yaml.sh
File metadata and controls
32 lines (25 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# filename: generate_packages_yaml.sh
# description: Generates a packages.yaml file for Spack with external package paths
source /modeling/spack/share/spack/setup-env.sh
mypackages='sqlite proj gdal geos'
output_file="packages.yaml"
echo "Generating $output_file..."
# Start the YAML file
cat <<EOL > $output_file
packages:
EOL
for package in $mypackages; do
location=$(spack location -i $package 2>/dev/null)
if [ -n "$location" ]; then
echo " $package:" >> $output_file
echo " externals:" >> $output_file
echo " - spec: $package@$(spack find --format {version} $package)" >> $output_file
echo " prefix: $location" >> $output_file
echo " buildable: false" >> $output_file
echo "" >> $output_file
else
echo "# Package $package not found, skipping..." >&2
fi
done
echo "Done. The $output_file file has been created."