From 6cf264af576ce31e3d5c92983dc8627ac194c95b Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 15 Feb 2008 14:14:13 +0000 Subject: perl_checker cleanups --- lib/Iurt/Urpmi.pm | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index 6e3eb8b..5d8fadc 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -48,7 +48,7 @@ sub new { } sub set_command { - my ($self, $chroot_tmp) = @_; + my ($self, $_chroot_tmp) = @_; $self->{use__urpmi_root} ? &set_command__urpmi_root : &set_command__use_distrib; } sub set_command__urpmi_root { @@ -110,7 +110,7 @@ sub urpmi_command { if (!add_media($self, $chroot_tmp, $m_name, "$m_name $run->{chrooted_media}/media/$m")) { $run->{chrooted_urpmi} = 0; - plog ('ERROR', "Failed to add media $m_name. Disabling chrooted_urpmi."); + plog('ERROR', "Failed to add media $m_name. Disabling chrooted_urpmi."); return; } } @@ -118,7 +118,7 @@ sub urpmi_command { if (!add_media($self, $chroot_tmp, 'Main', "--distrib $run->{chrooted_media}")) { if (!add_media($self, $chroot_tmp, 'Main', "--wget --distrib $run->{chrooted_media}")) { $run->{chrooted_urpmi} = 0; - plog ('ERROR', "Failed to add media $run->{chrooted_media}. Disabling chrooted_urpmi."); + plog('ERROR', "Failed to add media $run->{chrooted_media}. Disabling chrooted_urpmi."); return; } } @@ -129,7 +129,7 @@ sub urpmi_command { $name =~ s![/:]!_!g; my $url; - if (($run->{additional_media}{repository} =~ m!^(http:|ftp:)!)) { + if ($run->{additional_media}{repository} =~ m!^(http:|ftp:)!) { $url = $run->{additional_media}{repository}; } else { @@ -138,15 +138,15 @@ sub urpmi_command { # Check if the media is not empty, as add_media will abort if it fails my $DP; - if (!opendir ($DP, "$chroot_tmp/$url")) { - plog ('ERROR', "Failed to add additional media at $url: $!"); + if (!opendir($DP, "$chroot_tmp/$url")) { + plog('ERROR', "Failed to add additional media at $url: $!"); next; } my @contents = readdir $DP; - close ($DP); - if ($#contents <= 1) { + close($DP); + if (@contents <= 2) { # Just entries: . .. - plog ('DEBUG', "$url has no packages, skipping it."); + plog('DEBUG', "$url has no packages, skipping it."); next; } @@ -155,7 +155,7 @@ sub urpmi_command { } } - if (-d "$local_media") { + if (-d $local_media) { mkdir("$chroot_tmp/iurt_media/"); opendir my $dir, $local_media; my $next; @@ -448,13 +448,12 @@ sub install_packages { } plog('INFO', "install dependencies using urpmi"); - my $unsatisfied; if (!perform_command( "sudo $self->{urpmi_command} @to_install", $run, $config, $cache, error => $error, - logname => "${log}", + logname => ${log}, hash => "${log}_$title", timeout => 3600, # [pixel] 10 minutes was not enough, 1 hour should be better srpm => $title, @@ -484,12 +483,11 @@ sub install_packages { # returning false problem on deps installation, try # to compile anyway - if (!@missing_deps){ - plog ('DEBUG', 'missing_deps is empty, aborting.'); - plog ('DEBUG', "output had: __ $output __"); + if (!@missing_deps) { + plog('DEBUG', 'missing_deps is empty, aborting.'); + plog('DEBUG', "output had: __ $output __"); return 1; } - $unsatisfied = 1; while (my $missing_package = shift @missing_deps) { my $missing_deps = shift @missing_deps; @@ -525,7 +523,7 @@ sub install_packages { 0; }, )) { - plog ('DEBUG', "urpmi command failed."); + plog('DEBUG', "urpmi command failed."); if (!clean_process($run, "$self->{urpmi_command} $opt @to_install", $run->{verbose})) { dump_cache_par($run); die "FATAL $program_name: Could not have urpmi working !"; @@ -543,7 +541,7 @@ sub install_packages { $ok = 1; } else { - plog (1, "ERROR: Failed to install initial packages"); + plog(1, "ERROR: Failed to install initial packages"); $ok = 0; } -- cgit v1.2.1