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

[Xen-devel] [OSSTEST PATCH 07/11] di_special_kernel: Provide $tp; Regularise $kernel, $cpio



Make both of these paths relative to $ho->{Tftp}{Path}.  Previously
$kernel was relative to that, but $cpio contained it.

Adjust all callers, so no functional change.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/Debian.pm | 28 ++++++++++++++++------------
 ts-host-install   |  8 ++++----
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 889cb0e..baaab90 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -1056,32 +1056,36 @@ sub di_installer_path ($) {
 
 sub di_special_kernel ($$) {
     my ($ho, $fn) = @_;
-    # calls $fn->($kp, $kernel, $cpio) # $kernel and/or $cpio may be undef
+    # calls $fn->($kp, $tp, $kernel, $cpio)
+    #  $kp is "special" or "backports" or similar
+    #  $tp is $ho->{Tftp}{Path}, for convenience
+    #  $kernel and/or $cpio may be undef, and do not contain $tp
     my $d_i = di_installer_path($ho);
+    my $tp = $ho->{Tftp}{Path};
     foreach my $kp (keys %{ $ho->{Flags} }) {
         my $kernel;
         # Backwards compatibility
         $kp = "need-kernel-deb-wheezy-backports" if $kp eq 
"need-kernel-deb-armmp";
         $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next;
-        my $kern= "$ho->{Tftp}{Path}/$d_i/linux.$kp";
-        if (stat $kern) {
-            logm("using kernel from: $kern");
-            $kernel = "/$d_i/linux.$kp";
+        my $kernel= "$d_i/linux.$kp";
+        if (stat "$tp/$kernel") {
+            logm("using kernel from: $tp/$kernel");
         } elsif ($! == &ENOENT) {
-            logm("warning: no kernel found for $kp at $kern");
+            logm("warning: no kernel found for $kp at $tp/$kernel");
+            $kernel = undef;
         } else {
-            die "$kp $kern $!";
+            die "$kp $kernel $!";
         }
-        my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz";
-        if (stat $cpio) {
-            logm("using kernel modules from: $cpio");
+        my $cpio= "$d_i/$kp.cpio.gz";
+        if (stat "$tp/$cpio") {
+            logm("using kernel modules from: $tp/$cpio");
         } elsif ($! == &ENOENT) {
-            logm("warning: no kernel module cpio found for $kp at $cpio");
+            logm("warning: no kernel module cpio found for $kp at $tp/$cpio");
             $cpio = undef;
         } else {
             die "$kp $cpio $!";
         }
-        $fn->($kp, $kernel, $cpio);
+        $fn->($kp, $tp, $kernel, $cpio);
     }
 }
 
diff --git a/ts-host-install b/ts-host-install
index d83d81b..c5b92b8 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -182,9 +182,9 @@ sub setup_netboot_firstboot($) {
     }
 
     di_special_kernel($ho, sub {
-        my ($kp, $k, $cpio) = @_;
+        my ($kp, $tp, $k, $cpio) = @_;
         $kernel = $k if defined $k;
-        push @initrds, $cpio if defined $cpio;
+        push @initrds, "$tp/$cpio" if defined $cpio;
     });
 
     $kernel = "/$d_i/linux" unless $kernel;
@@ -215,9 +215,9 @@ END
     my %xopts;
 
     di_special_kernel($ho, sub {
-        my ($kp,$k,$c) = @_;
+        my ($kp,$tp,$k,$c) = @_;
        $xopts{dtbs} = "/$d_i/$kp-dtbs"
-           if -e "$ho->{Tftp}{Path}/$d_i/$kp-dtbs";
+           if -e "$tp/$d_i/$kp-dtbs";
     });
 
     $xopts{dtbs} = "/$d_i/dtbs"
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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