| 1 | package Tapper::Installer::Precondition::Kernelbuild; | ||||||||||||||||||||||||||||
| 2 | 6 | our $AUTHORITY = 'cpan:TAPPER'; | |||||||||||||||||||||||||||
| 3 | 6 | $Tapper::Installer::Precondition::Kernelbuild::VERSION = '5.0.3'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use IO::Handle; # needed to set pipe nonblocking | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 6 | extends 'Tapper::Installer::Precondition'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub fix_git_url | ||||||||||||||||||||||||||||
| 15 | 6 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
fix_git_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 6 | my ($self, $git_url) = @_; | |||||||||||||||||||||||||||
| 17 | 6 | $self->log->info("Git URL before rewrite: $git_url"); | |||||||||||||||||||||||||||
| 18 | 6 | $git_url =~ s|^git://osrc((\.osrc)?\.amd\.com)?/|git://wotan.amd.com/|; | |||||||||||||||||||||||||||
| 19 | 6 | $self->log->info("Git URL after rewrite: $git_url"); | |||||||||||||||||||||||||||
| 20 | 6 | return $git_url; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub git_get | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
git_get: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 0 | my ($self, $git_url, $git_rev)=@_; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | # git may generate more output than log_and_exec can handle, thus keep the system() | ||||||||||||||||||||||||||||
| 29 | 0 | chdir $self->cfg->{paths}{base_dir}; | |||||||||||||||||||||||||||
| 30 | 0 | $git_url = $self->fix_git_url($git_url); | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | system("git","clone","-q",$git_url,"linux") == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | or return("unable to clone git repository $git_url"); | ||||||||||||||||||||||||||||
| 33 | 0 | chdir ("linux"); | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | system("git","checkout",$git_rev) == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | or return("unable to check out $git_rev from git repository $git_url"); | ||||||||||||||||||||||||||||
| 36 | 0 | return(0); | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub get_config | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_config: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 0 | my ($self, $config_file) = @_; | |||||||||||||||||||||||||||
| 43 | 0 | ▶ | $config_file ||= $self->cfg->{paths}{config_path}."/kernelconfigs/config_x86_64"; | ||||||||||||||||||||||||||
|
Condition0%0/2
$config_file ||= $self->cfg->{"paths"}{"config_path"} . '/kernelconfigs/config_x86_64'
MC/DC0%0/1
$config_file ||= $self->cfg->{"paths"}{"config_path"} . '/kernelconfigs/config_x86_64'
$config_file
Truth table0%0/2
A
A= $config_file
| |||||||||||||||||||||||||||||
| 44 | 0 | $self->log->debug("Getting config $config_file"); | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | return "Can not get config $config_file because the file does not exist" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | if not -e $config_file; | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | system("cp $config_file .config") == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | or return "Can not get config $config_file"; | ||||||||||||||||||||||||||||
| 51 | 0 | return 0; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | sub make_kernel | ||||||||||||||||||||||||||||
| 56 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
make_kernel: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 58 | 0 | ▶ | system("make","clean") == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | or return("Making mrproper failed: $!"); | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | system('yes ""|make oldconfig') == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | or return("Making oldconfig failed: $!"); | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | system('make','-j8') == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | or return("Build the kernel failed: $!"); | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | system('make','install') == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | or return("Installing the kernel failed: $!"); | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | system('make','modules_install') == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | or return("Installing the kernel failed: $!"); | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | return 0; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | ▶ | sub younger { stat($a)->mtime() <=> stat($b)->mtime() } | ||||||||||||||||||||||||||
|
Subroutine
younger: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | sub make_initrd | ||||||||||||||||||||||||||||
| 81 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
make_initrd: not called CC=11 SCAR=47.5
Pod
documented
| |||||||||||||||||||||||||||||
| 82 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 83 | 0 | my ($error, $kernelversion) = $self->log_and_exec("make","kernelversion"); | |||||||||||||||||||||||||||
| 84 | 0 | my $kernel_file = "vmlinuz-$kernelversion"; | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | # double block, the outermost belongs to if, the innermost can be left with last; | ||||||||||||||||||||||||||||
| 87 | # great stuff, isn't it? | ||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if (not -e "/boot/$kernel_file") {{ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if (-e "/boot/vmlinuz-${kernelversion}+"){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 0 | $kernelversion .='+'; | |||||||||||||||||||||||||||
| 91 | 0 | $kernel_file = "vmlinuz-$kernelversion"; | |||||||||||||||||||||||||||
| 92 | 0 | last; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if (-e "/boot/bzImage") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 0 | $kernel_file = "bzImage"; | |||||||||||||||||||||||||||
| 96 | 0 | last; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if (-e "/boot/bzImage-$kernelversion") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | 0 | $kernel_file = "bzImage-$kernelversion"; | |||||||||||||||||||||||||||
| 100 | 0 | last; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if (-e "/boot/bzImage-$kernelversion+") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 0 | $kernel_file = "bzImage-$kernelversion"; | |||||||||||||||||||||||||||
| 104 | 0 | last; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | my @files = sort younger </boot/vmlinuz-*>; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if (@files) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 0 | $kernel_file = $files[0]; | |||||||||||||||||||||||||||
| 110 | 0 | $kernelversion = $1; | |||||||||||||||||||||||||||
| 111 | 0 | last; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | 0 | my $filename; | |||||||||||||||||||||||||||
| 114 | 0 | $filename = "/tmp/bootdir-content"; | |||||||||||||||||||||||||||
| 115 | 0 | system("ls -l /boot/ > $filename"); | |||||||||||||||||||||||||||
| 116 | 0 | return "kernel install failed, can not find new kernel"; | |||||||||||||||||||||||||||
| 117 | }} | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | system("depmod $kernelversion") == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | or return("Can not create initrd file, see log file"); | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | my $modules = "ixgbe forcedeth r8169 libata sata-sil scsi-mod atiixp ide-disk"; | |||||||||||||||||||||||||||
| 123 | 0 | $modules .= " ide-core 3c59x tg3 mii amd8111e e1000e bnx2 bnx2x ixgb"; | |||||||||||||||||||||||||||
| 124 | 0 | my $mkinitrd_command = "mkinitrd -k /boot/$kernel_file -i /boot/initrd-$kernelversion "; | |||||||||||||||||||||||||||
| 125 | 0 | $mkinitrd_command .= qq(-m "$modules"); | |||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | $self->log->debug($mkinitrd_command); | |||||||||||||||||||||||||||
| 128 | 0 | ▶ | system($mkinitrd_command) == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | or return("Can not create initrd file, see log file"); | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | # prepare_boot called at the end of the install process will generate | ||||||||||||||||||||||||||||
| 132 | # a grub entry for vmlinuz/initrd with no version string attached | ||||||||||||||||||||||||||||
| 133 | 0 | $error = $self->log_and_exec("ln -sf","/boot/$kernel_file", "/boot/vmlinuz"); | |||||||||||||||||||||||||||
| 134 | 0 | ▶ | return $error if $error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | 0 | $error = $self->log_and_exec("ln -sf","/boot/initrd-$kernelversion", "/boot/initrd"); | |||||||||||||||||||||||||||
| 136 | 0 | ▶ | return $error if $error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | return 0; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | sub install | ||||||||||||||||||||||||||||
| 145 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
install: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||
| 146 | 0 | my ($self, $build) = @_; | |||||||||||||||||||||||||||
| 147 | 0 | ▶ | my $git_url = $build->{git_url} or return 'No git url given'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $git_rev = $build->{git_changeset} || 'HEAD'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$build->{'git_changeset'} || 'HEAD'
MC/DC0%0/1
$build->{'git_changeset'} || 'HEAD'
$build->{'git_changeset'}
Truth table0%0/2
A
A= $build->{'git_changeset'}
| |||||||||||||||||||||||||||||
| 149 | 0 | my $config_file = $build->{configfile_path}; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | $self->log->debug("Installing kernel from $git_url $git_rev"); | |||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | my $git_path = qx(which git); | |||||||||||||||||||||||||||
| 154 | 0 | chomp $git_path; | |||||||||||||||||||||||||||
| 155 | 0 | ▶ | return "Can not find git. Git_path is '$git_path'" if not -e $git_path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 0 | pipe (my $read, my $write); | |||||||||||||||||||||||||||
| 158 | 0 | ▶ | return ("Can't open pipe:$!") if not (defined $read and defined $write); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $read and defined $write
MC/DC0%0/2
defined $read and defined $write
defined $read
defined $write
Truth table0%0/3
A and B
A= defined $readB= defined $write
| |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | # we need to fork for chroot | ||||||||||||||||||||||||||||
| 162 | 0 | my $pid = fork(); | |||||||||||||||||||||||||||
| 163 | 0 | ▶ | return "fork failed: $!" if not defined $pid; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | # hello child | ||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if ($pid == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | close $read; | |||||||||||||||||||||||||||
| 168 | 0 | my ($error, $output); | |||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | # TODO: handle error | ||||||||||||||||||||||||||||
| 171 | 0 | ($error, $output) = $self->log_and_exec("mount -o bind /dev/ ".$self->cfg->{paths}{base_dir}."/dev"); | |||||||||||||||||||||||||||
| 172 | 0 | ($error, $output) = $self->log_and_exec("mount -t sysfs sys ".$self->cfg->{paths}{base_dir}."/sys"); | |||||||||||||||||||||||||||
| 173 | 0 | ($error, $output) = $self->log_and_exec("mount -t proc proc ".$self->cfg->{paths}{base_dir}."/proc"); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | my $filename = $git_url.$git_rev; | |||||||||||||||||||||||||||
| 176 | 0 | $filename =~ s/[^A-Za-z_-]+/_/g; | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | my $testrun_id = $self->cfg->{test_run}; | |||||||||||||||||||||||||||
| 179 | 0 | my $output_dir = $self->cfg->{paths}{output_dir}."/$testrun_id/install/"; | |||||||||||||||||||||||||||
| 180 | 0 | $self->makedir($output_dir); | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | my $output_file = $output_dir."/$filename"; | |||||||||||||||||||||||||||
| 184 | # dup output to file before git_get and chroot but inside child | ||||||||||||||||||||||||||||
| 185 | # so we don't need to care how to get rid of it at the end | ||||||||||||||||||||||||||||
| 186 | 0 | ▶ | open (STDOUT, ">>", "$output_file.stdout") or print($write "Can't open output file $output_file.stdout: $!\n"),exit 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | open (STDERR, ">>", "$output_file.stderr") or print($write "Can't open output file $output_file.stderr: $!\n"),exit 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 0 | $error = $self->git_get($git_url, $git_rev); | |||||||||||||||||||||||||||
| 190 | 0 | ▶ | if ($error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | 0 | print(write $error,"\n"); | |||||||||||||||||||||||||||
| 192 | 0 | exit -1; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 0 | $error = $self->get_config($config_file); | |||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ($error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | 0 | print(write $error,"\n"); | |||||||||||||||||||||||||||
| 198 | 0 | exit -1; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 0 | $ENV{TAPPER_TESTRUN} = $self->cfg->{test_run}; | |||||||||||||||||||||||||||
| 203 | 0 | $ENV{TAPPER_SERVER} = $self->cfg->{mcp_host}; | |||||||||||||||||||||||||||
| 204 | 0 | $ENV{TAPPER_REPORT_SERVER} = $self->cfg->{report_server}; | |||||||||||||||||||||||||||
| 205 | 0 | $ENV{TAPPER_REPORT_API_PORT} = $self->cfg->{report_api_port}; | |||||||||||||||||||||||||||
| 206 | 0 | $ENV{TAPPER_REPORT_PORT} = $self->cfg->{report_port}; | |||||||||||||||||||||||||||
| 207 | 0 | $ENV{TAPPER_HOSTNAME} = $self->cfg->{hostname}; | |||||||||||||||||||||||||||
| 208 | 0 | $ENV{TAPPER_OUTPUT_PATH} = $output_dir; | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | # chroot to execute script inside the future root file system | ||||||||||||||||||||||||||||
| 212 | 0 | chroot $self->cfg->{paths}{base_dir}; | |||||||||||||||||||||||||||
| 213 | 0 | chdir('linux'); | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | $error = $self->make_kernel(); | |||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ($error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 0 | print( $write $error, "\n"); | |||||||||||||||||||||||||||
| 218 | 0 | exit -1; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | $error = $self->make_initrd(); | |||||||||||||||||||||||||||
| 222 | 0 | ▶ | if ($error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 0 | print( $write $error, "\n"); | |||||||||||||||||||||||||||
| 224 | 0 | exit -1; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | close $write; | |||||||||||||||||||||||||||
| 228 | 0 | exit 0; | |||||||||||||||||||||||||||
| 229 | } else { | ||||||||||||||||||||||||||||
| 230 | 0 | close $write; | |||||||||||||||||||||||||||
| 231 | 0 | my $select = IO::Select->new( $read ); | |||||||||||||||||||||||||||
| 232 | 0 | my ($error, $output); | |||||||||||||||||||||||||||
| 233 | MSG_FROM_CHILD: | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | while (my @ready = $select->can_read()){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 0 | my $tmpout = <$read>; # only $read can be in @ready, since no other FH is in $select | |||||||||||||||||||||||||||
| 236 | 0 | ▶ | last MSG_FROM_CHILD if not $tmpout; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 237 | 0 | $output.=$tmpout; | |||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | # save logfile from within chroot | ||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if (-e $self->cfg->{paths}{base_dir}."/tmp/bootdir-content" ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | log_and_exec("cp",$self->cfg->{paths}{base_dir}."/tmp/bootdir-content", | ||||||||||||||||||||||||||||
| 242 | 0 | $self->cfg->{paths}{output_dir}."/".$self->cfg->{test_run}."/install/"); | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 0 | $self->log_and_exec("umount ".$self->cfg->{paths}{base_dir}."/sys"); | |||||||||||||||||||||||||||
| 246 | 0 | $self->log_and_exec("umount ".$self->cfg->{paths}{base_dir}."/dev"); | |||||||||||||||||||||||||||
| 247 | 0 | $self->log_and_exec("umount ".$self->cfg->{paths}{base_dir}."/proc"); | |||||||||||||||||||||||||||
| 248 | 0 | waitpid($pid,0); | |||||||||||||||||||||||||||
| 249 | 0 | ▶ | if ($?) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | 0 | return("Building kernel from $git_url $git_rev failed: $output"); | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | 0 | return(0); | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | ; | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 6 | 1; | |||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | __END__ | ||||||||||||||||||||||||||||