aboutsummaryrefslogtreecommitdiffstats
path: root/iurt2
diff options
context:
space:
mode:
Diffstat (limited to 'iurt2')
-rwxr-xr-xiurt269
1 files changed, 52 insertions, 17 deletions
diff --git a/iurt2 b/iurt2
index a2674fb..538358f 100755
--- a/iurt2
+++ b/iurt2
@@ -479,14 +479,25 @@ if (-f $cachefile && $run{use_cache}) {
}
if ($clear_cache) {
- $cache = { rpm_srpm => {}, failure => {}, queue => {}, warning => {}, run => 1, needed => {}, no_unionfs => {} }
+ $cache = {
+ rpm_srpm => {},
+ failure => {},
+ queue => {},
+ warning => {},
+ run => 1,
+ needed => {},
+ no_unionfs => {}
+ }
}
$run{cache} = $cache;
my (%srpm_version, @wrong_rpm, %provides, %pack_provide, $to_compile, %maint);
$to_compile = @{$run{todo}};
-$to_compile += check_media(\%run, $cache, $config, \%srpm_version, \@wrong_rpm, \%provides, \%pack_provide, \%maint) if $run{media};
-$to_compile += search_packages(1, $cache, \%provides, \%run, \%maint, \%srpm_version, @{$run{extra_dir}}) if $run{extra};
+$to_compile += check_media(\%run, $cache, $config, \%srpm_version,
+ \@wrong_rpm, \%provides, \%pack_provide, \%maint) if $run{media};
+$to_compile += search_packages(1, $cache, \%provides, \%run, \%maint,
+ \%srpm_version, @{$run{extra_dir}}) if $run{extra};
+
my $dkms;
if ($run{dkms}) {
$dkms = Iurt::DKMS->new(run => \%run, config => $config);
@@ -510,6 +521,7 @@ $run{daydate} = $daydate;
plog(5, "using $run{run} as chroot extension");
$run{user} = $ENV{SUDO_USER} || $ENV{USER};
$run{uid} = getpwnam $run{user};
+
plog(3, "using local user $run{user}, id $run{uid}");
my $luser = $run{user} || 'builder';
@@ -572,11 +584,16 @@ if ($df->{per} >= 99) {
}
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";
+ ($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->urpmi_command($chroot_tmp, $luser);
- $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";
+
+ $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}) {
plog("dumping to a chrooted shell into $chroot_tmp");
@@ -618,7 +635,8 @@ $run{group} = 0 if @{$run{todo}} == 1;
if ($run{group}) {
$rebuild = 1;
$urpmi->set_local_media($local_spool);
- $urpmi->order_packages($union_id, \%provides, $luser) or die "FATAL $program_name: could not order packages";
+ $urpmi->order_packages($union_id, \%provides, $luser)
+ or die "FATAL $program_name: could not order packages";
}
do {
$rebuild = 0;
@@ -638,15 +656,17 @@ do {
plog("packages $srpm [$done/$to_compile]");
# FIXME unfortunately urpmi stalls quite often
my $retry = 0;
- #
- # current rpm is sometime segfaulting, and iurt is them blocked and cannot
+
+ # current rpm is sometime segfaulting, and iurt is them blocked
+ # and cannot
#
# $cache->{failure}{$srpm} = 1;
# dump_cache(\%run);
- retry:
+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);
@@ -667,7 +687,8 @@ do {
add_local_user($chroot_tmp, \%run, $config, $luser, $run{uid}) or next;
my $old_srpm = $srpm;
- my ($ret, $srpm, $spec) = $urpmi->recreate_srpm(\%run, $config, $chroot_tmp, $dir, $srpm, $luser, $retry);
+ my ($ret, $srpm, $spec) = $urpmi->recreate_srpm(\%run, $config,
+ $chroot_tmp, $dir, $srpm, $luser, $retry);
if ($ret == -1) {
$retry = 1;
goto retry
@@ -679,9 +700,11 @@ do {
plog(1, "installing build dependencies of $srpm...");
my $path_srpm = "$chroot_tmp/home/$luser/rpm/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
+
+ # 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 => $maintainer }, "$path_srpm/$srpm");
if (!$ok) {
$run{status}{$srpm} ||= 'install_deps_failure';
@@ -755,6 +778,7 @@ do {
1
},
freq => 1)) {
+
# FIXME
# The simple algo used here is :
# try to compile it with unionfs, if it runs out of space, compile it without the next time
@@ -766,7 +790,7 @@ do {
# Maybe the right thing to do would be to first try to increase the tmpfs size (more than 50 % of the
# physical RAM), but this will lead to more swap usage, and slower compilation (and lost of the unionfs
# plus). Or to keep the faulty package a unionfs exception for some time, to save some more extra builds.
- #
+
if (!glob "$chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm") {
if ($run{unionfs_tmp} && $cache->{no_unionfs}{$srpm}) {
goto retry
@@ -779,6 +803,7 @@ do {
next
}
}
+
# do some cleaning if the compilation is successful
delete $cache->{needed}{$srpm} if defined $cache->{needed}{$srpm};
delete $cache->{buildrequires}{$srpm} if defined $cache->{buildrequires}{$srpm};
@@ -791,7 +816,10 @@ do {
opendir my $rpmfh, "$chroot_tmp/home/$luser/rpm/RPMS/$bindir";
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
+
+ # 20060810 warly We should fail here, but rpm is currently
+ # segfaulting when trying to install packages
+
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 {
@@ -869,7 +897,14 @@ if ($run{unionfs}) {
remove_chroot(\%run, $unionfs_dir, \&clean_all_unionfs)
}
unlink "$run{pidfile_home}/$run{pidfile}" if $run{pidfile};
+
exit;
+
+
+#
+#
+#
+
sub check_needed {
my ($srpm, $cache, $provides) = @_;
if (!defined $cache->{needed}{$srpm} && !ref $cache->{needed}{$srpm}) { return 1 }