aboutsummaryrefslogtreecommitdiffstats
path: root/iurt
diff options
context:
space:
mode:
Diffstat (limited to 'iurt')
-rwxr-xr-xiurt51
1 files changed, 27 insertions, 24 deletions
diff --git a/iurt b/iurt
index 9008bdf..1e3270c 100755
--- a/iurt
+++ b/iurt
@@ -34,14 +34,15 @@
use strict;
use RPM4::Header;
-use Iurt::Config qw(config_usage get_date get_prefix config_init get_maint check_arch %arch_comp get_package_prefix);
+use Iurt::Config qw(config_usage get_date get_prefix config_init get_maint %arch_comp get_package_prefix);
use Data::Dumper;
use URPM;
use Iurt::Urpmi;
use Iurt::Chroot qw(add_local_user create_temp_chroot remove_chroot create_build_chroot clean_chroot);
-use Iurt::Process qw(perform_command kill_for_good set_alarm_message sudo);
+use Iurt::Process qw(perform_command kill_for_good sudo);
use Iurt::Mail qw(sendmail);
+use Iurt::RPM qw(check_arch check_noarch);
use Iurt::Util qw(plog_init plog);
use File::NCopy qw(copy);
use File::Path qw(mkpath);
@@ -131,7 +132,7 @@ $run{todo} = [];
sub { my ($tmp, @media) = @_; $tmp->[0]{media} = \@media; 1 }, "Limiting rebuild to the kernel in the given media regexp"],
] , "[options] <media prefix>",
"Create urpmi media inside the chroot instead of using --root (media prefix is like http:///server.mandriva.com/dis/)",
- sub { my ($opt, $media) = @_; $opt->{rooted_media} = $media; $run{chrooted_urpmi} = $opt; 1 }, "Activating chroot media" ],
+ sub { my ($opt, $_media) = @_; $run{chrooted_urpmi} = $opt; 1 }, "Activating chroot media" ],
[ "", "clean-all", 0, "",
"Clean all remaining chroots for all the users",
sub { $run{clean_all} = 1 }, "Activating clean chroot flag" ],
@@ -323,7 +324,7 @@ plog_init($program_name, $run{logfd} || $LOG, 7, 1); # For parsing command line
# Display version information
#
-my $version = '0.7.8.1';
+my $version = '0.9.0';
plog("MSG", "This is iurt version $version");
my $todo = parseCommandLine($program_name, \@ARGV, \@params);
@@ -380,6 +381,7 @@ my %config_usage = (
desc => 'List of packages needed for the chroot creation',
default => [
'basesystem-minimal',
+ 'makedev',
'rpm-build',
'sudo',
'urpmi',
@@ -459,7 +461,7 @@ my %config_usage = (
default => ''
},
max_command_retry => {
- "Maximum number of retry Iurt will perform for a given command",
+ desc => 'Maximum number of retry Iurt will perform for a given command',
default => 20
},
no_mail => {
@@ -723,8 +725,6 @@ sub rebuild_one {
my $retry = 0;
retry:
- $urpmi->clean_urpmi_process;
-
my ($srpm_name) = $srpm =~ /(?:.*:)?(.*)-[^-]+-[^-]+\.src\.rpm$/;
$srpm_name or return $srpm;
@@ -782,24 +782,25 @@ retry:
mkdir $log_dir;
-d $log_dir or die "FATAL: could not create $log_dir (check permissions and group ownerships)";
+ # We may have media not used to create the chroot (when building for updates_testing
+ # or if using additional_media) so need to update basesystem packages.
+ $urpmi->update($chroot_tmp);
+
plog('INFO', "Install build dependencies for $srpm");
my $path_srpm = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/";
- # 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, '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';
return $srpm;
}
- # try to workarround the rpm -qa db4 error(2) from dbcursor->c_get:
- # No such file or directory
- # system("sudo chroot $chroot_tmp rm -rf /var/lib/rpm/__db* &> /dev/null");
- # system("$sudo chroot $chroot_tmp rpm --rebuilddb &> /dev/null");
-
+ $ok = $urpmi->install_dynamic_buildrequires(\%run, $config, $chroot_tmp, $luser, $spec, $srpm);
+ if (!$ok) {
+ $run{status}{$srpm} ||= 'install_deps_failure';
+ return $srpm;
+ }
+
perform_command("rpm --root $chroot_tmp -qa | sort",
\%run, $config,
logname => "rpm_qa",
@@ -808,7 +809,8 @@ retry:
debug_mail => $run{debug},
log => $log_dir); # or next; As this failed quite often, do not stop
plog('NOTIFY', "Building $srpm");
- my $command = "rpmbuild --rebuild $run{with_flags} /home/$luser/rpmbuild/SRPMS/$srpm";
+ my $target_arch = check_noarch("$path_srpm/$srpm") ? 'noarch' : $run{my_arch};
+ my $command = "rpmbuild --target $target_arch --rebuild $run{with_flags} /home/$luser/rpmbuild/SRPMS/$srpm";
if ($run{stop}) {
$urpmi->install_packages('chroot', $chroot_tmp, $local_spool, 'configure', "[ADMIN] installation of urpmi and sudo failed in the chroot $run{my_arch}", { check => 1, maintainer => $config->{admin} }, 'urpmi', 'sudo');
add_sudoers($chroot_tmp, $luser);
@@ -865,9 +867,8 @@ retry:
if ($config->{check_binary_file}) {
$urpmi->install_packages($srpm, $chroot_tmp, $local_spool, 'binary_test', "[REBUILD] binaries packages generated from $srpm do not install correctly", { maintainer => $maintainer } ,@packages) or return $srpm;
} else {
- my $successfile = "$local_spool/log/$srpm/binary_test_$srpm-1.log";
- open my $f, ">$successfile";
- print $f "$srpm build ok";
+ my $successfile = "$log_dir/binary_test_$srpm-1.log";
+ output($successfile, "$srpm build ok");
}
if ($run{debug}) {
@@ -882,15 +883,19 @@ retry:
} else {
# drop packages and logs if we only want failure logs
if ($run{delete_on_success}) {
- system("rm -rf $local_spool/log/$srpm/");
+ system("rm -rf $log_dir");
} elsif (!$run{discard_packages}) {
plog('OK', "build successful, copying packages to $local_spool.");
if (system("cp $chroot_tmp/home/$luser/rpmbuild/RPMS/*/*.rpm $local_spool &>/dev/null")) {
# If copy fails (like disk full), report a failure and delete partially copied files
plog('ERROR', "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpmbuild/RPMS/ to $local_spool ($!)");
foreach my $package (@packages) {
+ $package =~ s|.*/||;
unlink "$local_spool/$package";
}
+ } else {
+ my $packagesfile = "$log_dir/packages.$run{my_arch}.$run{run}.log";
+ output($packagesfile, sort(map { m|([^/]*)$|; "$1\n" } @packages));
}
}
@@ -1082,11 +1087,9 @@ sub check_pid {
my $state = `ps h -o state $pid`;
chomp $state;
if ($time < time()-36000 || $state eq 'Z') {
- my $msg = "an other iurt pid $pid is running for a very long time or is zombie, killing it";
- plog($msg);
+ plog("an other iurt pid $pid is running for a very long time or is zombie, killing it");
my $i;
while ($i < 5 && getpgrp $pid != -1) {
- set_alarm_message($msg);
kill_for_good($pid);
$i++;
sleep 1;