aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcelo Leitner <mrl@mandriva.com>2007-09-04 16:20:58 +0000
committerMarcelo Leitner <mrl@mandriva.com>2007-09-04 16:20:58 +0000
commit77628f7a30edac08d38ca9f8b008608e5db98c86 (patch)
tree8f5bc2f22761286a390e9265ff1369acd9a6e964 /lib
parentd28c1b6a22d641e0ce1cc65a4c152eb17b7080a2 (diff)
downloadiurt-77628f7a30edac08d38ca9f8b008608e5db98c86.tar
iurt-77628f7a30edac08d38ca9f8b008608e5db98c86.tar.gz
iurt-77628f7a30edac08d38ca9f8b008608e5db98c86.tar.bz2
iurt-77628f7a30edac08d38ca9f8b008608e5db98c86.tar.xz
iurt-77628f7a30edac08d38ca9f8b008608e5db98c86.zip
- Applies Blino's fix for removing chroot tarball if its build failed.
- Enhance checking if the build failed by also checking if /usr/lib/rpm/rpmb is in place. - Scream and shout something when aborting due to this reason.
Diffstat (limited to 'lib')
-rw-r--r--lib/Iurt/Chroot.pm52
1 files changed, 28 insertions, 24 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 5167e93..d80fc1b 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -431,6 +431,7 @@ sub create_chroot {
$rebuild = 1;
if (!build_chroot($run, $config, $tmp_chroot, $chroot_tar, $opt)) {
$clean->();
+ sudo($run, $config, '--rm', '-r', $chroot, $chroot_tar);
return;
}
} else {
@@ -528,31 +529,34 @@ sub build_chroot {
@{$opt->{packages}}
);
- # FIXME: <mrl> A proper warn could be given here, instead of aborting silently.
- if (-f "$tmp_chroot/bin/rpm") {
- system($sudo, 'sh', '-c', "chroot $tmp_chroot rpm -qa --qf '\%{NAME}-\%{VERSION}-\%{RELEASE}.\%{ARCH}.rpm\n' > $tmp_chroot/var/log/qa");
- #
- # CM: Choose a sub-500 uid to prevent collison with $luser
- #
- system($sudo, 'chroot', $tmp_chroot, 'adduser', '-o', '--uid', 499, 'builder');
- sudo($run, $config, "--mkdir", "-p", "$tmp_chroot/home/builder/rpm");
- foreach my $p (qw(RPMS BUILD SPECS SRPMS SOURCES tmp)) {
- -d "$tmp_chroot/home/builder/rpm/$p" and next;
- sudo($run, $config, "--mkdir", "$tmp_chroot/home/builder/rpm/$p");
- }
- system($sudo, 'chown', '-R', 499, "$tmp_chroot/home/builder");
- # FIXME: <mrl> Be careful! Damn ugly hack right below!
- 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, '.');
+ # Yes, /usr/lib/rpm/rpmb even for x86_64
+ if (! -f "$tmp_chroot/bin/rpm" || ! -f "$tmp_chroot/usr/lib/rpm/rpmb") {
+ plog('ERROR', "Base packages missing in genenrated chroot.");
+ return 0;
+ }
+
+ system($sudo, 'sh', '-c', "chroot $tmp_chroot rpm -qa --qf '\%{NAME}-\%{VERSION}-\%{RELEASE}.\%{ARCH}.rpm\n' > $tmp_chroot/var/log/qa");
+ #
+ # CM: Choose a sub-500 uid to prevent collison with $luser
+ #
+ system($sudo, 'chroot', $tmp_chroot, 'adduser', '-o', '--uid', 499, 'builder');
+ sudo($run, $config, "--mkdir", "-p", "$tmp_chroot/home/builder/rpm");
+ foreach my $p (qw(RPMS BUILD SPECS SRPMS SOURCES tmp)) {
+ -d "$tmp_chroot/home/builder/rpm/$p" and next;
+ sudo($run, $config, "--mkdir", "$tmp_chroot/home/builder/rpm/$p");
+ }
+ system($sudo, 'chown', '-R', 499, "$tmp_chroot/home/builder");
+ # FIXME: <mrl> Be careful! Damn ugly hack right below!
+ 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, '.');
}
sub check_build_chroot {