Mercurial > hg > octave-nkf
changeset 14471:d2c095e45196
maint: Remove redundant private function from the package manager.
* pkg/private/rm_rf.m: remove file.
* pkg/provate/build.m: remove calls to rm_rf.
* pkg/provate/configure_make.m: remove calls to rm_rf.
* pkg/provate/copy_files.m: remove calls to rm_rf.
* pkg/provate/finish_installation.m: remove calls to rm_rf.
* pkg/provate/install.m: remove calls to rm_rf.
* pkg/provate/packinfo_copy_file.m: remove calls to rm_rf.
* pkg/provate/prepare_installation.m: remove calls to rm_rf.
* pkg/provate/repackage.m: remove calls to rm_rf.
* pkg/provate/uninstall.m: remove calls to rm_rf.
author | Carlo de Falco <kingcrimson@tiscali.it> |
---|---|
date | Fri, 16 Mar 2012 18:55:09 +0100 |
parents | aad7ad0e15c1 |
children | 045a5b85495d |
files | scripts/pkg/module.mk scripts/pkg/pkg.m scripts/pkg/private/build.m scripts/pkg/private/configure_make.m scripts/pkg/private/copy_files.m scripts/pkg/private/finish_installation.m scripts/pkg/private/install.m scripts/pkg/private/packinfo_copy_file.m scripts/pkg/private/prepare_installation.m scripts/pkg/private/repackage.m scripts/pkg/private/rm_rf.m scripts/pkg/private/uninstall.m |
diffstat | 12 files changed, 43 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/pkg/module.mk +++ b/scripts/pkg/module.mk @@ -34,7 +34,6 @@ pkg/private/print_package_description.m \ pkg/private/rebuild.m \ pkg/private/repackage.m \ - pkg/private/rm_rf.m \ pkg/private/save_order.m \ pkg/private/shell.m \ pkg/private/uninstall.m \
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -268,6 +268,9 @@ persistent local_list = tilde_expand (fullfile ("~", ".octave_packages")); persistent global_list = fullfile (OCTAVE_HOME (), "share", "octave", "octave_packages"); + + confirm_recursive_rmdir (false, "local"); + mlock (); global_install = issuperuser ();
--- a/scripts/pkg/private/build.m +++ b/scripts/pkg/private/build.m @@ -51,7 +51,7 @@ unwind_protect_cleanup unload_packages ({"all"}, handle_deps, buildlist, ""); if (exist (installdir, "dir")) - rm_rf (installdir); + rmdir (installdir, "s"); endif if (exist (buildlist, "file")) unlink (buildlist);
--- a/scripts/pkg/private/configure_make.m +++ b/scripts/pkg/private/configure_make.m @@ -56,7 +56,7 @@ "./configure --prefix=\"", desc.dir, "\"", flags)); if (status != 0) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("the configure script returned the following error: %s", output); elseif (verbose) printf("%s", output); @@ -68,7 +68,7 @@ if (exist (fullfile (src, "Makefile"), "file")) [status, output] = shell (cstrcat (scenv, "make -C '", src, "'")); if (status != 0) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("'make' returned the following error: %s", output); elseif (verbose) printf("%s", output); @@ -134,7 +134,7 @@ endif [status, output] = copyfile (archindependent, instdir); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("Couldn't copy files from 'src' to 'inst': %s", output); endif endif @@ -149,7 +149,7 @@ endif [status, output] = copyfile (archdependent, archdir); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("Couldn't copy files from 'src' to 'inst': %s", output); endif endif
--- a/scripts/pkg/private/copy_files.m +++ b/scripts/pkg/private/copy_files.m @@ -40,7 +40,7 @@ if (! dirempty (instdir)) [status, output] = copyfile (fullfile (instdir, "*"), desc.dir); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("couldn't copy files to the installation directory"); endif if (exist (fullfile (desc.dir, getarch ()), "dir") @@ -55,39 +55,39 @@ if (! exist (octm3, "dir")) [status, output] = mkdir (octm3); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("couldn't create installation directory %s : %s", octm3, output); endif endif [status, output] = mkdir (octm2); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("couldn't create installation directory %s : %s", octm2, output); endif endif [status, output] = mkdir (octm1); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("couldn't create installation directory %s : %s", octm1, output); endif endif [status, output] = mkdir (octfiledir); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("couldn't create installation directory %s : %s", octfiledir, output); endif endif [status, output] = movefile (fullfile (desc.dir, getarch (), "*"), octfiledir); - rm_rf (fullfile (desc.dir, getarch ())); + rmdir (fullfile (desc.dir, getarch ()), "s"); if (status != 1) - rm_rf (desc.dir); - rm_rf (octfiledir); + rmdir (desc.dir, "s"); + rmdir (octfiledir, "s"); error ("couldn't copy files to the installation directory"); endif endif @@ -98,8 +98,8 @@ packinfo = fullfile (desc.dir, "packinfo"); [status, msg] = mkdir (packinfo); if (status != 1) - rm_rf (desc.dir); - rm_rf (octfiledir); + rmdir (desc.dir, "s"); + rmdir (octfiledir, "s"); error ("couldn't create packinfo directory: %s", msg); endif @@ -119,8 +119,8 @@ write_index (desc, fullfile (packdir, "inst"), fullfile (packinfo, "INDEX"), global_install); catch - rm_rf (desc.dir); - rm_rf (octfiledir); + rmdir (desc.dir, "s"); + rmdir (octfiledir, "s"); rethrow (lasterror ()); end_try_catch endif
--- a/scripts/pkg/private/finish_installation.m +++ b/scripts/pkg/private/finish_installation.m @@ -33,8 +33,8 @@ cd (wd); catch cd (wd); - rm_rf (desc.dir); - rm_rf (getarchdir (desc), global_install); + rmdir (desc.dir, "s"); + rmdir (getarchdir (desc), "s"); rethrow (lasterror ()); end_try_catch endif
--- a/scripts/pkg/private/install.m +++ b/scripts/pkg/private/install.m @@ -144,7 +144,7 @@ catch ## Something went wrong, delete tmpdirs. for i = 1:length (tmpdirs) - rm_rf (tmpdirs{i}); + rmdir (tmpdirs{i}, "s"); endfor rethrow (lasterror ()); end_try_catch @@ -198,7 +198,7 @@ catch ## Something went wrong, delete tmpdirs. for i = 1:length (tmpdirs) - rm_rf (tmpdirs{i}); + rmdir (tmpdirs{i}, "s"); endfor rethrow (lasterror ()); end_try_catch @@ -217,7 +217,7 @@ catch ## Something went wrong, delete tmpdirs. for i = 1:length (tmpdirs) - rm_rf (tmpdirs{i}); + rmdir (tmpdirs{i}, "s"); endfor rethrow (lasterror ()); end_try_catch @@ -236,11 +236,11 @@ catch ## Something went wrong, delete tmpdirs. for i = 1:length (tmpdirs) - rm_rf (tmpdirs{i}); + rmdir (tmpdirs{i}, "s"); endfor for i = 1:length (descriptions) - rm_rf (descriptions{i}.dir); - rm_rf (getarchdir (descriptions{i})); + rmdir (descriptions{i}.dir, "s"); + rmdir (getarchdir (descriptions{i}), "s"); endfor rethrow (lasterror ()); end_try_catch @@ -251,8 +251,8 @@ if (dirempty (descriptions{i}.dir, {"packinfo", "doc"}) && dirempty (getarchdir (descriptions{i}))) warning ("package %s is empty\n", descriptions{i}.name); - rm_rf (descriptions{i}.dir); - rm_rf (getarchdir (descriptions{i})); + rmdir (descriptions{i}.dir, "s"); + rmdir (getarchdir (descriptions{i}), "s"); descriptions(i) = []; endif endfor @@ -296,10 +296,10 @@ catch ## Something went wrong, delete tmpdirs. for i = 1:length (tmpdirs) - rm_rf (tmpdirs{i}); + rmdir (tmpdirs{i}, "s"); endfor for i = 1:length (descriptions) - rm_rf (descriptions{i}.dir); + rmdir (descriptions{i}.dir, "s"); endfor if (global_install) printf ("error: couldn't append to %s\n", global_list); @@ -311,8 +311,8 @@ ## All is well, let's clean up. for i = 1:length (tmpdirs) - [status, msg] = rm_rf (tmpdirs{i}); - if (status != 1) + [status, msg] = rmdir (tmpdirs{i}, "s"); + if (status != 1 && exist (tmpdirs{i}, "dir")) warning ("couldn't clean up after my self: %s\n", msg); endif endfor
--- a/scripts/pkg/private/packinfo_copy_file.m +++ b/scripts/pkg/private/packinfo_copy_file.m @@ -30,8 +30,8 @@ else [status, output] = copyfile (filepath, packinfo); if (status != 1) - rm_rf (desc.dir); - rm_rf (octfiledir); + rmdir (desc.dir, "s"); + rmdir (octfiledir, "s"); error ("Couldn't copy %s file: %s", filename, output); endif endif
--- a/scripts/pkg/private/prepare_installation.m +++ b/scripts/pkg/private/prepare_installation.m @@ -41,7 +41,7 @@ if (! exist (inst_dir, "dir")) [status, msg] = mkdir (inst_dir); if (status != 1) - rm_rf (desc.dir); + rmdir (desc.dir, "s"); error ("the 'inst' directory did not exist and could not be created: %s", msg); endif
--- a/scripts/pkg/private/repackage.m +++ b/scripts/pkg/private/repackage.m @@ -82,7 +82,7 @@ end_try_catch unwind_protect_cleanup if (exist (pack.name, "dir")) - rm_rf (pack.name); + rmdir (pack.name, "s"); endif cd (wd); end_unwind_protect
deleted file mode 100644 --- a/scripts/pkg/private/rm_rf.m +++ /dev/null @@ -1,41 +0,0 @@ -## Copyright (C) 2005-2012 S�ren Hauberg -## Copyright (C) 2010 VZLU Prague, a.s. -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {[@var{status_out}, @var{msg_out}] =}@ -## rm_rf (@var{dir}) -## Undocumented internal function. -## @end deftypefn - -function [status_out, msg_out] = rm_rf (dir) - if (exist (dir)) - crr = confirm_recursive_rmdir (false, "local"); - [status, msg] = rmdir (dir, "s"); - else - status = 1; - msg = ""; - endif - if (nargout > 0) - status_out = status; - endif - if (nargout > 1) - msg_out = msg; - endif -endfunction -
--- a/scripts/pkg/private/uninstall.m +++ b/scripts/pkg/private/uninstall.m @@ -112,16 +112,16 @@ endif endif if (exist (desc.dir, "dir")) - [status, msg] = rm_rf (desc.dir); - if (status != 1) + [status, msg] = rmdir (desc.dir, "s"); + if (status != 1 && exist (desc.dir, "dir")) error ("couldn't delete directory %s: %s", desc.dir, msg); endif - [status, msg] = rm_rf (getarchdir (desc)); - if (status != 1) + [status, msg] = rmdir (getarchdir (desc), "s"); + if (status != 1 && exist (getarchdir (desc), "dir")) error ("couldn't delete directory %s: %s", getarchdir (desc), msg); endif if (dirempty (desc.archprefix)) - rm_rf (desc.archprefix); + rmdir (desc.archprefix, "s"); endif else warning ("directory %s previously lost", desc.dir);