aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Chroot.pm
diff options
context:
space:
mode:
authorMarcelo Leitner <mrl@mandriva.com>2007-06-27 13:08:36 +0000
committerMarcelo Leitner <mrl@mandriva.com>2007-06-27 13:08:36 +0000
commitee9500b0c30caf0bb066a50b98fa04e45c2f57ad (patch)
tree0eb00e7309b7e93f72d8140f61d0b6d083b03a2f /lib/Iurt/Chroot.pm
parentbf1314d97965db358a0faa79ccb03500cfef36d0 (diff)
downloadiurt-ee9500b0c30caf0bb066a50b98fa04e45c2f57ad.tar
iurt-ee9500b0c30caf0bb066a50b98fa04e45c2f57ad.tar.gz
iurt-ee9500b0c30caf0bb066a50b98fa04e45c2f57ad.tar.bz2
iurt-ee9500b0c30caf0bb066a50b98fa04e45c2f57ad.tar.xz
iurt-ee9500b0c30caf0bb066a50b98fa04e45c2f57ad.zip
- Enhance debug on chroot creation and prepare for chroot updates.
Diffstat (limited to 'lib/Iurt/Chroot.pm')
-rw-r--r--lib/Iurt/Chroot.pm47
1 files changed, 42 insertions, 5 deletions
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;
}