diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-08-27 04:05:44 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-08-27 04:05:44 +0000 |
commit | 47f8dda3bfb5786615f047152102dcde8750bddd (patch) | |
tree | 8cdd3de56e3ffff031c9fe12abfa9c7ca5a7e916 /lib/Iurt/Chroot.pm | |
parent | 52dc0a0d04bd2b6d59d3edd5b0935501a62a1c22 (diff) | |
download | iurt-47f8dda3bfb5786615f047152102dcde8750bddd.tar iurt-47f8dda3bfb5786615f047152102dcde8750bddd.tar.gz iurt-47f8dda3bfb5786615f047152102dcde8750bddd.tar.bz2 iurt-47f8dda3bfb5786615f047152102dcde8750bddd.tar.xz iurt-47f8dda3bfb5786615f047152102dcde8750bddd.zip |
(clean_and_build_chroot) split it out of clean_chroot()
=> one less argument to clean_chroot()
(death to warlism where one add parameters to functions to make them
change behaviour depending on them...)
Diffstat (limited to 'lib/Iurt/Chroot.pm')
-rw-r--r-- | lib/Iurt/Chroot.pm | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 2fc59c0..488b53e 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -13,6 +13,7 @@ use urpm; our @EXPORT = qw( add_local_user + clean_and_build_chroot clean_chroot create_build_chroot create_temp_chroot @@ -22,18 +23,17 @@ our @EXPORT = qw( my $sudo = '/usr/bin/sudo'; -=head2 clean_chroot($chroot, $run, $only_clean) +=head2 clean_chroot($chroot, $run) Create or clean a 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_ref, $run, $config, $o_only_clean) = @_; + my ($chroot, $chroot_ref, $run, $config) = @_; plog('DEBUG', "clean chroot"); if (-d $chroot) { @@ -51,8 +51,23 @@ sub clean_chroot { delete_chroot($run, $config, $chroot); } + 0; +} + + +=head2 clean_and_build_chroot($chroot, $run) + +Create or clean a chroot +I<$chroot> chroot path +I<$run> is the running environment +Return true. - return 1 if $o_only_clean; +=cut + + +sub clean_and_build_chroot { + my ($chroot, $chroot_ref, $run, $config) = @_; + clean_chroot($chroot, $chroot_ref, $run, $config) and return 1; if (!create_build_chroot($chroot, $chroot_ref, $run, $config)) { plog('ERROR', "Failed to create chroot"); @@ -187,7 +202,7 @@ sub create_temp_chroot { plog("Install new chroot"); plog('DEBUG', "... in $chroot_tmp"); - clean_chroot($chroot_tmp, $chroot_ref, $run, $config) or return; + clean_and_build_chroot($chroot_tmp, $chroot_ref, $run, $config) or return; $chroot_tmp; } |