Defer computing this variable until it is going to be used.

The effect is that the fallback default value is assigned much later -
in start_email (cr-daily-branch) or send_bisection_email (cri-bisect).
Previously it was assigned as soon as cri-args-hostlists was read,
which is quite early.

In the next patch this will allow other hooks (eg the branch settings)
to adjust the default, rather than them having to override.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 cri-args-hostlists |    6 +++++-
 cri-bisect         |    2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/cri-args-hostlists b/cri-args-hostlists
index 57958d3..3e5ef44 100644
--- a/cri-args-hostlists
+++ b/cri-args-hostlists
@@ -53,7 +53,9 @@ elif [ "x$1" = "x--like-real" ]; then
 fi     
 : ${OSSTEST_BLESSING:=play}
 
-: ${OSSTEST_EMAIL_HEADER:=daily-cron-email-$OSSTEST_BLESSING}
+prepare_for_email () {
+       : ${OSSTEST_EMAIL_HEADER:=daily-cron-email-$OSSTEST_BLESSING}
+}
 
 . ${OSSTEST_CRON_SETTINGS:-$dcs-$OSSTEST_BLESSING}
 
@@ -93,6 +95,8 @@ start_email () {
         local subject_prefix=$4
         # redirects stdout
 
+       prepare_for_email
+
        exec >tmp/$flight.email
        branchemailheader=$OSSTEST_EMAIL_HEADER--$branch
        if test -e $branchemailheader; then
diff --git a/cri-bisect b/cri-bisect
index af3f23f..e7ed24b 100644
--- a/cri-bisect
+++ b/cri-bisect
@@ -84,6 +84,8 @@ perhaps_bisect_step_core () {
 send_bisection_email () {
         echo emailing "$2" "$1"
 
+       prepare_for_email
+
         exec 3>tmp/$flight.email
         cat >&3 $OSSTEST_EMAIL_HEADER$2
         cat >&3 <<END
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to