From a6684929f1a6c91288bff2c8f5e78d50c1842a03 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 27 Oct 2021 11:49:04 +0100 Subject: [PATCH] ts-xen-build: Refactor enable/disable configure options Replace the repeated pattern with a function to generate that code. No significant functional change. Signed-off-by: Ian Jackson Reviewed-by: Juergen Gross --- ts-xen-build | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/ts-xen-build b/ts-xen-build index ccb2aba..d6f6bfa 100755 --- a/ts-xen-build +++ b/ts-xen-build @@ -142,9 +142,21 @@ END } sub build () { - my $xend_opt= $r{enable_xend} =~ m/true/ ? "--enable-xend" : "--disable-xend"; - my $ovmf_opt= $r{enable_ovmf} =~ m/true/ ? "--enable-ovmf" : "--disable-ovmf"; - my $qemutrad_opt = $r{arch} =~ m/amd64|i386/ ? "--enable-qemu-traditional" : "--disable-qemu-traditional"; + my $enable_opts = ''; # shell script to set "enable_opts" shell var + my $enable_disable = sub { + my ($subdir, $feat, $enable) = @_; + my $opt = "--".($enable ? 'enable' : 'disable')."-$feat"; + $enable_opts .= <("tools/", "xend", $r{enable_xend} =~ m/true/); + $enable_disable->("tools/", "ovmf", $r{enable_ovmf} =~ m/true/); + $enable_disable->("tools/", "qemu-traditional", $r{arch} =~ m/amd64|i386/); my $configure_prefix = $r{cmdprefix_configure} // ''; my $configure_suffix = $r{cmdsuffix_configure} // ''; @@ -152,17 +164,9 @@ sub build () { buildcmd_stamped_logged(600, 'xen', 'configure', <