refactor: factor frequently-used run environment variables into getters

A number of variables are defined based on the value of run environment
variables (variables that the test configuration configures and sets in
the `artefacts/run/env` file). There are no helpers to help us keep
track of these and their default values across disjoint scripts, so
let's introduce some!

This introduces getters for the `num_uarts`, `primary_uart`,
`payload_uart` and `ports_script` run environment variables. These were
chosen because we need them in the next patch.

Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: I9ddf6f2fc769e023910652b3a3507f1896f97226
diff --git a/script/default-ports-script.awk b/script/default-ports-script.awk
new file mode 100644
index 0000000..77fe17b
--- /dev/null
+++ b/script/default-ports-script.awk
@@ -0,0 +1,11 @@
+/terminal_0/ { ports[0] = $NF }
+/terminal_1/ { ports[1] = $NF }
+/terminal_2/ { ports[2] = $NF }
+/terminal_3/ { ports[3] = $NF }
+
+END {
+	for (i = 0; i < num_uarts; i++) {
+		if (ports[i] != "")
+			print "ports[" i "]=" ports[i]
+	}
+}