diff options
author | Florent Villard <warly@mandriva.com> | 2006-01-06 22:06:13 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2006-01-06 22:06:13 +0000 |
commit | e22910a8df8b708ad08455b48fc8d3d01fea24db (patch) | |
tree | 52c2ca8a28454719062bcbfd5073c3de919ff939 /iurt2 | |
parent | e856d5bdaede33b19566a4c2ea93bd7936592dfa (diff) | |
download | iurt-e22910a8df8b708ad08455b48fc8d3d01fea24db.tar iurt-e22910a8df8b708ad08455b48fc8d3d01fea24db.tar.gz iurt-e22910a8df8b708ad08455b48fc8d3d01fea24db.tar.bz2 iurt-e22910a8df8b708ad08455b48fc8d3d01fea24db.tar.xz iurt-e22910a8df8b708ad08455b48fc8d3d01fea24db.zip |
Try to get rid of urpmi database locked
Diffstat (limited to 'iurt2')
-rwxr-xr-x | iurt2 | 69 |
1 files changed, 50 insertions, 19 deletions
@@ -23,8 +23,6 @@ # # TODO # -# - use a directory + tmpfs via unionfs to build the packages -# - having only one cache for all the architecture would need a merging before the cache is dumped, this is a bit overkill, so several cache are used, as a consequence the rpm/srpm structure is duplicated. Maybe a separated cache could be done to handle this structure, or just have it created separately. Anyway this is just a mater of some hundreds of kilobytes and directory listings. # - use a cache (rpmctl cache for example) to find maintainer # use strict; @@ -164,20 +162,31 @@ foreach my $rpm (readdir $rpmdir) { closedir $rpmdir; my %provides; -my $synthesis_file = "$config->{repository}/$distro_version/$my_arch/media/$media/media_info/synthesis.hdlist.cz"; -if (-f $synthesis_file) { - print STDERR "Parsing $synthesis_file\n"; - if (open my $syn, "zcat $synthesis_file |") { - while (<$syn>) { - if (/^\@provides@(.*)/) { - foreach my $p (split '@', $1) { - $p =~ /([^[]+)(?:\[(.*)\])?/g; - $provides{$1} = $2 || 1 +my %pack_provide; +foreach my $m ('main', 'contrib') { + my $synthesis_file = "$config->{repository}/$distro_version/$my_arch/media/$m/media_info/synthesis.hdlist.cz"; + if (-f $synthesis_file) { + print STDERR "Parsing $synthesis_file\n"; + if (open my $syn, "zcat $synthesis_file |") { + my @prov; + while (<$syn>) { + if (/^\@provides@(.*)/) { + foreach my $p (split '@', $1) { + $p =~ /([^[]+)(?:\[(.*)\])?/g; + push @prov, $1; + $provides{$1} = $2 || 1 + } + } elsif (/\@info\@([^@]+)@/) { + my ($name) = $1 =~ /(.*)-[^-]+-[^-]+\..*$/; + foreach (@prov) { + $pack_provide{$_} = $name + } + @prov = () } - } - } - } else { - print STDERR "ERROR: Could not open $synthesis_file, will not precheck dependecies avaibility\n"; + } + } else { + print STDERR "ERROR: Could not open $synthesis_file, will not precheck dependecies avaibility\n"; + } } } #} @@ -244,6 +253,7 @@ if (!@todo && !$debug) { } print "iurt: will try to compile $to_compile packages\n"; +$cache->{run} ||= 1; my $run = $cache->{run}++; @@ -316,8 +326,12 @@ foreach (my $i ; $i < @todo; $i++) { #($maintainer, $cc) = ($config->{admin},''); print "Installing build dependencies of $srpm...\n"; # FIXME unfortunately urpmi stalls quite often - system(qq{sudo pkill -9 -u root -f "$todo[$i-1][1]"}) if $i - 1 >= 0; - system(qq{sudo pkill -9 -u root -f "urpmi $urpmi_options --rrot $chroot"}); + if (!clean_urpmi($chroot)) { + dump_cache(); + die "FATAL iurt: Could not have urpmi working !" + } + #system(qq{sudo pkill -9 dd-u root -f "$todo[$i-1][1]"}) if $i - 1 >= 0; + #system(qq{sudo pkill -9 -u root -f "urpmi $urpmi_options --root $chroot"}); perform_command("sudo urpmi $urpmi_options --root $chroot $dir/$srpm", mail => $maintainer, error => "[REBUILD] install of build dependencies of $srpm failed on $my_arch", @@ -335,15 +349,16 @@ foreach (my $i ; $i < @todo; $i++) { print "Calling callback for $opt->{hash}\n" if $debug; my ($missing_deps, $version) = $output =~ /\(due to unsatisfied ([^[)]*)(\[.*\])?/; $missing_deps or return; - my $other_maint = `rpmmon -p $missing_deps`; + my $p = $pack_provide{$missing_deps} || $missing_deps; + my $other_maint = `rpmmon -p $p`; $version ||= 1; - # remember what is needed, and do not try to recompile until it is available chomp $other_maint; print "Missing Dep: $missing_deps ($other_maint)\n"; if ($other_maint) { $opt->{mail} = $other_maint; $opt->{error} = "[MISSING] $missing_deps, needed to build $srpm, is not available on $my_arch"; } + # remember what is needed, and do not try to recompile until it is available push @{$cache->{needed}{$srpm}}, [ $missing_deps, $version, $other_maint || $maintainer ]; }, ) or next; @@ -467,6 +482,22 @@ sub clean_chroot { 1 } +sub clean_urpmi { + my ($chroot) = @_; + my $match = "urpmi $urpmi_options --root $chroot"; + my $ps; + my $i; + $ps = `pgrep -u root -f "$match"`; + while ($ps) { + system(qq{sudo pkill -9 -u root -f "$match"}); + sleep 1; + $ps = `pgrep -u root -f "$match"`; + print STDERR "Trying to removed previous blocked urpmi session matching $match ($ps)\n"; + $i++ > 10 and return 0 + } + 1 +} + sub clean_unionfs { my ($unionfs_dir, $union_id) = @_; foreach my $t ("unionfs",'tmpfs') { |