mfi-common: Break out set_hostos_runvars
PATCH 1/5 mfi-common: Break out set_hostos_runvars
We are going to want to reuse this.
No functional change. (NB shell `local' variables have dynamic rather than lexical scope.)
--- mfi-common | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
mfi-common +12 -4
@@ -76,6 +76,17 @@ job_create_build () { ./cs-job-create $flight $job $recipe $global_runvars "$@" } +set_hostos_runvars () { + # caller should have done + # local hostos_runvars + # suite=.... + # di_version=.... # perhaps + hostos_runvars="all_host_suite=$suite" + case "$di_version" in + ?*) hostos_runvars+=" all_host_di_version=$di_version" + esac +} + create_build_jobs () { local arch
@@ -414,10 +425,7 @@ test_matrix_iterate () { ;; esac - hostos_runvars="all_host_suite=$suite" - case "$di_version" in - ?*) hostos_runvars+=" all_host_di_version=$di_version" - esac + set_hostos_runvars for kern in ''; do
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/5 mfi-common: Do not set di_version runvar to empty string in build jobs
2601498df77c "mfi-common: Do not set di_version runvar to empty string" fixed the test jobs but not the build jobs, because the setting of hostos_runvars was (it seems) cloned-and-hacked, and it fixed only one instance.
Now that we have set_hostos_runvars, use it in create_build_jobs too.
--- mfi-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mfi-common +1 -1
@@ -134,7 +134,7 @@ create_build_jobs () { *) suite=$defsuite; di_version=$defdi_version;; esac - hostos_runvars="all_host_suite=$suite all_host_di_version=$di_version" + set_hostos_runvars # In 4.4 onwards xend is off by default. If necessary we build a # separate set of binaries with xend enabled in order to run those
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 3/5 cr-ensure-disk-space: Break out check_space
In reply to Ian JacksonBreak out the df check into its own subroutine. iteration_proceed now becomes iteration_continue and doesn't return a booleanish.
No functional change.
--- cr-ensure-disk-space | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
cr-ensure-disk-space +17 -16
@@ -49,7 +49,20 @@ csreadconfig(); logs_select $cfgbase or exit 0; -open LOCK, "> $c{GlobalLockDir}/publish-lock" or die $!; +sub check_space () { + open P, "-|", onloghost "df --block-size=1M -P $logdir" or die $!; + $_= <P>; + m/^filesystem/i or die "$_ ?"; + $_= <P>; + m,^\S+\s+\d+\s+\d+\s+(\d+)\s+, or die "$_ ?"; + $!=0; $?=0; close P or die "$! $?"; + my $space= $1; + printf "space: %8d, wanted: %8d ", $space, logcfg('MinSpaceMby'); + return $space >= logcfg('MinSpaceMby'); +} + +my $lock = "$c{GlobalLockDir}/publish-lock"; +open LOCK, "> $lock" or die "$lock $!"; flock LOCK, LOCK_EX or die $!; $|=1;
@@ -67,17 +80,7 @@ END our @flights; our %latestref; -sub iteration_continue () { - open P, "-|", onloghost "df --block-size=1M -P $logdir" or die $!; - $_= <P>; - m/^filesystem/i or die "$_ ?"; - $_= <P>; - m,^\S+\s+\d+\s+\d+\s+(\d+)\s+, or die "$_ ?"; - $!=0; $?=0; close P or die "$! $?"; - my $space= $1; - printf "space: %8d, wanted: %8d ", $space, logcfg('MinSpaceMby'); - return 0 if $space >= logcfg('MinSpaceMby'); - +sub iteration_proceed () { if (!@flights) { %latestref = (); open P, "-|", onloghost "ls -1 $logdir" or die $!;
@@ -141,15 +144,13 @@ sub iteration_continue () { END printf "done.\n"; - - return 1; } db_retry($dbh_tests,[], sub { @flights = (); for (;;) { - iteration_continue() - or last; + last if check_space(); + iteration_continue(); } });
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 4/5 cr-ensure-disk-space: Run check_space before taking lock
In reply to Ian JacksonThis allows cr-ensure-disk-space to be a noop if there is enough space, even if run on a host which doesn't have access to the relevant lock directory.
--- cr-ensure-disk-space | 2 ++ 1 file changed, 2 insertions(+)
cr-ensure-disk-space +2 -0
@@ -61,6 +61,8 @@ sub check_space () { return $space >= logcfg('MinSpaceMby'); } +exit 0 if check_space; + my $lock = "$c{GlobalLockDir}/publish-lock"; open LOCK, "> $lock" or die "$lock $!"; flock LOCK, LOCK_EX or die $!;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 5/5 mg-list-all-branches: Do not match ${BRANCHES+= ... }
In reply to Ian JacksonThis is not valid shell syntax and should not appear. The confusion seems to have arisen because of the need for to match BRANCHES+=... (without the surrounding { }).
This results in no change to the output. (I seem to have collected this patch some time ago as part of some fixes to mg-list-all-branches which have by now been applied, but not managed to write up and post this specific change.)
--- mg-list-all-branches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mg-list-all-branches +1 -1
@@ -14,7 +14,7 @@ foreach my $f (qw(cr-for-branches crontab)) { open C, $f or die $!; while (<C>) { next unless - m/\$\{$branchvar_re[:+]?=()($branchchr_re+)\b/ || + m/\$\{$branchvar_re:=()($branchchr_re+)\b/ || m/$branchvar_re[:+]?=('?)($branchchr_re+?)\1\s/; $branches{$_}=1 foreach split /\s+/, $2; }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel