aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2011-04-28 11:55:20 +0000
committerPascal Terjan <pterjan@mageia.org>2011-04-28 11:55:20 +0000
commitdd9fe45232d5d7713d1a589b966e18e2bf908f82 (patch)
tree41dfa3eadaa95cdfbb7a2c2c11b3566f69a26f79 /lib
parent84c4ac6ed24d8cfb52858136405ca3f43f96d98d (diff)
downloadiurt-dd9fe45232d5d7713d1a589b966e18e2bf908f82.tar
iurt-dd9fe45232d5d7713d1a589b966e18e2bf908f82.tar.gz
iurt-dd9fe45232d5d7713d1a589b966e18e2bf908f82.tar.bz2
iurt-dd9fe45232d5d7713d1a589b966e18e2bf908f82.tar.xz
iurt-dd9fe45232d5d7713d1a589b966e18e2bf908f82.zip
Improve error cases and fix previous commit (thanks blino)
Diffstat (limited to 'lib')
-rw-r--r--lib/Iurt/Chroot.pm21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 33a1ef3..b7b2f3b 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -77,19 +77,12 @@ sub clean_chroot {
return 1;
}
- # First try
- if (sudo($run, $config, '--untar', $chroot_tar, $chroot)) {
- create_build_chroot($chroot, $chroot_tar, $run, $config);
- } else {
- plog('ERROR', "Failed to untar chroot");
+ sudo($run, $config, '--untar', $chroot_tar, $chroot);
+ if (!create_build_chroot($chroot, $chroot_tar, $run, $config)) {
+ plog('ERROR', "Failed to create chroot");
return;
}
- # <mrl> 20071106 Second try?
- if (!-d "$chroot/proc" || !-d "$chroot/home/builder") {
- create_build_chroot($chroot, $chroot_tar, $run, $config);
- }
-
if (!dump_rpmmacros($run, $config, "$chroot/home/builder/.rpmmacros")) {
plog('ERROR', "Failed to dump macros");
return;
@@ -100,12 +93,15 @@ sub clean_chroot {
}
if (!sudo($run, $config, '--bindmount', "/dev/pts", "$chroot/dev/pts")) {
plog('ERROR', "Failed to mount dev/pts");
+ sudo($run, $config, "--umount", "$chroot/proc");
return;
}
if ($run->{icecream}) {
system("$sudo mkdir -p $chroot/var/cache/icecream");
if (!sudo($run, $config, '--bindmount', "/var/cache/icecream", "$chroot/var/cache/icecream")) {
plog('ERROR', "Failed to mount var/cache/icecream");
+ sudo($run, $config, "--umount", "$chroot/proc");
+ sudo($run, $config, "--umount", "$chroot/dev/pts");
return;
}
}
@@ -119,6 +115,11 @@ sub clean_chroot {
sudo($run, $config, '--mkdir', '-p', $mount_point);
if (!sudo($run, $config, '--bindmount', $url, $mount_point)) {
plog('ERROR', "Failed to mount $url on $mount_point");
+ sudo($run, $config, "--umount", "$chroot/proc");
+ sudo($run, $config, "--umount", "$chroot/dev/pts");
+ if ($run->{icecream}) {
+ sudo($run, $config, "--umount", "$chroot/var/cache/icecream");
+ }
return;
}
}