aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2012-03-17 23:42:31 +0000
committerPascal Terjan <pterjan@mageia.org>2012-03-17 23:42:31 +0000
commitc2dd485df635e6be732c1623fa7ebf841302340f (patch)
tree59d54956a3b894eccd98ff01b3dbf2a6789ea885
parente5fefd376242c7024cce11b6b2e62749aed53bd9 (diff)
downloadiurt-c2dd485df635e6be732c1623fa7ebf841302340f.tar
iurt-c2dd485df635e6be732c1623fa7ebf841302340f.tar.gz
iurt-c2dd485df635e6be732c1623fa7ebf841302340f.tar.bz2
iurt-c2dd485df635e6be732c1623fa7ebf841302340f.tar.xz
iurt-c2dd485df635e6be732c1623fa7ebf841302340f.zip
Kill unionfs support
-rwxr-xr-xiurt276
-rwxr-xr-xiurt_root_command4
-rw-r--r--lib/Iurt/Chroot.pm149
-rw-r--r--lib/Iurt/Config.pm4
-rw-r--r--lib/Iurt/Urpmi.pm9
5 files changed, 26 insertions, 216 deletions
diff --git a/iurt2 b/iurt2
index ec3ba89..405a93c 100755
--- a/iurt2
+++ b/iurt2
@@ -39,7 +39,7 @@ use URPM;
use Iurt::DKMS;
use Iurt::Urpmi;
-use Iurt::Chroot qw(add_local_user create_temp_chroot remove_chroot clean_unionfs clean_all_unionfs clean_all_chroot_tmp check_build_chroot clean_chroot);
+use Iurt::Chroot qw(add_local_user create_temp_chroot remove_chroot clean_all_chroot_tmp check_build_chroot clean_chroot);
use Iurt::Process qw(perform_command clean kill_for_good sudo);
use Iurt::Mail qw(sendmail);
use Iurt::Util qw(plog_init plog);
@@ -92,8 +92,8 @@ $run{todo} = [];
#
[ "", $program_name, 0, "[--cache] [--chrooted-urpmi <media prefix>] [--concurrent-run] [--config foo value] [--warn] [--verbose integer]
[--copy-srpm] [--debug] [--distro] [--no-rsync] [--clean user1 user2 user3] [--clean-all] [--shell] [--stop {p|c|i|l|b|a|s}]
- [--use-system-distrib] [--dir] [--help foo?] [--log filename] [--group] [--unionfs]
- [--upload [--markrelease] [--source]] [--dir] [--help foo?] [--log filename] [--unionfs] [--status] [--ignore-failure]
+ [--use-system-distrib] [--dir] [--help foo?] [--log filename] [--group]
+ [--upload [--markrelease] [--source]] [--dir] [--help foo?] [--log filename] [--status] [--ignore-failure]
[--repository <distribution path>]
[--rpmmacros <macro definition> [<macro definition>...]]
{--config_help | --dkms {--media <media regexp>}
@@ -193,9 +193,6 @@ $run{todo} = [];
[ "", "ignore-failure", 0, "",
"Do not take into account the failure cache, try to recompile all the packages not synchronized",
sub { $run{ignore_failure} = 1 }, "Activating the mode ignoring previous failure" ],
- [ "u", "unionfs", 0, "",
- "Activate unionfs mode",
- sub { $run{unionfs} = 1 }, "Activating unionfs mode" ],
[ "l", "log", 1, "<log file>",
"Log file.",
sub {
@@ -650,7 +647,6 @@ if ($clear_cache) {
warning => {},
run => 1,
needed => {},
- no_unionfs => {}
};
}
$run{cache} = $cache;
@@ -695,22 +691,10 @@ check_sudo_access()
my $debug_tag = $run{debug} && '_debug';
$run{debug_tag} = $debug_tag;
-if ($run{unionfs} && !$run{use_old_chroot}) {
- plog(1, "adding unionfs module");
- 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);
- $run{unionfs_dir} = "$run{unionfs_dir}/$run{user}/";
- -d $run{unionfs_dir} or mkdir $run{unionfs_dir};
- }
-}
my (%done, $done);
$run{done} = \%done;
my $home = $config->{local_home};
-my $union_id = 1;
-$run{unionfs_tmp} = $run{unionfs};
my ($chroot_name, $chroot_tmp, $chroot, $chroot_tar);
$chroot_name = "chroot_$run{distro_tag}$debug_tag.$run{my_arch}";
@@ -762,8 +746,8 @@ if ($df->{per} >= 99) {
if ($run{shell}) {
if (!$run{use_old_chroot}) {
- ($union_id, my $chroot_tmp) = create_temp_chroot(\%run, $config,
- $cache, $union_id, $chroot_tmp, $chroot_tar)
+ my $chroot_tmp = create_temp_chroot(\%run, $config,
+ $cache, $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";
@@ -816,7 +800,7 @@ $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)
+ $urpmi->order_packages(\%provides, $luser)
or die "FATAL $program_name: could not order packages";
}
#
@@ -860,9 +844,8 @@ retry:
$urpmi->clean_urpmi_process;
if (!$run{use_old_chroot}) {
- (my $u_id, $chroot_tmp) = create_temp_chroot(\%run, $config,
- $cache, $union_id, $chroot_tmp, $chroot_tar, $srpm) or next;
- $union_id = $u_id;
+ $chroot_tmp = create_temp_chroot(\%run, $config,
+ $cache, $chroot_tmp, $chroot_tar, $srpm) or next;
}
if (!$urpmi->urpmi_command($chroot_tmp, $luser)) {
@@ -971,15 +954,7 @@ retry:
exit();
}
plog('DEBUG', "calling callback for $opt->{hash}");
- if ($run{unionfs_tmp} && $output =~ /no space left on device/i) {
- plog('ERROR', "ERROR: running out of space to compile $srpm in unionfs mode, will recompile it in normal mode");
- $cache->{no_unionfs}{$srpm} = 1;
- return 1;
- } elsif ($run{unionfs_tmp} && $output =~ m,$home,) {
- plog('ERROR', "ERROR: seems like building $srpm needs to access /proc/self/exe, which is broken with unionfs, will try to recompile it in non unionfs mode");
- $cache->{no_unionfs}{$srpm} = 1;
- return 1;
- } elsif ($output =~ /bin\/ld: cannot find -l(\S*)|configure.*error.* (?:-l([^\s]+)|([^\s]+) includes)/) {
+ if ($output =~ /bin\/ld: cannot find -l(\S*)|configure.*error.* (?:-l([^\s]+)|([^\s]+) includes)/) {
my $missing = $1;
my @rpm = find_provides(\%run, \%pack_provide, $missing);
plog(5, "likely @rpm ($missing-devel) needed to rebuilt $srpm is not in build_requires");
@@ -1004,26 +979,7 @@ retry:
},
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
- #
- # This could be improved in keeping this srpm name for future
- # version, but if we compile it on a new machine with more ram,
- # or if next version compiles just fine with unionfs, we will
- # loose the unionfs advantage.
- #
- # 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;
- }
$cache->{failure}{$srpm} = 1;
$run{status}{$srpm} = 'build_failure';
# 20060615
@@ -1091,7 +1047,7 @@ retry:
for (my $i; $i < @{$run{todo}}; $i++) {
my (undef, $srpm) = @{$run{todo}[$i]};
if (!$run{done}{$srpm}) {
- $rebuild = $urpmi->order_packages($union_id, \%provides, $luser);
+ $rebuild = $urpmi->order_packages(\%provides, $luser);
last;
}
}
@@ -1110,13 +1066,8 @@ retry:
}
} while $rebuild;
-my ($unionfs_dir) = $run{unionfs_dir} =~ m!(.*)/[^/]+/?!;
if (!$run{debug} && !$run{use_old_chroot}) {
- if ($run{unionfs}) {
- clean_unionfs("$unionfs_dir/$run{user}", \%run, $run{run}, $union_id);
- } else {
- clean_chroot($chroot_tmp, $chroot_tar, \%run, $config, 1);
- }
+ clean_chroot($chroot_tmp, $chroot_tar, \%run, $config, 1);
}
plog("reprocess generated packages queue");
process_queue($config, \%run, \@wrong_rpm);
@@ -1140,11 +1091,6 @@ if ($config->{rsync_to} && !$run{no_rsync}) {
system('rsync', '--delete', '-alHPe', 'ssh -xc arcfour', "$local_spool/log/", "$config->{rsync_to}/$run{distro_tag}/$run{my_arch}/$run{media}/log/");
}
-# one last try to clean
-plog('DEBUG', "clean remaining unionfs");
-if ($run{unionfs} && !$run{use_old_chroot}) {
- remove_chroot(\%run, $unionfs_dir, \&clean_all_unionfs);
-}
unlink "$run{pidfile_home}/$run{pidfile}" if $run{pidfile};
exit();
diff --git a/iurt_root_command b/iurt_root_command
index 544ddbc..b02f5ad 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -35,7 +35,7 @@ my $arg = @ARGV;
my (@params, %run);
$run{program_name} = $program_name;
-my %authorized_modules = ('unionfs' => 1);
+my %authorized_modules = ();
my %authorized_rw_bindmounts = (map { $_ => 1 } qw(/proc /dev/pts /var/cache/icecream));
$run{todo} = [];
@@ -213,7 +213,7 @@ sub mkdir {
my ($_run, $opt, @dir) = @_;
foreach my $path (@dir) {
-d $path and next;
- if ($path =~ m,/dev|/proc|/root|/var, && $path !~ /chroot|unionfs/) {
+ if ($path =~ m,/dev|/proc|/root|/var, && $path !~ /chroot/) {
plog('FAIL', "ERROR: $path creation forbidden");
}
if ($opt->{parents}) {
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index eb1bea5..77a1463 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -12,9 +12,7 @@ use File::Path 'mkpath';
our @EXPORT = qw(
clean_chroot_tmp
- clean_unionfs
clean_all_chroot_tmp
- clean_all_unionfs
clean_chroot
update_chroot
dump_rpmmacros
@@ -207,83 +205,17 @@ sub add_local_user {
}
sub create_temp_chroot {
- my ($run, $config, $cache, $union_id, $chroot_tmp, $chroot_tar, $o_srpm) = @_;
+ my ($run, $config, $cache, $chroot_tmp, $chroot_tar, $o_srpm) = @_;
my $home = $config->{local_home};
my $debug_tag = $run->{debug_tag};
- my $unionfs_dir = $run->{unionfs_dir};
-
- if ($run->{unionfs_tmp}) {
- my $mount_point = "$unionfs_dir/unionfs.$run->{run}.$union_id";
- plog(2, "cleaning temp chroot $mount_point");
- if (!clean_mnt($run, $mount_point, $run->{verbose})) {
- dump_cache_par($run);
- die "FATAL: can't kill remaining processes acceding $mount_point";
- }
- my $tmpfs;
-
- # we cannont just rm -rf $tmpfs, this create defunct processes
- # afterwards (and lock particularly hard the urpmi database)
- #
- $union_id = clean_unionfs($unionfs_dir, $run, $run->{run}, $union_id);
- $tmpfs = "$unionfs_dir/tmpfs.$run->{run}.$union_id";
- $chroot_tmp = "$unionfs_dir/unionfs.$run->{run}.$union_id";
-
- if (!-d $tmpfs) {
- if (!mkpath($tmpfs)) {
- plog("ERROR: Could not create $tmpfs ($!)");
- return;
- }
- }
- if (! -d $chroot_tmp) {
- if (!mkpath($chroot_tmp)) {
- plog("ERROR: Could not create $chroot_tmp ($!)");
- return;
- }
- }
- if ($cache->{no_unionfs}{$o_srpm}) {
- $run->{unionfs_tmp} = 0;
- clean_chroot($chroot_tmp, $chroot_tar, $run, $config);
- } else {
- # if the previous package has been built without unionfs, chroot need to be cleaned
- if (!$run->{unionfs_tmp}) {
- clean_chroot($chroot_tmp, $chroot_tar, $run, $config);
- } else {
- # only detar the chroot if not already
- clean_chroot($chroot_tmp, $chroot_tar, $run, $config, 0, 1);
- }
- $run->{unionfs_tmp} = 1;
- if (system(qq($sudo mount -t tmpfs none $tmpfs &>/dev/null))) {
- plog("ERROR: can't mount $tmpfs ($!)");
- return;
- }
- if (system(qq($sudo mount -o dirs=$tmpfs=rw:$home/chroot_$run->{distro_tag}$debug_tag=ro -t unionfs none $chroot_tmp &>/dev/null))) {
- plog("ERROR: can't mount $tmpfs and $home/chroot_$run->{distro_tag}$debug_tag with unionfs ($!)");
- return;
- }
- if (system("$sudo mount -t proc none $chroot_tmp/proc &>/dev/null")) {
- plog("ERROR: can't mount /proc in chroot $chroot_tmp ($!)");
- return;
- }
- if (!-d "$chroot_tmp/dev/pts") {
- if (sudo($run, $config, "--mkdir", "$chroot_tmp/dev/pts")) {
- plog("ERROR: can't create /dev/pts in chroot $chroot_tmp ($!)");
- return;
- }
- if (system($sudo, "mount", "-t", "devpts", "none", "$chroot_tmp/dev/pts &>/dev/null")) {
- plog("ERROR: can't mount /dev/pts in the chroot $chroot_tmp ($!)");
- return;
- }
- }
- }
- } else {
- plog("Install new chroot");
- plog('DEBUG', "... in $chroot_tmp");
- clean_chroot($chroot_tmp, $chroot_tar, $run, $config) or return;
- update_chroot($chroot_tmp, $run, $config);
- }
- $union_id, $chroot_tmp;
+ plog("Install new chroot");
+ plog('DEBUG', "... in $chroot_tmp");
+ clean_chroot($chroot_tmp, $chroot_tar, $run, $config) or return;
+ update_chroot($chroot_tmp, $run, $config);
+
+ $chroot_tmp;
}
sub remove_chroot {
@@ -329,53 +261,6 @@ sub clean_all_chroot_tmp {
closedir $dir;
}
-sub clean_unionfs {
- my ($unionfs_dir, $_run, $r, $union_id) = @_;
-
- -d "$unionfs_dir/unionfs.$r.$union_id" or return $union_id;
- plog(2, "cleaning unionfs $unionfs_dir/unionfs.$r.$union_id");
- my $nok = 1;
- my $path = "$unionfs_dir/unionfs.$r.$union_id";
-
- while ($nok) {
- $nok = 0;
- foreach my $fs ([ 'proc', 'proc' ], [ 'dev/pts', 'devpts' ]) {
- my ($dir, $type) = @$fs;
- if (-d "$path/$dir" && check_mounted("$path/$dir", $type)) {
- plog(1, "clean_unionfs: umounting $path/$dir\n");
- if (system("$sudo umount $path/$dir &>/dev/null")) {
- plog("ERROR: could not umount $path/$dir");
- }
- }
- }
- foreach my $t ('unionfs', 'tmpfs') {
- # unfortunately quite oftem the unionfs is busy and could not
- # be unmounted
-
- my $d = "$unionfs_dir/$t.$r.$union_id";
- if (-d $d && check_mounted($d, $t)) {
- $nok = 1;
- system("$sudo /sbin/fuser -k $d &> /dev/null");
- plog(3, "umounting $d");
- if (system(qq($sudo umount $d &> /dev/null))) {
- plog(2, "WARNING: could not umount $d ($!)");
- return $union_id + 1;
- }
- }
- }
- }
-
- foreach my $t ('unionfs', 'tmpfs') {
- my $d = "$unionfs_dir/$t.$r.$union_id";
- plog(2, "removing $d");
- if (system($sudo, 'rm', '-rf', $d)) {
- plog("ERROR: removing $d failed ($!)");
- return $union_id + 1;
- }
- }
- $union_id;
-}
-
sub clean_chroot_tmp {
my ($run, $chroot_dir, $dir) = @_;
my $d = "$chroot_dir/$dir";
@@ -590,24 +475,4 @@ sub check_chroot {
create_chroot($chroot, $chroot_tar, $run, $config, $opt);
}
-sub clean_all_unionfs {
- my ($run, $unionfs_dir) = @_;
-
- plog(2, "Cleaning old unionfs remaining dir in $unionfs_dir");
-
- my $dir;
- if (!opendir $dir, $unionfs_dir) {
- plog(0, "FATAL could not open $unionfs_dir ($!)");
- return;
- }
-
- foreach (readdir $dir) {
- /unionfs\.((?:0\.)?\d+)\.(\d*)$/ or next;
- clean_unionfs($unionfs_dir, $run, $1, $2);
- }
-
- closedir $dir;
-}
-
-
1;
diff --git a/lib/Iurt/Config.pm b/lib/Iurt/Config.pm
index 33d822f..0b27dc8 100644
--- a/lib/Iurt/Config.pm
+++ b/lib/Iurt/Config.pm
@@ -198,13 +198,13 @@ sub dump_cache_par {
plog('DEBUG', "loading cache file $filename");
$old_cache = eval(cat_($filename));
- foreach my $k ('rpm_srpm', 'failure', 'no_unionfs', 'queue', 'needed', 'warning', 'buildrequires') {
+ foreach my $k ('rpm_srpm', 'failure', 'queue', 'needed', 'warning', 'buildrequires') {
foreach my $rpm (%{$old_cache->{$k}}) {
$cache->{$k}{$rpm} ||= $old_cache->{$k}{$rpm};
}
}
}
- # $cache = { rpm_srpm => {}, failure => {}, queue => {}, warning => {}, run => 1, needed => {}, no_unionfs => {} }
+ # $cache = { rpm_srpm => {}, failure => {}, queue => {}, warning => {}, run => 1, needed => {} }
}
$Data::Dumper::Indent = 1;
$Data::Dumper::Terse = 1;
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm
index ad8709c..3ec70d3 100644
--- a/lib/Iurt/Urpmi.pm
+++ b/lib/Iurt/Urpmi.pm
@@ -294,7 +294,7 @@ sub get_local_provides {
}
sub get_build_requires {
- my ($self, $union_id, $luser) = @_;
+ my ($self, $luser) = @_;
my $run = $self->{run};
my $config = $self->{config};
my $cache = $run->{cache};
@@ -302,9 +302,8 @@ sub get_build_requires {
$run->{todo_requires} = {};
plog("get_build_requires");
- my ($u_id, $chroot_tmp) = create_temp_chroot($run, $config, $cache, $union_id, $run->{chroot_tmp}, $run->{chroot_tar}) or return;
+ my ($u_id, $chroot_tmp) = create_temp_chroot($run, $config, $cache, $run->{chroot_tmp}, $run->{chroot_tar}) or return;
add_local_user($chroot_tmp, $run, $config, $luser, $run->{uid}) or return;
- $union_id = $u_id;
my $urpm = new URPM;
foreach my $p (@{$run->{todo}}) {
@@ -322,7 +321,7 @@ sub get_build_requires {
}
sub order_packages {
- my ($self, $union_id, $provides, $luser) = @_;
+ my ($self, $provides, $luser) = @_;
my $run = $self->{run};
my @packages = @{$run->{todo}};
my $move;
@@ -330,7 +329,7 @@ sub order_packages {
plog(1, "order_packages");
get_local_provides($self) or return;
if (!$run->{todo_requires}) {
- get_build_requires($self, $union_id, $luser) or return;
+ get_build_requires($self, $luser) or return;
}
my %visit;
my %status;