diff options
author | Thierry Vignaud <tv@mandriva.org> | 2009-12-02 18:48:02 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2009-12-02 18:48:02 +0000 |
commit | 1a3de3d9cddc23c4040fd6cc804da397bc11c311 (patch) | |
tree | cf1a8efb57a936fe4638adc6aa4759c0b2e4e9cd /lib/Iurt | |
parent | 84b43ce2b4e8d239eb64f06d897f1d18ab856303 (diff) | |
download | iurt-1a3de3d9cddc23c4040fd6cc804da397bc11c311.tar iurt-1a3de3d9cddc23c4040fd6cc804da397bc11c311.tar.gz iurt-1a3de3d9cddc23c4040fd6cc804da397bc11c311.tar.bz2 iurt-1a3de3d9cddc23c4040fd6cc804da397bc11c311.tar.xz iurt-1a3de3d9cddc23c4040fd6cc804da397bc11c311.zip |
perl_checker cleanups
Diffstat (limited to 'lib/Iurt')
-rw-r--r-- | lib/Iurt/Chroot.pm | 25 | ||||
-rw-r--r-- | lib/Iurt/DKMS.pm | 5 |
2 files changed, 14 insertions, 16 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index ab8df70..82df2b0 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -50,13 +50,13 @@ sub clean_chroot { system("$sudo umount $chroot/var/cache/icecream &> /dev/null"); } if (-d "$chroot/urpmi_medias/") { - system ("$sudo umount $chroot/urpmi_medias"); + system("$sudo umount $chroot/urpmi_medias"); } # Do not run rm if there is something still mounted there - open (my $FP, "/proc/mounts") or die $!; + open(my $FP, "/proc/mounts") or die $!; my @list = grep { /$chroot/ } <$FP>; - close ($FP); + close($FP); if ($#list >= 0) { # Still referenced return 1; @@ -84,39 +84,38 @@ sub clean_chroot { # <mrl> 20071106 Second try? if (!-d "$chroot/proc" || !-d "$chroot/home/builder") { - create_build_chroot($chroot, $chroot_tar, $run, $config) + create_build_chroot($chroot, $chroot_tar, $run, $config); } if (!dump_rpmmacros($run, $config, "$chroot/home/builder/.rpmmacros")) { - plog ('ERROR', "Failed to dump macros"); + plog('ERROR', "Failed to dump macros"); return; } if (system("$sudo mount none -t proc $chroot/proc")) { - plog ('ERROR', "Failed to mount proc"); + plog('ERROR', "Failed to mount proc"); return; } if (system("$sudo mount none -t devpts $chroot/dev/pts")) { - plog ('ERROR', "Failed to mount dev/pts"); + plog('ERROR', "Failed to mount dev/pts"); return; } if ($run->{icecream}) { system("$sudo mkdir -p $chroot/var/cache/icecream"); if (system("$sudo mount -o bind /var/cache/icecream $chroot/var/cache/icecream")) { - plog ('ERROR', "Failed to mount var/cache/icecream"); + plog('ERROR', "Failed to mount var/cache/icecream"); return; } } if ($run->{additional_media} && $run->{additional_media}{repository}) { my $rep = $run->{additional_media}{repository}; - if (!($rep =~ m/^(http:|ftp:)/)) { + if ($rep !~ m/^(http:|ftp:)/) { my $mount_point = "$chroot/urpmi_medias"; - my $bind; my $url = $rep; $url =~ s!^file://!!; system("$sudo mkdir -p $mount_point"); if (system("$sudo mount -o bind,ro $url $mount_point")) { - plog ('ERROR', "Failed to mount $url on $mount_point"); + plog('ERROR', "Failed to mount $url on $mount_point"); return; } } @@ -135,7 +134,7 @@ Return true. =cut sub update_chroot { - my ($chroot, $chroot_tar, $run, $config, $o_only_clean, $o_only_tar) = @_; + my ($_chroot, $_chroot_tar, $_run, $_config, $_only_clean, $_only_tar) = @_; plog('DEBUG', "update chroot"); @@ -577,7 +576,7 @@ sub build_chroot { system("$sudo umount $tmp_chroot/var/cache/icecream &> /dev/null"); } if (-d "$tmp_chroot/urpmi_medias/") { - system ("$sudo umount $tmp_chroot/urpmi_medias"); + system("$sudo umount $tmp_chroot/urpmi_medias"); } return !system($sudo, 'tar', 'czf', $chroot_tar, '-C', $tmp_chroot, '.'); } diff --git a/lib/Iurt/DKMS.pm b/lib/Iurt/DKMS.pm index c18cd51..201e883 100644 --- a/lib/Iurt/DKMS.pm +++ b/lib/Iurt/DKMS.pm @@ -93,7 +93,6 @@ sub search_dkms { my $hdr = RPM4::Header->new("$path/$rpm"); my $files = $hdr->queryformat('[%{FILENAMES}\n]'); if ($version =~ /(.*)source-(.*)/ || $version =~ /(.*)devel-(.*)/) { - my $source = "$1$2"; my ($sourcedir) = $files =~ m,^/usr/src/([^/ ]+)$,m; plog('NOTIFY', "kernel source $version (sourcedir $sourcedir)"); $kernel_source{$version} = $sourcedir; @@ -198,8 +197,8 @@ sub dkms_compile { my $dkms_spool = "$local_spool/dkms/"; -d $dkms_spool or mkdir $dkms_spool; - for (my $i; $i < @{$run->{dkms_todo}}; $i++) { - my ($name, $version, $_modulesourcedir, $realname, $realversion, $file, $kernel, $modulesdir, $source, $sourcedir, $media) = @{$run->{dkms_todo}[$i]}; + foreach my $dkms_todo (@{$run->{dkms_todo}}) { + my ($name, $version, $_modulesourcedir, $realname, $realversion, $file, $kernel, $modulesdir, $source, $sourcedir, $media) = @$dkms_todo; $done++; $media = $run->{dkms}{umedia} if $run->{dkms}{umedia}; |