From eddbbe3687116377bb5852eaa7c55d94cab80086 Mon Sep 17 00:00:00 2001 From: Marcelo Leitner Date: Fri, 8 Jun 2007 19:38:00 +0000 Subject: - Add support for icecream via option --icecream - Add support for external and intentional medias via --additional_media option - Fix local_spool hdlist detection while in group mode: hdlist.cz will never be a directory. - Fix TMP environment location at package building command. It must be inside sudo, otherelse sudo will strip it. --- lib/Iurt/Chroot.pm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'lib/Iurt/Chroot.pm') diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index c4b2f15..526263a 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -45,6 +45,12 @@ sub clean_chroot { if (-d $chroot && !$o_only_tar) { system("$sudo umount $chroot/proc &> /dev/null"); system("$sudo umount $chroot/dev/pts &> /dev/null"); + if ($run->{icecream}) { + system("$sudo umount $chroot/var/cache/icecream &> /dev/null"); + } + if (-d "$chroot/urpmi_medias/") { + system ("$sudo umount $chroot/urpmi_medias/*"); + } sudo($run, $config, '--rm', '-r', $chroot); } @@ -64,6 +70,26 @@ sub clean_chroot { dump_rpmmacros($run, $config, "$chroot/home/builder/.rpmmacros") or return; system("$sudo mount none -t proc $chroot/proc &>/dev/null") and return; system("$sudo mount none -t devpts $chroot/dev/pts &>/dev/null") and return; + if ($run->{icecream}) { + system("$sudo mkdir -p $chroot/var/cache/icecream"); + system("$sudo mount -o bind /var/cache/icecream $chroot/var/cache/icecream &>/dev/null") and return; + } + + my $count = 0; + foreach my $m (@{$run->{additional_media}}) { + if (($m =~ m/^(http:|ftp:)/)) { + next; + } + my $mount_point = "$chroot/urpmi_medias/$count"; + my $bind; + my ($url) = $m =~ s!^(http://|ftp://|file://)!!; + if (($m =~ m/^(file:)/)) { + $bind = "-o bind"; + } + system("$sudo mkdir -p $mount_point"); + system("$sudo mount $bind $url $mount_point") and return; + $count++; + } 1; } @@ -469,6 +495,12 @@ sub build_chroot { sudo($run, $config, "--rm", "$tmp_chroot/var/lib/rpm/__db*"); system("$sudo umount $tmp_chroot/proc &> /dev/null"); system("$sudo umount $tmp_chroot/dev/pts &> /dev/null"); + if ($run->{icecream}) { + system("$sudo umount $tmp_chroot/var/cache/icecream &> /dev/null"); + } + if (-d "$tmp_chroot/urpmi_medias/") { + system ("$sudo umount $tmp_chroot/urpmi_medias/*"); + } return !system($sudo, 'tar', 'czf', $chroot_tar, '-C', $tmp_chroot, '.'); } } -- cgit v1.2.1