From ee9500b0c30caf0bb066a50b98fa04e45c2f57ad Mon Sep 17 00:00:00 2001 From: Marcelo Leitner Date: Wed, 27 Jun 2007 13:08:36 +0000 Subject: - Enhance debug on chroot creation and prepare for chroot updates. --- lib/Iurt/Chroot.pm | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'lib/Iurt/Chroot.pm') diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 338f40d..d8dcb42 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -16,6 +16,7 @@ our @EXPORT = qw( clean_all_chroot_tmp clean_all_unionfs clean_chroot + update_chroot dump_rpmmacros add_local_user create_temp_chroot @@ -77,12 +78,24 @@ sub clean_chroot { create_build_chroot($chroot, $chroot_tar, $run, $config) if !-d "$chroot/proc" || !-d "$chroot/home/builder"; - 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 (!dump_rpmmacros($run, $config, "$chroot/home/builder/.rpmmacros")) { + plog ('ERROR', "Failed to dump macros"); + return; + } + if (system("$sudo mount none -t proc $chroot/proc")) { + plog ('ERROR', "Failed to mount proc"); + return; + } + if (system("$sudo mount none -t devpts $chroot/dev/pts")) { + plog ('ERROR', "Failed to mount dev/pts"); + 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; + if (system("$sudo mount -o bind /var/cache/icecream $chroot/var/cache/icecream")) { + plog ('ERROR', "Failed to mount var/cache/icecream"); + return; + } } if ($run->{additional_media} && $run->{additional_media}{repository}) { @@ -93,12 +106,35 @@ sub clean_chroot { my $url = $rep; $url =~ s!^file://!!; system("$sudo mkdir -p $mount_point"); - system("$sudo mount -o bind $url $mount_point") and return; + if (system("$sudo mount -o bind $url $mount_point")) { + plog ('ERROR', "Failed to mount $url on $mount_point"); + return; + } } } 1; } +=head2 update_chroot($chroot, $run, $only_clean) + +Updates chroot +I<$chroot> chroot path +I<$run> is the running environment +I<%only_clean> only clean the chroot, do not create a new one +Return true. + +=cut + +sub clean_chroot { + my ($chroot, $chroot_tar, $run, $config, $o_only_clean, $o_only_tar) = @_; + + plog('DEBUG', "update chroot"); + +# my $urpmi = $run->{urpmi}; +# $urpmi->auto_select($chroot); + +} + sub dump_rpmmacros { my ($run, $config, $file) = @_; my $f; @@ -238,6 +274,7 @@ sub create_temp_chroot { plog("Install new chroot"); plog('DEBUG', "... in $chroot_tmp"); clean_chroot($chroot_tmp, $chroot_tar, $run, $config); + update_chroot($chroot_tmp, $run, $config); } $union_id, $chroot_tmp; } -- cgit v1.2.1