aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2006-10-23 14:04:09 +0000
committerFlorent Villard <warly@mandriva.com>2006-10-23 14:04:09 +0000
commit5655c9cbc362fe8c735382defc18bc3875d1d248 (patch)
treedc13f92fbeedcbf1702d54614cd933f0c70ae109
parent8c12e81d75e1f90284d911420c46643b0c9bce26 (diff)
downloadiurt-5655c9cbc362fe8c735382defc18bc3875d1d248.tar
iurt-5655c9cbc362fe8c735382defc18bc3875d1d248.tar.gz
iurt-5655c9cbc362fe8c735382defc18bc3875d1d248.tar.bz2
iurt-5655c9cbc362fe8c735382defc18bc3875d1d248.tar.xz
iurt-5655c9cbc362fe8c735382defc18bc3875d1d248.zip
replace old srpm and use the new one; add a missing_dep status; stop if filesystem is 99% full; do not clean the chroot in debug mode
-rwxr-xr-xiurt250
1 files changed, 22 insertions, 28 deletions
diff --git a/iurt2 b/iurt2
index bc4e5fb..0e91932 100755
--- a/iurt2
+++ b/iurt2
@@ -28,6 +28,7 @@
# - add a --group option to compile a set of packages (in progress)
# - add a function to update a packages when it obviously need to be recompile
# - Maybe call the function from the initial todo list (thus making the argument ordering important)
+# - Change the packager tag in the chroot to have the one who submit the package
#
use strict;
use RPM4::Header;
@@ -47,7 +48,7 @@ use MDK::Common;
use Filesys::Df qw(df);
my $program_name = 'iurt2';
-my $VERSION = '0.5.15';
+my $VERSION = '0.5.19';
# sessing parameters
my $sudo = '/usr/bin/sudo';
my $arg = @ARGV;
@@ -342,17 +343,6 @@ if (!-d "$local_spool/log") {
}
$run{local_spool} = $local_spool;
-my $debug_tag = '_debug' if $run{debug};
-$run{debug_tag} = $debug_tag;
-my $chroot_name = "chroot_$run{distro_tag}$debug_tag";
-my $chroot = "$config->{local_home}/$chroot_name";
-$run{chroot_path} = $chroot;
-my $chroot_tar = "$chroot.$run{my_arch}.tar.gz";
-$run{chroot_tar} = $chroot_tar;
-if ($run{chroot} || !-d "$chroot/dev") {
- check_build_chroot($chroot, $chroot_tar, \%run, $config) or die "FATAL $program_name: could not prepare initial chroot"
-}
-
my $cache;
my $clear_cache = 1;
if (-f $cachefile && $run{use_cache}) {
@@ -411,20 +401,11 @@ my $luser = $run{user} || 'builder';
check_sudo_access() or die "FATAL $program_name: you need to have sudo access to run $program_name";
+my $debug_tag = '_debug' if $run{debug};
+$run{debug_tag} = $debug_tag;
if ($run{unionfs}) {
- # FIXME need to grep /proc/modules not ot try to load it if already loaded
- open my $modules, '/proc/modules';
- my $ok;
- while (my $m = <$modules>) {
- if ($m =~ /unionfs/) {
- $ok = 1;
- last
- }
- }
- if (!$ok) {
- print {$run{LOG}} "$program_name: adding unionfs module\n" if $run{verbose} > 0;
- system($sudo, "$config->{iurt_root_command}", "--modprobe", "unionfs") or $run{unionfs} = 0;
- }
+ print {$run{LOG}} "$program_name: adding unionfs module\n" if $run{verbose} > 0;
+ sudo(\%run, $config, "--modprobe", "unionfs") or $run{unionfs} = 0;
if ($run{unionfs}) {
$run{unionfs_dir} = "$config->{local_home}/iurt_unionfs$debug_tag/";
remove_chroot(\%run, $run{unionfs_dir}, \&clean_all_unionfs);
@@ -438,6 +419,7 @@ $run{done} = \%done;
my $home = $config->{local_home};
my $union_id = 1;
$run{unionfs_tmp} = $run{unionfs};
+my $chroot_name = "chroot_$run{distro_tag}$debug_tag";
my $chroot_tmp = "$config->{local_home}/chroot_tmp";
if (!-d $chroot_tmp) {
mkdir $chroot_tmp
@@ -458,11 +440,20 @@ if ($run{no_compile} || !@{$run{todo}} && !$run{debug} && !$run{shell} && !$run{
unlink "$run{pidfile_home}/$run{pidfile}" if $run{pidfile};
exit
}
+
+my $chroot = "$config->{local_home}/$chroot_name";
+$run{chroot_path} = $chroot;
+my $chroot_tar = "$chroot.$run{my_arch}.tar.gz";
+$run{chroot_tar} = $chroot_tar;
+if ($run{chroot} || !-d "$chroot/dev") {
+ check_build_chroot($chroot, $chroot_tar, \%run, $config) or die "FATAL $program_name: could not prepare initial chroot"
+}
+
print {$run{LOG}} "$program_name: running with pid $$\n";
$run{prefix} = get_prefix($luser);
my $df = df $home;
-if ($df->{per} == 100) {
+if ($df->{per} >= 99) {
die "FATAL $program_name: not enough space on the filesystem, only $df->{bavail} KB on $home, full at $df->{per}%"
}
@@ -556,6 +547,7 @@ do {
print {$run{LOG}} "$program_name: adding local user $luser into $chroot_tmp...\n" if $run{verbose};
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);
if ($ret == -1) {
$retry = 1;
@@ -571,7 +563,7 @@ do {
# 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';
+ $run{status}{$srpm} ||= 'install_deps_failure';
next;
}
# try to workarround the rpm -qa db4 error(2) from dbcursor->c_get: No such file or directory
@@ -702,6 +694,8 @@ do {
print {$run{LOG}} "$program_name: build successful, copying packages to $local_spool.\n";
system("cp $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm $local_spool &>/dev/null") and print {$run{LOG}} "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpm/RPMS/ to $local_spool ($!)\n";
if ($run{copy_srpm}) {
+ # replace the old srpm
+ unlink "$local_spool/$old_srpm";
system("cp $chroot_tmp/home/$luser/rpm/SRPMS/$srpm $local_spool &>/dev/null") and print {$run{LOG}} "ERROR: could not copy $srpm from $chroot_tmp/home/$luser/rpm/SRPMS/ to $local_spool ($!)\n";
}
process_queue($config, \%run, \@wrong_rpm, 1)
@@ -714,7 +708,7 @@ do {
}
} while ($rebuild);
-clean_chroot($chroot_tmp, $chroot_tar, \%run, $config, 1);
+clean_chroot($chroot_tmp, $chroot_tar, \%run, $config, 1) if !$run{debug};
print {$run{LOG}} "$program_name: reprocess generated packages queue\n" if $run{verbose};
process_queue($config, \%run, \@wrong_rpm);