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

[Xen-devel] [OSSTEST PATCH 10/35] backports handling: Refactor kernel deb handling



Introduce private function $kdeb->().  No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/Debian.pm | 45 +++++++++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 52527bf..5a083c2 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -1114,32 +1114,45 @@ END
        $kp = "need-kernel-deb-wheezy-backports" if $kp eq 
"need-kernel-deb-armmp";
        $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next;
 
-       my $kern = "$d_i/$kp.deb";
-       my $kurl = create_webfile($ho, "kernel", sub {
-           copy($kern, $_[0])
-               or die "Copy kernel $kern failed: $!";
-        });
-
-       my $ird = "$d_i/initramfs-tools.deb";
-       my $iurl = create_webfile($ho, "initramfs-tools", sub {
-           copy($ird, $_[0])
-               or die "Copy initramfs-tools $ird failed: $!";
-        });
-
-       preseed_hook_command($ho, 'late_command', $sfx, <<END);
+        my $cmds = <<END;
 #!/bin/sh
 set -ex
 
 r=/target
 
-$preseed_wget -O \$r/tmp/kern.deb $kurl
-$preseed_wget -O \$r/tmp/initramfs-tools.deb $iurl
+END
+
+        my @kdebs;
+        my $kdeb = sub {
+            my ($what, $file) = @_;
+
+            logm("for late_command using $what $file");
+            my $furl = create_webfile($ho, $what, sub {
+               copy($file, $_[0]) or die "Copy $what $file failed: $!";
+            });
+            my $tmpfn = "/tmp/$what.deb";
+
+            $cmds .= <<END;
+$preseed_wget -O \$r$tmpfn $furl
+END
+            push @kdebs, $tmpfn;
+        };
+
+        my $kern = "$d_i/$kp.deb";
+        $kdeb->("kernel", $kern);
+
+        my $ird = "$d_i/initramfs-tools.deb";
+        $kdeb->("initramfs-tools", $ird);
+
+        $cmds .= <<END;
 
 # This will fail due to dependencies...
-in-target dpkg -i /tmp/kern.deb /tmp/initramfs-tools.deb || true
+in-target dpkg -i @kdebs || true
 # ... Now fix everything up...
 in-target apt-get install -f -y
 END
+
+       preseed_hook_command($ho, 'late_command', $sfx, $cmds);
     }
 
     if ( $ho->{Flags}{'need-uboot-bootscr'} ) {
-- 
2.1.4


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

 


Rackspace

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