fix: swap LAVA YAML template generation for broken jobs

This change introduces two new hooks:

- `generate_lava_job_template` is expected to generate the initial LAVA
  job YAML file (`job.yaml`), which may include fields which are not
  yet known
- `generate_lava_job` is used to fill in anything in the LAVA job that
  was not known when the job YAML file was generated

Previously, these were incorporated into other hooks almost
arbitrarily, and in some jobs this meant that they were invoked in the
wrong order. These new hooks allow us to be explicit about the order
that these operations occur.

Change-Id: I07f96b91a7ddb04b599ccca674797d4714296c21
Signed-off-by: Chris Kay <chris.kay@arm.com>
diff --git a/run_config/fvp-spm.linux b/run_config/fvp-spm.linux
index 6910d4f..b79e48a 100644
--- a/run_config/fvp-spm.linux
+++ b/run_config/fvp-spm.linux
@@ -20,24 +20,25 @@
 fetch_tf_resource() {
 	url="$tfa_downloads/spm/07-29-2021/initrd.img" saveas="initrd.bin" fetch_file
 	archive_file "initrd.bin"
+}
 
-	# Expect scripts
-	uart="0" file="spm-linux-uart0.exp" track_expect
-	uart="2" file="spm-uart2.exp" track_expect
-
+generate_lava_job_template() {
 	payload_type="linux" gen_fvp_yaml_template
 }
 
-post_fetch_tf_resource() {
-        local model="base-aemv8a"
+generate_lava_job() {
+	local model="base-aemv8a"
+
+	uart="0" file="spm-linux-uart0.exp" track_expect
+	uart="2" file="spm-uart2.exp" track_expect
 
 	model="$model" \
-	arch_version="8.5" \
-	has_branch_target_exception="1" \
-	kernel_addr=0x88000000 \
-	kernel_bin="$archive/hafnium.bin" \
-	has_smmuv3_params="1" \
-	memory_tagging_support_level="2" \
+		arch_version="8.5" \
+		has_branch_target_exception="1" \
+		has_smmuv3_params="1" \
+		kernel_addr="0x88000000" \
+		kernel_bin="$archive/hafnium.bin" \
+		memory_tagging_support_level="2" \
 		gen_model_params
 
 	model="$model" model_dtb="manifest.dtb" gen_fvp_yaml