[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] ts-raisin-build: consolidate open coded iterations over enabled components



This removes the possibility of the various bits (ENABLED_COMPONENTS,
TREE/REVISION_* and store_revision) getting out of sync. Use a hash
table to store overrides where the Raising and runvar names for a
component differ.

Also switch to using a shell heredoc to populate config, this was
necessary as part of how the TREE/REVISION setup was rewritten and we
may as well pull the other settings into that too (reduces the amount
of quoting too).

Also add a comment to config to indicate where the osstest overrides
start.

The config file produced here is identical to before except for the
added command and an extra trailing newline.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
It would probably be best to fold this into the base patch rather than
doing it seperately, maybe after Ian has had a chance to comment on
the incremental patch?

The use of $treerev_override{$_}//$_ could be simplified by doing
something like:
    $treerev_override{$_} //= $_ foreach @components;
at some point after the hash is declared but before it is used. I'm
not sure if that would be preferable or not.
---
 ts-raisin-build | 75 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 38 insertions(+), 37 deletions(-)

diff --git a/ts-raisin-build b/ts-raisin-build
index 137ee37..2f3d4eb 100755
--- a/ts-raisin-build
+++ b/ts-raisin-build
@@ -30,45 +30,46 @@ builddirsprops();
 
 my $raisindir="$builddir/raisin";
 
+# Components to enable, using the Raisin naming scheme
+my @components = qw(seabios ovmf xen qemu qemu_traditional libvirt);
+# Where they differ, map raisin component names to the osstest runvar names
+my %treerev_override = (
+    qemu => 'qemuu',
+    qemu_traditional => 'qemu'
+    );
+
 sub checkout () {
     prepbuilddirs();
     build_clone($ho, 'raisin', $builddir, 'raisin');
 
-    target_cmd_build($ho, 100, $builddir, <<END.
+    my $enabled = join(" ", @components);
+    my $treerevs;
+    foreach (@components) {
+       my $treerev = $treerev_override{$_}//$_;
+       logm("Mapping component $_ to runvar $treerev");
+       # We require both a tree and revision
+       next unless nonempty($r{"tree_$treerev"});
+       next unless nonempty($r{"revision_$treerev"});
+
+       my $url = $r{"tree_$treerev"};
+       my $rev = $r{"revision_$treerev"};
+       $treerevs .= uc($_)."_URL=\"$url\"\n";
+       $treerevs .= uc($_)."_REVISION=\"$rev\"\n";
+    }
+
+    target_cmd_build($ho, 100, $builddir, <<END);
         cd $raisindir
         cp defconfig config
-    >>config
+    cat >>config <<EOF
 
-    echo >>config MAKE=\\"make $makeflags\\"
-    echo >>config PREFIX=\\"/usr\\"
-    echo >>config DESTDIR=dist
-    echo >>config ENABLED_COMPONENTS=\\"seabios ovmf xen qemu qemu_traditional 
libvirt\\"
-END
-               (nonempty($r{tree_xen}) && nonempty($r{revision_xen}) ? <<END : 
'').
-    echo >>config XEN_URL=\\"$r{tree_xen}\\"
-    echo >>config XEN_REVISION=\\"$r{revision_xen}\\"
+# osstest overrides
+MAKE=\"make $makeflags\"
+PREFIX=\"/usr\"
+DESTDIR=dist
+ENABLED_COMPONENTS=\"$enabled\"
+$treerevs
+EOF
 END
-               (nonempty($r{tree_qemuu}) && nonempty($r{revision_qemuu}) ? 
<<END : '').
-    echo >>config QEMU_URL=\\"$r{tree_qemuu}\\"
-    echo >>config QEMU_REVISION=\\"$r{revision_qemuu}\\"
-END
-               (nonempty($r{tree_qemu}) && nonempty($r{revision_qemu}) ? <<END 
: '').
-    echo >>config QEMU_TRADITIONAL_URL=\\"$r{tree_qemu}\\"
-    echo >>config QEMU_TRADITIONAL_REVISION=\\"$r{revision_qemu}\\"
-END
-               (nonempty($r{tree_seabios}) && nonempty($r{revision_seabios}) ? 
<<END : '').
-    echo >>config SEABIOS_URL=\\"$r{tree_seabios}\\"
-    echo >>config SEABIOS_REVISION=\\"$r{revision_seabios}\\"
-END
-               (nonempty($r{tree_libvirt}) && nonempty($r{revision_libvirt}) ? 
<<END : '').
-    echo >>config LIBVIRT_URL=\\"$r{tree_libvirt}\\"
-    echo >>config LIBVIRT_REVISION=\\"$r{revision_libvirt}\\"
-END
-               (nonempty($r{tree_ovmf}) && nonempty($r{revision_ovmf}) ? <<END 
: '')
-    echo >>config OVMF_URL=\\"$r{tree_ovmf}\\"
-    echo >>config OVMF_REVISION=\\"$r{revision_ovmf}\\"
-END
-               );
 }
 
 sub build () {
@@ -96,12 +97,12 @@ END
 }
 
 sub collectversions () {
-    store_revision($ho, 'xen', "$raisindir/xen-dir", 1);
-    store_revision($ho, 'qemu', "$raisindir/qemu-traditional-dir", 1);
-    store_revision($ho, 'qemuu', "$raisindir/qemu-dir", 1);
-    store_revision($ho, 'seabios', "$raisindir/seabios-dir", 1);
-    store_revision($ho, 'ovmf', "$raisindir/ovmf-dir", 1);
-    store_revision($ho, 'libvirt', "$raisindir/libvirt-dir", 1);
+    foreach ( @components ) {
+       my $tree = $treerev_override{$_}//$_;
+       # raisin uses - in dir names, not _ as in component names
+       tr/_/-/;
+       store_revision($ho, $tree, "$raisindir/$_-dir", 1);
+    }
 }
 
 sub stash () {
-- 
2.1.4


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.