aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2017-10-03 19:13:31 +0100
committerPascal Terjan <pterjan@mageia.org>2017-10-03 21:05:27 +0100
commitd1912e0070731c7458df36ec1dc4ccd64f47b42e (patch)
treee65101b86880c269605f6fa7d42fa9f2d7e4559d
parent8c6472680bbc28bd7e64570a70043d7a3d6ea7c3 (diff)
downloadiurt-d1912e0070731c7458df36ec1dc4ccd64f47b42e.tar
iurt-d1912e0070731c7458df36ec1dc4ccd64f47b42e.tar.gz
iurt-d1912e0070731c7458df36ec1dc4ccd64f47b42e.tar.bz2
iurt-d1912e0070731c7458df36ec1dc4ccd64f47b42e.tar.xz
iurt-d1912e0070731c7458df36ec1dc4ccd64f47b42e.zip
Kill most of $cache
-rwxr-xr-xiurt9
-rw-r--r--lib/Iurt/Process.pm18
-rw-r--r--lib/Iurt/Urpmi.pm33
3 files changed, 21 insertions, 39 deletions
diff --git a/iurt b/iurt
index bdb7f4a..8888c9d 100755
--- a/iurt
+++ b/iurt
@@ -595,10 +595,7 @@ if (!-d "$local_spool/log") {
$run{local_spool} = $local_spool;
my $cache = {
- rpm_srpm => {},
queue => {},
- warning => {},
- run => 1,
};
$run{cache} = $cache;
@@ -831,7 +828,7 @@ retry:
# system("$sudo chroot $chroot_tmp rpm --rebuilddb &> /dev/null");
perform_command("rpm --root $chroot_tmp -qa | sort",
- \%run, $config, $cache,
+ \%run, $config,
logname => "rpm_qa",
hash => "rpm_qa_$srpm",
timeout => 60,
@@ -852,7 +849,7 @@ retry:
}
if (!perform_command(qq(chroot $chroot_tmp /bin/su - $luser -c "TMP=/home/$luser/tmp/ $icecream $command"),
- \%run, $config, $cache,
+ \%run, $config,
use_iurt_root_command => 1,
mail => $maintainer,
error => "[REBUILD] $srpm from $run{distro_tag} does not build correctly on $run{my_arch}",
@@ -1042,7 +1039,7 @@ process_queue($config, \%run, \@wrong_rpm);
plog('FAIL', "ERROR: RPM with a wrong SRPM name") if @wrong_rpm;
if (@wrong_rpm && open my $file, ">$local_spool/log/wrong_srpm_names.log") {
foreach (@wrong_rpm) {
- print $file "$_->[1] -> $_->[0] (", $cache->{rpm_srpm}{$_->[1]}, ")\n";
+ print $file "$_->[1] -> $_->[0]\n";
}
}
diff --git a/lib/Iurt/Process.pm b/lib/Iurt/Process.pm
index 52b0b79..dfecc46 100644
--- a/lib/Iurt/Process.pm
+++ b/lib/Iurt/Process.pm
@@ -131,7 +131,7 @@ sub fork_to_monitor {
}
sub handle_command_error {
- my ($run, $config, $cache, $log_msg, $comment, $fulloutput, %opt) = @_;
+ my ($run, $config, $log_msg, $comment, $fulloutput, %opt) = @_;
plog('ERROR', $log_msg);
if ($opt{log} && $config->{log_url}) {
@@ -146,14 +146,9 @@ sub handle_command_error {
}
if ($opt{mail} && $config->{sendmail} && !$config->{no_mail}{$opt{mail}}) {
- if (! ($cache->{warning}{$opt{hash}}{$opt{mail}} % $opt{freq})) {
- my $cc = join ',', grep { !$config->{no_mail}{$_} } split ',', $opt{cc};
- sendmail($opt{mail}, $cc, $opt{error} , "$comment\n$out", "Iurt the rebuild bot <$config->{admin}>", $opt{debug_mail}, $config);
- } elsif ($config->{admin}) {
- sendmail($config->{admin}, '' , $opt{error}, "$comment\n$out", "Iurt the rebuild bot <$config->{admin}>", $opt{debug_mail}, $config);
- }
+ my $cc = join ',', grep { !$config->{no_mail}{$_} } split ',', $opt{cc};
+ sendmail($opt{mail}, $cc, $opt{error} , "$comment\n$out", "Iurt the rebuild bot <$config->{admin}>", $opt{debug_mail}, $config);
}
- $cache->{warning}{$opt{hash}}{$opt{mail}}++;
plog('FAIL', $comment);
plog('INFO', "--------------- Command failed, full output follows ---------------");
plog('INFO', $fulloutput);
@@ -207,20 +202,19 @@ sub generate_comment {
}
}
-=head2 perform_command($command, $run, $config, $cache, %opt)
+=head2 perform_command($command, $run, $config, %opt)
Run a command and check various running parameters such as log size, timeout...
I<$command> the command to run
I<$run> current running options
I<$config> the configuration
-I<$cache> cached values
I<%opt> the options for the command run
Return true.
=cut
sub perform_command {
- my ($command, $run, $config, $cache, %opt) = @_;
+ my ($command, $run, $config, %opt) = @_;
$opt{timeout} ||= 300;
$opt{freq} ||= 24;
@@ -336,7 +330,7 @@ sub perform_command {
if (!$call_ret || $kill || $err || $opt{error_regexp} && $fulloutput =~ /$opt{error_regexp}/) {
my $msg = "ERROR: call_ret=$call_ret kill=$kill err=$err ($opt{error_regexp})";
- handle_command_error($run, $config, $cache, $msg, $comment, $fulloutput, %opt);
+ handle_command_error($run, $config, $msg, $comment, $fulloutput, %opt);
return 0;
}
1;
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm
index a180f73..baa6b92 100644
--- a/lib/Iurt/Urpmi.pm
+++ b/lib/Iurt/Urpmi.pm
@@ -182,7 +182,6 @@ sub add_media__urpmi_root {
my ($self, $chroot, $media) = @_;
my $run = $self->{run};
my $config = $self->{config};
- my $cache = $run->{cache};
foreach my $m (@{$media || []}) {
my $url = $self->{distrib_url} . "/media/" . $m;
@@ -190,7 +189,7 @@ sub add_media__urpmi_root {
$name =~ s![/:]!_!g;
plog("adding media $name from $url with option --urpmi-root in chroot $chroot");
perform_command("urpmi-addmedia -v --urpmi-root $chroot $name $url --probe-synthesis",
- $run, $config, $cache,
+ $run, $config,
mail => $config->{admin},
timeout => 300,
use_iurt_root_command => 1,
@@ -207,12 +206,11 @@ sub add_media {
my ($self, $chroot, $regexp, $media) = @_;
my $run = $self->{run};
my $config = $self->{config};
- my $cache = $run->{cache};
plog("add chroot media: $run->{chrooted_media}");
if (!perform_command("chroot $chroot urpmi.addmedia $media",
- $run, $config, $cache,
+ $run, $config,
mail => $config->{admin},
timeout => 300,
freq => 1,
@@ -232,9 +230,8 @@ sub add_packages {
my ($self, $chroot, $_user, @packages) = @_;
my $run = $self->{run};
my $config = $self->{config};
- my $cache = $run->{cache};
if (!perform_command("$self->{urpmi_command} @packages",
- $run, $config, $cache,
+ $run, $config,
use_iurt_root_command => $self->{use_iurt_root_command},
timeout => 300,
freq => 1,
@@ -391,7 +388,7 @@ sub are_installed {
sub _install_callback {
- my ($run, $admin, $cache, $opt, $output, $pack_provide, $title) = @_;
+ my ($run, $admin, $opt, $output, $pack_provide, $title) = @_;
plog('DEBUG', "calling callback for $opt->{hash}");
# 20060614
@@ -440,7 +437,6 @@ sub install_packages {
my $run = $self->{run};
my $config = $self->{config};
- my $cache = $run->{cache};
my $program_name = $run->{program_name};
my $ok = 1;
my @to_install;
@@ -477,7 +473,7 @@ sub install_packages {
if (!perform_command(
join(' ', $self->{urpmi_command}, @options, @to_install),
- $run, $config, $cache,
+ $run, $config,
use_iurt_root_command => $self->{use_iurt_root_command},
error => $error,
logname => $log,
@@ -495,7 +491,7 @@ sub install_packages {
log => $log_spool,
callback => sub {
my ($opt, $output) = @_;
- _install_callback($run, $config->{admin}, $cache, $opt, $output, $pack_provide, $title);
+ _install_callback($run, $config->{admin}, $opt, $output, $pack_provide, $title);
},
)) {
plog('DEBUG', "urpmi command failed.");
@@ -531,25 +527,21 @@ sub clean_urpmi_process {
sub update_srpm {
my ($self, $dir, $rpm, $wrong_rpm) = @_;
my $run = $self->{run};
- my $cache = $run->{cache};
my ($arch) = $rpm =~ /([^\.]+)\.rpm$/ or return 0;
- my $srpm = $cache->{rpm_srpm}{$rpm};
if (!$srpm) {
my $hdr = RPM4::Header->new("$dir/$rpm");
$hdr or return 0;
$srpm = $hdr->queryformat('%{SOURCERPM}');
- $cache->{rpm_srpm}{$rpm} = $srpm;
}
- $srpm = fix_srpm_name($cache, $srpm, $rpm, $wrong_rpm);
+ $srpm = fix_srpm_name($srpm, $rpm, $wrong_rpm);
$arch, $srpm;
}
sub fix_srpm_name {
- my ($cache, $srpm, $rpm, $wrong_rpm) = @_;
+ my ($srpm, $rpm, $wrong_rpm) = @_;
my $old_srpm = $srpm;
if ($srpm =~ s/^lib64/lib/) {
push @$wrong_rpm, [ $old_srpm, $rpm ] if ref $wrong_rpm;
- $cache->{rpm_srpm}{$rpm} = $srpm;
}
$srpm;
}
@@ -559,7 +551,6 @@ sub recreate_srpm {
my ($_self, $run, $config, $chroot_tmp, $dir, $srpm, $luser, $b_retry) = @_;
# recreate a new srpm for buildarch condition in the spec file
my $program_name = $run->{program_name};
- my $cache = $run->{cache};
my $with_flags = $run->{with_flags};
plog('NOTIFY', "recreate srpm: $srpm");
@@ -568,9 +559,9 @@ sub recreate_srpm {
sub {
my ($s, $d) = @_;
sudo($config, '--cp', $s, $d) } , [ "$dir/$srpm", "$chroot_tmp/home/$luser/rpmbuild/SRPMS/" ] ],
- $run, $config, $cache,
+ $run, $config,
type => 'perl',
- mail => $config->{admin},
+ mail => $config->{admin},
error => "[REBUILD] cannot copy $srpm to $chroot_tmp",
debug_mail => $run->{debug},
hash => "copy_$srpm") or return;
@@ -596,7 +587,7 @@ sub recreate_srpm {
});
plog('DEBUG', "recreating src.rpm...");
if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpm -i /home/$luser/rpmbuild/SRPMS/$srpm"),
- $run, $config, $cache, %opt)) {
+ $run, $config, %opt)) {
plog("ERROR: chrooting failed (retry $opt{retry}") if $run->{debug};
if ($opt{retry}) {
return -1;
@@ -624,7 +615,7 @@ sub recreate_srpm {
# 20060515 This should not be necessairy any more if urpmi *.spec works, but it doesn't
#
my $ret = perform_command(qq(chroot $chroot_tmp su $luser -c "rpmbuild --nodeps -bs $with_flags /home/$luser/rpmbuild/SPECS/$spec"),
- $run, $config, $cache,
+ $run, $config,
use_iurt_root_command => 1,
mail => $config->{admin},
error => "[REBUILD] cannot create $srpm in $chroot_tmp",