annotate scripts/pkg/private/uninstall.m @ 26376:00f796120a6d stable

maint: Update copyright dates in all source files.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Jan 2019 16:32:43 -0500
parents 3293cd2651fb
children 0cedd1e23c1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25787
diff changeset
1 ## Copyright (C) 2005-2019 Søren Hauberg
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
2 ## Copyright (C) 2010 VZLU Prague, a.s.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
3 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
4 ## This file is part of Octave.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
5 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
6 ## Octave is free software: you can redistribute it and/or modify it
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
8 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
9 ## (at your option) any later version.
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
10 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
14 ## GNU General Public License for more details.
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
15 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
18 ## <https://www.gnu.org/licenses/>.
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
19
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
20 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19933
diff changeset
21 ## @deftypefn {} {} uninstall (@var{pkgnames}, @var{handle_deps}, @var{verbose}, @var{local_list}, @var{global_list}, @var{global_install})
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
22 ## Undocumented internal function.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
23 ## @end deftypefn
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
24
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
25 function uninstall (pkgnames, handle_deps, verbose, local_list,
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
26 global_list, global_install)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 20852
diff changeset
27
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
28 ## Get the list of installed packages.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
29 [local_packages, global_packages] = installed_packages(local_list,
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
30 global_list);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
31 if (global_install)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
32 installed_pkgs_lst = {local_packages{:}, global_packages{:}};
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
33 else
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
34 installed_pkgs_lst = local_packages;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
35 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
36
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
37 num_packages = length (installed_pkgs_lst);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
38 delete_idx = [];
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
39 for i = 1:num_packages
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
40 cur_name = installed_pkgs_lst{i}.name;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
41 if (any (strcmp (cur_name, pkgnames)))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
42 delete_idx(end+1) = i;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
43 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
44 endfor
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
45
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
46 ## Are all the packages that should be uninstalled already installed?
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
47 if (length (delete_idx) != length (pkgnames))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
48 if (global_install)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
49 ## Try again for a locally installed package.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
50 installed_pkgs_lst = local_packages;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
51
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
52 num_packages = length (installed_pkgs_lst);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
53 delete_idx = [];
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
54 for i = 1:num_packages
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
55 cur_name = installed_pkgs_lst{i}.name;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
56 if (any (strcmp (cur_name, pkgnames)))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
57 delete_idx(end+1) = i;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
58 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
59 endfor
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
60 if (length (delete_idx) != length (pkgnames))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
61 ## FIXME: We should have a better error message.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
62 warning ("some of the packages you want to uninstall are not installed");
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
63 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
64 else
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
65 ## FIXME: We should have a better error message.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
66 warning ("some of the packages you want to uninstall are not installed");
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
67 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
68 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
69
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
70 if (isempty (delete_idx))
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
71 warning ("no packages will be uninstalled");
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
72 else
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
73
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
74 ## Compute the packages that will remain installed.
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
75 idx = setdiff (1:num_packages, delete_idx);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
76 remaining_packages = {installed_pkgs_lst{idx}};
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
77
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
78 ## Check dependencies.
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
79 if (handle_deps)
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
80 error_text = "";
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
81 for i = 1:length (remaining_packages)
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
82 desc = remaining_packages{i};
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
83 bad_deps = get_unsatisfied_deps (desc, remaining_packages);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
84
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
85 ## Will the uninstallation break any dependencies?
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
86 if (! isempty (bad_deps))
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
87 for i = 1:length (bad_deps)
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
88 dep = bad_deps{i};
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
89 error_text = [error_text " " desc.name " needs " ...
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
90 dep.package " " dep.operator " " dep.version "\n"];
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
91 endfor
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
92 endif
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
93 endfor
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
94
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
95 if (! isempty (error_text))
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
96 error ("the following dependencies where unsatisfied:\n %s", error_text);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
97 endif
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
98 endif
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
99
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
100 ## Delete the directories containing the packages.
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
101 for i = delete_idx
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
102 desc = installed_pkgs_lst{i};
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
103 ## If an 'on_uninstall.m' exist, call it!
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
104 if (exist (fullfile (desc.dir, "packinfo", "on_uninstall.m"), "file"))
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
105 wd = pwd ();
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
106 cd (fullfile (desc.dir, "packinfo"));
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
107 on_uninstall (desc);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
108 cd (wd);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
109 endif
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
110 ## Do the actual deletion.
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
111 if (desc.loaded)
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
112 rmpath (desc.dir);
25787
3293cd2651fb prefer 'isfolder' over 'exist (..., "dir")' in Octave functions
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
113 if (isfolder (getarchdir (desc)))
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
114 rmpath (getarchdir (desc));
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
115 endif
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
116 endif
25787
3293cd2651fb prefer 'isfolder' over 'exist (..., "dir")' in Octave functions
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
117 if (isfolder (desc.dir))
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
118 [status, msg] = rmdir (desc.dir, "s");
25787
3293cd2651fb prefer 'isfolder' over 'exist (..., "dir")' in Octave functions
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
119 if (status != 1 && isfolder (desc.dir))
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
120 error ("couldn't delete directory %s: %s", desc.dir, msg);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
121 endif
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
122 [status, msg] = rmdir (getarchdir (desc), "s");
25787
3293cd2651fb prefer 'isfolder' over 'exist (..., "dir")' in Octave functions
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
123 if (status != 1 && isfolder (getarchdir (desc)))
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
124 error ("couldn't delete directory %s: %s", getarchdir (desc), msg);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
125 endif
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
126 if (dirempty (desc.archprefix))
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
127 rmdir (desc.archprefix, "s");
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
128 endif
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
129 else
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
130 warning ("directory %s previously lost", desc.dir);
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
131 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
132 endfor
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
133
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
134 ## Write a new ~/.octave_packages.
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
135 if (global_install)
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
136 if (length (remaining_packages) == 0)
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
137 unlink (global_list);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
138 else
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
139 global_packages = save_order (remaining_packages);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
140 save (global_list, "global_packages");
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
141 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
142 else
19933
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
143 if (length (remaining_packages) == 0)
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
144 unlink (local_list);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
145 else
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
146 local_packages = save_order (remaining_packages);
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
147 save (local_list, "local_packages");
6670df97456c Check if pkgs were found to uninstall before attempting uninstall (Bug #44524).
John Donoghue
parents: 19697
diff changeset
148 endif
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
149 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
150 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
151
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
152 endfunction