From c0a176131ffd57d282da4061f09b07df5c879ed1 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Fri, 1 Sep 2006 18:25:33 +0000 Subject: let the check of the binary and the basesystem packages be configurable --- iurt2 | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/iurt2 b/iurt2 index dd7055a..5a1b13c 100755 --- a/iurt2 +++ b/iurt2 @@ -47,7 +47,7 @@ use MDK::Common; use Filesys::Df qw(df); my $program_name = 'iurt2'; -my $VERSION = '0.5.8'; +my $VERSION = '0.5.10'; # sessing parameters my $sudo = '/usr/bin/sudo'; my $arg = @ARGV; @@ -274,8 +274,10 @@ my %config_usage = ( all_media => { desc => 'List of known media', default => { 'main' => [ '' ], 'contrib' => [ '' ] } }, basesystem_media_root => { desc => 'Name of the media holding basesystem packages', default => sub { my ($config, $run) = @_; "$config->{repository}/$run{distro}/$run{my_arch}/" } }, basesystem_media => { desc => 'Where to find basesystem packages', default => 'main/release' }, + basesystem_packages => { desc => 'List of packages needed for the chroot creation', default => ['basesystem', 'rpm-build', 'rpm-mandriva-setup-build', 'sudo', 'urpmi' ] }, cache_home => { desc => 'Where to store the cache files', default => "$HOME/.bugs" }, cache_min_size => { desc => 'Minimal size to consider a cache file valid', default => 1000000 }, + check_binary_file => { desc => 'Packages rebuild should be checked, however sometime rpm is segfaulting and the test is not correct', default => 0 }, iurt_root_command => { desc => 'Program to run sudo command', default => '/usr/local/bin/iurt_root_command' }, distribution => { desc => 'Name of the packages distribution', default => 'Mandriva Linux' }, home => { desc => 'Home dir', default => $HOME }, @@ -478,7 +480,7 @@ if ($run{shell}) { ($union_id, my $chroot_tmp) = create_temp_chroot(\%run, $config, $cache, $union_id, $chroot_tmp, $chroot_tar) or die "FATAL $program_name: could not create temporary chroot"; add_local_user($chroot_tmp, \%run, $config, $luser, $run{uid}) or die "FATAL $program_name: could not add local user"; $urpmi->set_command($chroot_tmp); - $urpmi->install_packages('chroot', $chroot_tmp, $local_spool, \%pack_provide, 'configure', "[ADMIN] installation of urpmi and sudo failed in the chroot $run{my_arch}", $config->{admin}, 'urpmi', 'sudo') or die "FATAL $program_name: could not add urpmi and sudo in the chroot"; + $urpmi->install_packages('chroot', $chroot_tmp, $local_spool, \%pack_provide, 'configure', "[ADMIN] installation of urpmi and sudo failed in the chroot $run{my_arch}", { check => 1, maintainer => $config->{admin} }, 'urpmi', 'sudo') or die "FATAL $program_name: could not add urpmi and sudo in the chroot"; add_sudoers(\%run, $chroot_tmp, $luser); if ($run{shell}) { print {$run{LOG}} "$program_name: dumping to a chrooted shell into $chroot_tmp\n"; @@ -544,7 +546,7 @@ do { retry: $urpmi->clean_urpmi_process($chroot_tmp); - my ($u_id, $chroot_tmp) = create_temp_chroot(\%run, $config, $cache, $union_id, $chroot_tmp, $chroot_tar, $srpm) or next; + my ($u_id, $chroot_tmp) = create_temp_chroot(\%run, $config, $cache, $union_id, $chroot_tmp, $chroot_tar, $srpm) or next; $union_id = $u_id; $urpmi->urpmi_command($chroot_tmp, $luser); @@ -577,7 +579,7 @@ do { # # on x86_64 the rpm database is getting corrupted and sometimes rpm do not found anymore # installed packages, retrying several time to be sure something is really broken - my $ok = $urpmi->install_packages($srpm, $chroot_tmp, $local_spool, \%pack_provide, 'install_deps', "[REBUILD] install of build dependencies of $srpm failed on $run{my_arch}", $maintainer, "$path_srpm/$srpm"); + my $ok = $urpmi->install_packages($srpm, $chroot_tmp, $local_spool, \%pack_provide, 'install_deps', "[REBUILD] install of build dependencies of $srpm failed on $run{my_arch}", { maintainer => $maintainer }, "$path_srpm/$srpm"); if (!$ok) { $run{status}{$srpm} = 'install_deps_failure'; next; @@ -594,7 +596,7 @@ do { print {$run{LOG}} "Compiling $srpm\n" if $run{verbose}; my $command = "rpm --rebuild /home/$luser/rpm/SRPMS/$srpm"; if ($run{stop}) { - $urpmi->install_packages('chroot', $chroot_tmp, $local_spool, \%pack_provide, 'configure', "[ADMIN] installation of urpmi and sudo failed in the chroot $run{my_arch}", $config->{admin}, 'urpmi', 'sudo'); + $urpmi->install_packages('chroot', $chroot_tmp, $local_spool, \%pack_provide, 'configure', "[ADMIN] installation of urpmi and sudo failed in the chroot $run{my_arch}", { check => 1, maintainer => $config->{admin} }, 'urpmi', 'sudo'); add_sudoers(\%run, $chroot_tmp, $luser); $command = "rpm -b$run{stop} /home/$luser/rpm/SPECS/*.spec" } @@ -687,7 +689,14 @@ do { push @packages, map { "$chroot_tmp/home/$luser/rpm/RPMS/$bindir/$_" } grep { !/src\.rpm$/ && /\.rpm$/ } readdir $rpmfh; } # 20060810 warly We should fail here, but rpm is currently segfaulting when trying to install packages - # $urpmi->install_packages($srpm, $chroot_tmp, $local_spool, \%pack_provide, 'binary_test', "[REBUILD] binaries packages generated from $srpm do not install correctly", @packages);# or next; + if ($config->{check_binary_file}) { + $urpmi->install_packages($srpm, $chroot_tmp, $local_spool, \%pack_provide, 'binary_test', "[REBUILD] binaries packages generated from $srpm do not install correctly", { maintainer => $maintainer } ,@packages) or next; + } else { + my $successfile = "$local_spool/log/$srpm/binary_test_$srpm-1.log"; + open my $f, ">$successfile"; + print $f "$srpm build ok"; + close $f + } $run{status}{$srpm} = 'ok'; delete $cache->{failure}{$srpm} if defined $cache->{failure}{$srpm}; @@ -1028,6 +1037,7 @@ sub search_packages { } my $check_needed = check_needed($srpm, $cache, $provides); $run->{status}{$srpm} = 'missing_buildrequires' if !$check_needed; + -f "$dir/$srpm" or next; if (!$cache->{queue}{$srpm} && $check_needed) { my $hdr = RPM4::Header->new("$dir/$srpm"); if (!check_arch($hdr)) { -- cgit v1.2.1