aboutsummaryrefslogtreecommitdiffstats
path: root/iurt2
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2006-01-18 08:58:54 +0000
committerFlorent Villard <warly@mandriva.com>2006-01-18 08:58:54 +0000
commit6ae76d63304c17cc298ee05c6dfecf75a49650e6 (patch)
tree7d7d8c538096422630394707cd86ba0fde0c17aa /iurt2
parentff76106f9413166b435e3896cb871ad134b4ae1e (diff)
downloadiurt-6ae76d63304c17cc298ee05c6dfecf75a49650e6.tar
iurt-6ae76d63304c17cc298ee05c6dfecf75a49650e6.tar.gz
iurt-6ae76d63304c17cc298ee05c6dfecf75a49650e6.tar.bz2
iurt-6ae76d63304c17cc298ee05c6dfecf75a49650e6.tar.xz
iurt-6ae76d63304c17cc298ee05c6dfecf75a49650e6.zip
- better chroot cleaning before start
- add rpm macros and mount proc in chroot in unionfs mode before starting compilation - redump a clean chroot when a packages has been build with no_unionfs flag
Diffstat (limited to 'iurt2')
-rwxr-xr-xiurt238
1 files changed, 25 insertions, 13 deletions
diff --git a/iurt2 b/iurt2
index 7879208..12fee78 100755
--- a/iurt2
+++ b/iurt2
@@ -25,6 +25,7 @@
#
# - use a cache (rpmctl cache for example) to find maintainer
# - Do not run if the hdlist are broken
+# - allow to force packages to rebuild iurt foo-2.3-1mdk.src.rpm
#
use strict;
use Hdlist;
@@ -87,6 +88,8 @@ $config->{distribution} ||= 'Mandriva Linux';
$config->{vendor} ||= 'Mandriva';
$config->{basesystem_media} ||= "$config->{repository}/$distro_version/$my_arch/media/main/";
$config->{all_media} ||= [ 'main', 'contrib' ];
+$config->{log_size_limit} ||= '100M';
+$config->{log_size_date} ||= '30';
$config->{upload} .= $distro_version;
$config->{upload} =~ s/community//g;
@@ -276,6 +279,7 @@ my $unionfs_dir;
if (!$nocheckchroot) {
print "iurt: checking basesystem tar\n";
system(qq{sudo pkill -9 -u root -f "urpmi $urpmi_options --root $chroot"});
+ clean_chroot($chroot, 1) or die "FATAL iurt: Could no prepare initial chroot";
perform_command("sudo $config->{install_chroot_binary} cooker $config->{basesystem_media} $chroot_tar $chroot 501 basesystem tar rpm-build",
mail => $config->{admin},
error => "[REBUILD] Creating the inital chroot for $distro_tag on $my_arch failed",
@@ -285,13 +289,12 @@ if (!$nocheckchroot) {
debug_mail => $debug,
die => 1);
- if ($unionfs) {
- clean_chroot($chroot) or die "FATAL iurt: Could no prepare initial chroot"
- }
} else {
dump_rpmmacros("$chroot/home/builder/.rpmmacros") or die "FATAL iurt: could not dump rpm macros"
}
if ($unionfs) {
+ dump_rpmmacros("$chroot/home/builder/.rpmmacros") or return;
+ system("sudo mount none -t proc $chroot/proc") and die "FATAL iurt: could not mount /proc in the chroot.";
$unionfs_dir = "$config->{local_home}/iurt_unionfs$debug_tag";
-d $unionfs_dir or mkdir $unionfs_dir
}
@@ -304,6 +307,7 @@ my $wait_limit;
my $done;
my $home = $config->{local_home};
my $union_id = 1;
+my $unionfs_tmp = $unionfs;
foreach (my $i ; $i < @todo; $i++) {
my ($dir, $srpm) = @{$todo[$i]};
$done{$srpm} and next;
@@ -318,13 +322,14 @@ foreach (my $i ; $i < @todo; $i++) {
dump_cache();
die "FATAL iurt: Could not have urpmi working !"
}
- my $unionfs_tmp;
+ my $need_chroot_cleaning;
if ($cache->{no_unionfs}{$srpm}) {
$unionfs_tmp = 0
} elsif ($unionfs) {
+ $need_chroot_cleaning = 1 if !$unionfs_tmp;
$unionfs_tmp = 1
}
- if ($unionfs_tmp) {
+ if ($unionfs_tmp && !$need_chroot_cleaning) {
my $mount_point = "$unionfs_dir/unionfs.$run.$union_id";
print STDERR "Cleaning $mount_point\n";
if (!clean_mnt($mount_point)) {
@@ -474,7 +479,9 @@ if (open my $file, ">$local_spool/log/wrong_srpm_names.log") {
}
if ($config->{rsync_to}) {
- system("rsync -alHPe 'ssh -c arcfour' $local_spool/log/ $config->{rsync_to}/$distro_tag/$my_arch/log/");
+ # remove some old and very big log files not to saturate the server
+ system(qq{find $local_spool/log/ -name "*.log" \( -size +$config->{log_size_limit} -or -mtime +$config->{log_size_date} \) -exec rm -f {} \;});
+ system("rsync --delete -alHPe 'ssh -c arcfour' $local_spool/log/ $config->{rsync_to}/$distro_tag/$my_arch/log/");
}
# one last try to clean
@@ -516,13 +523,17 @@ sub usage {
}
sub clean_chroot {
- my ($chroot) = @_;
- -d $chroot and perform_command("sudo rm -rf $chroot",
- mail => $config->{admin},
- error => "[REBUILD] Deleting of old chroot $chroot failed",
- hash => 'chroot_deletion',
- debug_mail => $debug,
- die => 1);
+ my ($chroot, $only_clean) = @_;
+ if (-d $chroot) {
+ system("sudo umount $chroot/proc");
+ perform_command("sudo rm -rf $chroot",
+ mail => $config->{admin},
+ error => "[REBUILD] Deleting of old chroot $chroot failed",
+ hash => 'chroot_deletion',
+ debug_mail => $debug,
+ die => 1);
+ }
+ return 1 if $only_clean;
mkdir $chroot;
perform_command("pushd $chroot && sudo tar xvf $chroot_tar",
mail => $config->{admin},
@@ -532,6 +543,7 @@ sub clean_chroot {
die => 1);
dump_rpmmacros("$chroot/home/builder/.rpmmacros") or return;
+ system("sudo mount none -t proc $chroot/proc") and return;
1
}