diff mbox

[Xen-devel,OSSTEST,v2,13/20] Osstest/Debian: Install dtbs into target filesystem in /boot/dtbs

Message ID 1414579302-6692-13-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell Oct. 29, 2014, 10:41 a.m. UTC
This is done whenever dtbs.tar.gz exists. mg-debian-installer-update produces
the necessary inputs on the relevant platform (armhf).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Install dtbs iff dtbs.tar.gz exists.
---
 Osstest/Debian.pm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

Ian Jackson Oct. 29, 2014, 4:30 p.m. UTC | #1
Ian Campbell writes ("[PATCH OSSTEST v2 13/20] Osstest/Debian: Install dtbs into target filesystem in /boot/dtbs"):
> This is done whenever dtbs.tar.gz exists. mg-debian-installer-update produces
> the necessary inputs on the relevant platform (armhf).

This patch looks good except for one quibble:

> +    if ( -e "$d_i/dtbs.tar.gz" ) {

If stat fails with EIO or something, this will proceed as if the dtb
doesn't exist.  This is generally a problem with perl's -e things.  I
would use stat and check $! if stat gives false.

See eg the lstat in TestSupport.pm:file_link_contents.  (You probably
want stat rather than lstat.)

Thanks,
Ian.
diff mbox

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 3ffbc50..6bb14f7 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -514,6 +514,9 @@  sub preseed_create ($$;@) {
     my $disk= $xopts{DiskDevice} || '/dev/sda';
     my $suite= $xopts{Suite} || $c{DebianSuite};
 
+    my $d_i= $ho->{Tftp}{Path}.'/'.$ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.
+	$c{TftpDiVersion}.'-'.$ho->{Suite};
+
     my $hostsq= $dbh_tests->prepare(<<END);
         SELECT val FROM runvars
          WHERE flight=? AND name LIKE '%host'
@@ -627,12 +630,26 @@  $overlays
 echo latecmd done.
 END
 
+    if ( -e "$d_i/dtbs.tar.gz" ) {
+	my $durl = create_webfile($ho, "dtbs", sub {
+	    copy("$d_i/dtbs.tar.gz", $_[0])
+		or die "Copy dtbs failed: $!";
+	});
+	preseed_hook_command($ho, 'late_command', $sfx, <<END);
+#!/bin/sh
+set -ex
+
+r=/target
+
+wget -O \$r/tmp/dtbs.tar.gz $durl
+
+in-target tar -C /boot -xaf /tmp/dtbs.tar.gz
+END
+    }
+
     foreach my $kp (keys %{ $ho->{Flags} }) {
 	$kp =~ s/need-kernel-deb-// or next;
 
-	my $d_i= $ho->{Tftp}{Path}.'/'.$ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.
-	    $c{TftpDiVersion}.'-'.$ho->{Suite};
-
 	my $kurl = create_webfile($ho, "kernel", sub {
 	    copy("$d_i/$kp.deb", $_[0])
 		or die "Copy kernel failed: $!";