diff options
author | Marcelo Leitner <mrl@mandriva.com> | 2007-11-06 15:21:54 +0000 |
---|---|---|
committer | Marcelo Leitner <mrl@mandriva.com> | 2007-11-06 15:21:54 +0000 |
commit | deb2e54dfcd4819571645a9385d5088e06d5de89 (patch) | |
tree | 9bdd006a70f6a29be3de60eff771abffd057dfef /lib/Iurt/Chroot.pm | |
parent | 6b0e94d1dbaa392dab6df585ccf95f65cc9620f8 (diff) | |
download | iurt-deb2e54dfcd4819571645a9385d5088e06d5de89.tar iurt-deb2e54dfcd4819571645a9385d5088e06d5de89.tar.gz iurt-deb2e54dfcd4819571645a9385d5088e06d5de89.tar.bz2 iurt-deb2e54dfcd4819571645a9385d5088e06d5de89.tar.xz iurt-deb2e54dfcd4819571645a9385d5088e06d5de89.zip |
- Replace a chdir call with tar -C option and avoid further errors due to the
path change.
- Better syntax putting in evidence a duplicated code.
Diffstat (limited to 'lib/Iurt/Chroot.pm')
-rw-r--r-- | lib/Iurt/Chroot.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index d80fc1b..93c63cd 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -70,13 +70,22 @@ sub clean_chroot { mkdir $chroot; # various integrity checking - return 1 if $o_only_tar && -f "$chroot/home/builder/.rpmmacros" && -d "$chroot/home/builder" && -d "$chroot/proc"; + if ($o_only_tar + && -f "$chroot/home/builder/.rpmmacros" + && -d "$chroot/home/builder" + && -d "$chroot/proc") { + return 1; + } - chdir $chroot; - - system($sudo, 'tar', 'xf', $chroot_tar) and create_build_chroot($chroot, $chroot_tar, $run, $config); + # First try + if (system($sudo, 'tar', '-C', $chroot, '-xf', $chroot_tar)) { + create_build_chroot($chroot, $chroot_tar, $run, $config); + } - create_build_chroot($chroot, $chroot_tar, $run, $config) if !-d "$chroot/proc" || !-d "$chroot/home/builder"; + # <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"); |