Mercurial > jwe > octave
annotate scripts/pkg/private/install.m @ 23084:ef4d915df748
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 23 Jan 2017 14:27:48 -0500 |
parents | 3a2b891d0b33 e9a0469dedd9 |
children | ef0909c445df |
rev | line source |
---|---|
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
21758
diff
changeset
|
1 ## Copyright (C) 2005-2016 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 ## |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
6 ## Octave is free software; you can redistribute it and/or modify it |
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 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
8 ## the Free Software Foundation; either version 3 of the License, or |
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 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
18 ## <http://www.gnu.org/licenses/>. |
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 -*- |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21615
diff
changeset
|
21 ## @deftypefn {} {} install (@var{files}, @var{handle_deps}, @var{prefix}, @var{archprefix}, @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 |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21615
diff
changeset
|
25 function install (files, handle_deps, prefix, archprefix, verbose, |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
26 local_list, global_list, global_install) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
27 |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
28 ## Check that the directory in prefix exist. If it doesn't: create it! |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
29 if (! exist (prefix, "dir")) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
30 warning ("creating installation directory %s", prefix); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
31 [status, msg] = mkdir (prefix); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
32 if (status != 1) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
33 error ("could not create installation directory: %s", msg); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
34 endif |
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 ## 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
|
38 [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
|
39 global_list); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
40 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
41 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
|
42 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
43 if (global_install) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
44 packages = global_packages; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
45 else |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
46 packages = local_packages; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
47 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
48 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
49 ## Uncompress the packages and read the DESCRIPTION files. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
50 tmpdirs = packdirs = descriptions = {}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
51 try |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
52 ## Warn about non existent files. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
53 for i = 1:length (files) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
54 if (isempty (glob (files{i}))) |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
55 warning ("file %s does not exist", files{i}); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
56 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
57 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
58 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
59 ## Unpack the package files and read the DESCRIPTION files. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
60 files = glob (files); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
61 packages_to_uninstall = []; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
62 for i = 1:length (files) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
63 tgz = files{i}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
64 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
65 if (exist (tgz, "file")) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
66 ## Create a temporary directory. |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 tmpdir = tempname (); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
68 tmpdirs{end+1} = tmpdir; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
69 if (verbose) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
70 printf ("mkdir (%s)\n", tmpdir); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
71 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
72 [status, msg] = mkdir (tmpdir); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
73 if (status != 1) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
74 error ("couldn't create temporary directory: %s", msg); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
75 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
76 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
77 ## Uncompress the package. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
78 if (verbose) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
79 printf ("untar (%s, %s)\n", tgz, tmpdir); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
80 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
81 untar (tgz, tmpdir); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
82 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
83 ## Get the name of the directories produced by tar. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
84 [dirlist, err, msg] = readdir (tmpdir); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
85 if (err) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
86 error ("couldn't read directory produced by tar: %s", msg); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
87 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
88 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
89 if (length (dirlist) > 3) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
90 error ("bundles of packages are not allowed"); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
91 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
92 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
93 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
94 ## The filename pointed to an uncompressed package to begin with. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
95 if (exist (tgz, "dir")) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
96 dirlist = {".", "..", tgz}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
97 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
98 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
99 if (exist (tgz, "file") || exist (tgz, "dir")) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
100 ## The two first entries of dirlist are "." and "..". |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
101 if (exist (tgz, "file")) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
102 packdir = fullfile (tmpdir, dirlist{3}); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
103 else |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14517
diff
changeset
|
104 packdir = fullfile (pwd (), dirlist{3}); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
105 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
106 packdirs{end+1} = packdir; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
107 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
108 ## Make sure the package contains necessary files. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
109 verify_directory (packdir); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
110 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
111 ## Read the DESCRIPTION file. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
112 filename = fullfile (packdir, "DESCRIPTION"); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
113 desc = get_description (filename); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
114 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
115 ## Verify that package name corresponds with filename. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
116 [dummy, nm] = fileparts (tgz); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
117 if ((length (nm) >= length (desc.name)) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
118 && ! strcmp (desc.name, nm(1:length (desc.name)))) |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
119 error ("package name '%s' doesn't correspond to its filename '%s'", |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
120 desc.name, nm); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
121 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
122 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
123 ## Set default installation directory. |
16994
333243133364
Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents:
16467
diff
changeset
|
124 desc.dir = fullfile (prefix, [desc.name "-" desc.version]); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
125 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
126 ## Set default architectire dependent installation directory. |
16994
333243133364
Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents:
16467
diff
changeset
|
127 desc.archprefix = fullfile (archprefix, [desc.name "-" desc.version]); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
128 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
129 ## Save desc. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
130 descriptions{end+1} = desc; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
131 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
132 ## Are any of the new packages already installed? |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
133 ## If so we'll remove the old version. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
134 for j = 1:length (packages) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
135 if (strcmp (packages{j}.name, desc.name)) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
136 packages_to_uninstall(end+1) = j; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
137 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
138 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
139 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
140 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
141 catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
142 ## Something went wrong, delete tmpdirs. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
143 for i = 1:length (tmpdirs) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
144 rmdir (tmpdirs{i}, "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
145 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
146 rethrow (lasterror ()); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
147 end_try_catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
148 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
149 ## Check dependencies. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
150 if (handle_deps) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
151 ok = true; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
152 error_text = ""; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
153 for i = 1:length (descriptions) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
154 desc = descriptions{i}; |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
155 idx2 = setdiff (1:length (descriptions), i); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
156 if (global_install) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
157 ## Global installation is not allowed to have dependencies on locally |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
158 ## installed packages. |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
159 idx1 = setdiff (1:length (global_packages), packages_to_uninstall); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
160 pseudo_installed_packages = {global_packages{idx1}, ... |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
161 descriptions{idx2}}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
162 else |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
163 idx1 = setdiff (1:length (local_packages), packages_to_uninstall); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
164 pseudo_installed_packages = {local_packages{idx1}, ... |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
165 global_packages{:}, ... |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
166 descriptions{idx2}}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
167 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
168 bad_deps = get_unsatisfied_deps (desc, pseudo_installed_packages); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
169 ## Are there any unsatisfied dependencies? |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
170 if (! isempty (bad_deps)) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
171 ok = false; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
172 for i = 1:length (bad_deps) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
173 dep = bad_deps{i}; |
16994
333243133364
Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents:
16467
diff
changeset
|
174 error_text = [error_text " " desc.name " needs " ... |
17016
a3f6790df115
Fix typos from cstrcat to matrix concatenation changeset (333243133364).
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
175 dep.package " " dep.operator " " dep.version "\n"]; |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
176 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
177 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
178 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
179 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
180 ## Did we find any unsatisfied dependencies? |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
181 if (! ok) |
16467
cc9e2751e073
pkg: Typo correction
Adam H Aitkenhead <adamhaitkenhead@gmail.com>
parents:
14868
diff
changeset
|
182 error ("the following dependencies were unsatisfied:\n %s", error_text); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
183 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
184 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
185 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
186 ## Prepare each package for installation. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
187 try |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
188 for i = 1:length (descriptions) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
189 desc = descriptions{i}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
190 pdir = packdirs{i}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
191 prepare_installation (desc, pdir); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
192 configure_make (desc, pdir, verbose); |
21518
2ee20a290d61
pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
193 copy_built_files (desc, pdir, verbose); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
194 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
195 catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
196 ## Something went wrong, delete tmpdirs. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
197 for i = 1:length (tmpdirs) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
198 rmdir (tmpdirs{i}, "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
199 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
200 rethrow (lasterror ()); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
201 end_try_catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
202 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
203 ## Uninstall the packages that will be replaced. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
204 try |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
205 for i = packages_to_uninstall |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
206 if (global_install) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
207 uninstall ({global_packages{i}.name}, false, verbose, local_list, |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
208 global_list, global_install); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
209 else |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
210 uninstall ({local_packages{i}.name}, false, verbose, local_list, |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
211 global_list, global_install); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
212 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
213 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
214 catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
215 ## Something went wrong, delete tmpdirs. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
216 for i = 1:length (tmpdirs) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
217 rmdir (tmpdirs{i}, "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
218 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
219 rethrow (lasterror ()); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
220 end_try_catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
221 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
222 ## Install each package. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
223 try |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
224 for i = 1:length (descriptions) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
225 desc = descriptions{i}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
226 pdir = packdirs{i}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
227 copy_files (desc, pdir, global_install); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
228 create_pkgadddel (desc, pdir, "PKG_ADD", global_install); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
229 create_pkgadddel (desc, pdir, "PKG_DEL", global_install); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
230 finish_installation (desc, pdir, global_install); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
231 generate_lookfor_cache (desc); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
232 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
233 catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
234 ## Something went wrong, delete tmpdirs. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
235 for i = 1:length (tmpdirs) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
236 rmdir (tmpdirs{i}, "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
237 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
238 for i = 1:length (descriptions) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
239 rmdir (descriptions{i}.dir, "s"); |
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
240 rmdir (getarchdir (descriptions{i}), "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
241 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
242 rethrow (lasterror ()); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
243 end_try_catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
244 |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
245 ## Check if the installed directory is empty. If it is remove it |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
246 ## from the list. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
247 for i = length (descriptions):-1:1 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
248 if (dirempty (descriptions{i}.dir, {"packinfo", "doc"}) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
249 && dirempty (getarchdir (descriptions{i}))) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
250 warning ("package %s is empty\n", descriptions{i}.name); |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
251 rmdir (descriptions{i}.dir, "s"); |
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
252 rmdir (getarchdir (descriptions{i}), "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
253 descriptions(i) = []; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
254 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
255 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
256 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
257 ## Add the packages to the package list. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
258 try |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
259 if (global_install) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
260 idx = setdiff (1:length (global_packages), packages_to_uninstall); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
261 global_packages = save_order ({global_packages{idx}, descriptions{:}}); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
262 save (global_list, "global_packages"); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
263 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
|
264 else |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
265 idx = setdiff (1:length (local_packages), packages_to_uninstall); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
266 local_packages = save_order ({local_packages{idx}, descriptions{:}}); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
267 save (local_list, "local_packages"); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
268 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
|
269 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
270 catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
271 ## Something went wrong, delete tmpdirs. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
272 for i = 1:length (tmpdirs) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
273 rmdir (tmpdirs{i}, "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
274 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
275 for i = 1:length (descriptions) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
276 rmdir (descriptions{i}.dir, "s"); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
277 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
278 if (global_install) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
279 printf ("error: couldn't append to %s\n", global_list); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
280 else |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
281 printf ("error: couldn't append to %s\n", local_list); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
282 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
283 rethrow (lasterror ()); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
284 end_try_catch |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
285 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
286 ## All is well, let's clean up. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
287 for i = 1:length (tmpdirs) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
288 [status, msg] = rmdir (tmpdirs{i}, "s"); |
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14470
diff
changeset
|
289 if (status != 1 && exist (tmpdirs{i}, "dir")) |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
290 warning ("couldn't clean up after my self: %s\n", msg); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
291 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
292 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
293 |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
294 ## If there is a NEWS file, mention it. |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
295 ## Check if desc exists too because it's possible to get to this point |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
296 ## without creating it such as giving an invalid filename for the package |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
297 if (exist ("desc", "var") |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
298 && exist (fullfile (desc.dir, "packinfo", "NEWS"), "file")) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
299 printf ("For information about changes from previous versions of the %s package, run 'news %s'.\n", |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
300 desc.name, desc.name); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
301 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
302 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
303 endfunction |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
304 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
305 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
306 function pkg = extract_pkg (nm, pat) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
307 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
308 fid = fopen (nm, "rt"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
309 pkg = ""; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
310 if (fid >= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
311 while (! feof (fid)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
312 ln = fgetl (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
313 if (ln > 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
314 t = regexp (ln, pat, "tokens"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
315 if (! isempty (t)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
316 pkg = [pkg "\n" t{1}{1}]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
317 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
318 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
319 endwhile |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
320 if (! isempty (pkg)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
321 pkg = [pkg "\n"]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
322 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
323 fclose (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
324 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
325 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
326 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
327 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
328 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
329 ## Make sure the package contains the essential files. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
330 function verify_directory (dir) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
331 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
332 needed_files = {"COPYING", "DESCRIPTION"}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
333 for f = needed_files |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
334 if (! exist (fullfile (dir, f{1}), "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
335 error ("package is missing file: %s", f{1}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
336 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
337 endfor |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
338 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
339 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
340 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
341 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
342 function prepare_installation (desc, packdir) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
343 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
344 ## Is there a pre_install to call? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
345 if (exist (fullfile (packdir, "pre_install.m"), "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
346 wd = pwd (); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
347 try |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
348 cd (packdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
349 pre_install (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
350 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
351 catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
352 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
353 rethrow (lasterror ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
354 end_try_catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
355 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
356 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
357 ## If the directory "inst" doesn't exist, we create it. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
358 inst_dir = fullfile (packdir, "inst"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
359 if (! exist (inst_dir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
360 [status, msg] = mkdir (inst_dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
361 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
362 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
363 error ("the 'inst' directory did not exist and could not be created: %s", |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
364 msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
365 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
366 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
367 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
368 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
369 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
370 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
371 function copy_built_files (desc, packdir, verbose) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
372 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
373 src = fullfile (packdir, "src"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
374 if (! exist (src, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
375 return |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
376 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
377 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
378 ## Copy files to "inst" and "inst/arch" (this is instead of 'make install'). |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
379 files = fullfile (src, "FILES"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
380 instdir = fullfile (packdir, "inst"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
381 archdir = fullfile (packdir, "inst", getarch ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
382 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
383 ## Get filenames. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
384 if (exist (files, "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
385 [fid, msg] = fopen (files, "r"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
386 if (fid < 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
387 error ("couldn't open %s: %s", files, msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
388 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
389 filenames = char (fread (fid))'; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
390 fclose (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
391 if (filenames(end) == "\n") |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
392 filenames(end) = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
393 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
394 filenames = strtrim (ostrsplit (filenames, "\n")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
395 delete_idx = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
396 for i = 1:length (filenames) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
397 if (! all (isspace (filenames{i}))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
398 filenames{i} = fullfile (src, filenames{i}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
399 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
400 delete_idx(end+1) = i; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
401 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
402 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
403 filenames(delete_idx) = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
404 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
405 m = dir (fullfile (src, "*.m")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
406 oct = dir (fullfile (src, "*.oct")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
407 mex = dir (fullfile (src, "*.mex")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
408 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
409 filenames = cellfun (@(x) fullfile (src, x), |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
410 {m.name, oct.name, mex.name}, |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
411 "uniformoutput", false); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
412 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
413 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
414 ## Split into architecture dependent and independent files. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
415 if (isempty (filenames)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
416 idx = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
417 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
418 idx = cellfun ("is_architecture_dependent", filenames); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
419 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
420 archdependent = filenames(idx); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
421 archindependent = filenames(! idx); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
422 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
423 ## Copy the files. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
424 if (! all (isspace ([filenames{:}]))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
425 if (! exist (instdir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
426 mkdir (instdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
427 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
428 if (! all (isspace ([archindependent{:}]))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
429 if (verbose) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
430 printf ("copyfile"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
431 printf (" %s", archindependent{:}); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
432 printf ("%s\n", instdir); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
433 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
434 [status, output] = copyfile (archindependent, instdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
435 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
436 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
437 error ("Couldn't copy files from 'src' to 'inst': %s", output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
438 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
439 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
440 if (! all (isspace ([archdependent{:}]))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
441 if (verbose) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
442 printf ("copyfile"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
443 printf (" %s", archdependent{:}); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
444 printf (" %s\n", archdir); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
445 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
446 if (! exist (archdir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
447 mkdir (archdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
448 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
449 [status, output] = copyfile (archdependent, archdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
450 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
451 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
452 error ("Couldn't copy files from 'src' to 'inst': %s", output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
453 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
454 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
455 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
456 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
457 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
458 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
459 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
460 function dep = is_architecture_dependent (nm) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
461 persistent archdepsuffix = {".oct",".mex",".a",".lib",".so",".so.*",".dll","dylib"}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
462 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
463 dep = false; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
464 for i = 1 : length (archdepsuffix) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
465 ext = archdepsuffix{i}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
466 if (ext(end) == "*") |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
467 isglob = true; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
468 ext(end) = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
469 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
470 isglob = false; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
471 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
472 pos = strfind (nm, ext); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
473 if (pos) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
474 if (! isglob && (length (nm) - pos(end) != length (ext) - 1)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
475 continue; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
476 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
477 dep = true; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
478 break; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
479 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
480 endfor |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
481 |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
482 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17016
diff
changeset
|
483 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
484 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
485 function copy_files (desc, packdir, global_install) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
486 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
487 ## Create the installation directory. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
488 if (! exist (desc.dir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
489 [status, output] = mkdir (desc.dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
490 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
491 error ("couldn't create installation directory %s : %s", |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
492 desc.dir, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
493 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
494 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
495 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
496 octfiledir = getarchdir (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
497 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
498 ## Copy the files from "inst" to installdir. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
499 instdir = fullfile (packdir, "inst"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
500 if (! dirempty (instdir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
501 [status, output] = copyfile (fullfile (instdir, "*"), desc.dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
502 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
503 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
504 error ("couldn't copy files to the installation directory"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
505 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
506 if (exist (fullfile (desc.dir, getarch ()), "dir") |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
507 && ! strcmp (fullfile (desc.dir, getarch ()), octfiledir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
508 if (! exist (octfiledir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
509 ## Can be required to create upto three levels of dirs. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
510 octm1 = fileparts (octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
511 if (! exist (octm1, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
512 octm2 = fileparts (octm1); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
513 if (! exist (octm2, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
514 octm3 = fileparts (octm2); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
515 if (! exist (octm3, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
516 [status, output] = mkdir (octm3); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
517 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
518 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
519 error ("couldn't create installation directory %s : %s", |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
520 octm3, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
521 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
522 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
523 [status, output] = mkdir (octm2); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
524 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
525 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
526 error ("couldn't create installation directory %s : %s", |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
527 octm2, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
528 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
529 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
530 [status, output] = mkdir (octm1); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
531 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
532 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
533 error ("couldn't create installation directory %s : %s", |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
534 octm1, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
535 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
536 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
537 [status, output] = mkdir (octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
538 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
539 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
540 error ("couldn't create installation directory %s : %s", |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
541 octfiledir, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
542 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
543 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
544 [status, output] = movefile (fullfile (desc.dir, getarch (), "*"), |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
545 octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
546 rmdir (fullfile (desc.dir, getarch ()), "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
547 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
548 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
549 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
550 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
551 error ("couldn't copy files to the installation directory"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
552 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
553 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
554 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
555 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
556 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
557 ## Create the "packinfo" directory. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
558 packinfo = fullfile (desc.dir, "packinfo"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
559 [status, msg] = mkdir (packinfo); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
560 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
561 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
562 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
563 error ("couldn't create packinfo directory: %s", msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
564 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
565 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
566 packinfo_copy_file ("DESCRIPTION", "required", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
567 packinfo_copy_file ("COPYING", "required", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
568 packinfo_copy_file ("CITATION", "optional", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
569 packinfo_copy_file ("NEWS", "optional", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
570 packinfo_copy_file ("ONEWS", "optional", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
571 packinfo_copy_file ("ChangeLog", "optional", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
572 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
573 ## Is there an INDEX file to copy or should we generate one? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
574 index_file = fullfile (packdir, "INDEX"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
575 if (exist (index_file, "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
576 packinfo_copy_file ("INDEX", "required", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
577 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
578 try |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
579 write_index (desc, fullfile (packdir, "inst"), |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
580 fullfile (packinfo, "INDEX"), global_install); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
581 catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
582 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
583 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
584 rethrow (lasterror ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
585 end_try_catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
586 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
587 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
588 ## Is there an 'on_uninstall.m' to install? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
589 packinfo_copy_file ("on_uninstall.m", "optional", packdir, packinfo, desc, octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
590 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
591 ## Is there a doc/ directory that needs to be installed? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
592 docdir = fullfile (packdir, "doc"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
593 if (exist (docdir, "dir") && ! dirempty (docdir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
594 [status, output] = copyfile (docdir, desc.dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
595 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
596 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
597 ## Is there a bin/ directory that needs to be installed? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
598 ## FIXME: Need to treat architecture dependent files in bin/ |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
599 bindir = fullfile (packdir, "bin"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
600 if (exist (bindir, "dir") && ! dirempty (bindir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
601 [status, output] = copyfile (bindir, desc.dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
602 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
603 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
604 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
605 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
606 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
607 function packinfo_copy_file (filename, requirement, packdir, packinfo, desc, octfiledir) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
608 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
609 filepath = fullfile (packdir, filename); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
610 if (! exist (filepath, "file") && strcmpi (requirement, "optional")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
611 ## do nothing, it's still OK |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
612 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
613 [status, output] = copyfile (filepath, packinfo); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
614 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
615 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
616 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
617 error ("Couldn't copy %s file: %s", filename, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
618 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
619 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
620 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
621 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
622 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
623 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
624 ## Create an INDEX file for a package that doesn't provide one. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
625 ## 'desc' describes the package. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
626 ## 'dir' is the 'inst' directory in temporary directory. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
627 ## 'index_file' is the name (including path) of resulting INDEX file. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
628 function write_index (desc, dir, index_file, global_install) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
629 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
630 ## Get names of functions in dir |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
631 [files, err, msg] = readdir (dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
632 if (err) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
633 error ("couldn't read directory %s: %s", dir, msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
634 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
635 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
636 ## Get classes in dir |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
637 class_idx = find (strncmp (files, '@', 1)); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
638 for k = 1:length (class_idx) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
639 class_name = files {class_idx(k)}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
640 class_dir = fullfile (dir, class_name); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
641 if (exist (class_dir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
642 [files2, err, msg] = readdir (class_dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
643 if (err) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
644 error ("couldn't read directory %s: %s", class_dir, msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
645 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
646 files2 = strcat (class_name, filesep (), files2); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
647 files = [files; files2]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
648 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
649 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
650 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
651 ## Check for architecture dependent files. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
652 tmpdir = getarchdir (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
653 if (exist (tmpdir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
654 [files2, err, msg] = readdir (tmpdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
655 if (err) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
656 error ("couldn't read directory %s: %s", tmpdir, msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
657 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
658 files = [files; files2]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
659 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
660 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
661 functions = {}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
662 for i = 1:length (files) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
663 file = files{i}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
664 lf = length (file); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
665 if (lf > 2 && strcmp (file(end-1:end), ".m")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
666 functions{end+1} = file(1:end-2); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
667 elseif (lf > 4 && strcmp (file(end-3:end), ".oct")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
668 functions{end+1} = file(1:end-4); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
669 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
670 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
671 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
672 ## Does desc have a categories field? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
673 if (! isfield (desc, "categories")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
674 error ("the DESCRIPTION file must have a Categories field, when no INDEX file is given"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
675 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
676 categories = strtrim (strsplit (desc.categories, ",")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
677 if (length (categories) < 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
678 error ("the Category field is empty"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
679 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
680 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
681 ## Write INDEX. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
682 fid = fopen (index_file, "w"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
683 if (fid == -1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
684 error ("couldn't open %s for writing", index_file); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
685 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
686 fprintf (fid, "%s >> %s\n", desc.name, desc.title); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
687 fprintf (fid, "%s\n", categories{1}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
688 fprintf (fid, " %s\n", functions{:}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
689 fclose (fid); |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
690 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
691 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
692 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
693 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
694 function create_pkgadddel (desc, packdir, nm, global_install) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
695 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
696 instpkg = fullfile (desc.dir, nm); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
697 instfid = fopen (instpkg, "at"); # append to support PKG_ADD at inst/ |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
698 ## If it is exists, most of the PKG_* file should go into the |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
699 ## architecture dependent directory so that the autoload/mfilename |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
700 ## commands work as expected. The only part that doesn't is the |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
701 ## part in the main directory. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
702 archdir = fullfile (getarchprefix (desc, global_install), |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
703 [desc.name "-" desc.version], getarch ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
704 if (exist (getarchdir (desc, global_install), "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
705 archpkg = fullfile (getarchdir (desc, global_install), nm); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
706 archfid = fopen (archpkg, "at"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
707 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
708 archpkg = instpkg; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
709 archfid = instfid; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
710 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
711 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
712 if (archfid >= 0 && instfid >= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
713 ## Search all dot-m files for PKG commands. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
714 lst = dir (fullfile (packdir, "inst", "*.m")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
715 for i = 1:length (lst) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
716 nam = fullfile (packdir, "inst", lst(i).name); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
717 fwrite (instfid, extract_pkg (nam, ['^[#%][#%]* *' nm ': *(.*)$'])); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
718 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
719 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
720 ## Search all C++ source files for PKG commands. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
721 lst = dir (fullfile (packdir, "src", "*.cc")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
722 for i = 1:length (lst) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
723 nam = fullfile (packdir, "src", lst(i).name); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
724 fwrite (archfid, extract_pkg (nam, ['^//* *' nm ': *(.*)$'])); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
725 fwrite (archfid, extract_pkg (nam, ['^/\** *' nm ': *(.*) *\*/$'])); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
726 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
727 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
728 ## Add developer included PKG commands. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
729 packdirnm = fullfile (packdir, nm); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
730 if (exist (packdirnm, "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
731 fid = fopen (packdirnm, "rt"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
732 if (fid >= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
733 while (! feof (fid)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
734 ln = fgets (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
735 if (ln > 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
736 fwrite (archfid, ln); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
737 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
738 endwhile |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
739 fclose (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
740 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
741 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
742 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
743 ## If the files is empty remove it. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
744 fclose (instfid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
745 t = dir (instpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
746 if (t.bytes <= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
747 unlink (instpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
748 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
749 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
750 if (instfid != archfid) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
751 fclose (archfid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
752 t = dir (archpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
753 if (t.bytes <= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
754 unlink (archpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
755 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
756 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
757 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
758 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
759 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
760 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
761 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
762 function archprefix = getarchprefix (desc, global_install) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
763 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
764 if (global_install) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
765 [~, archprefix] = default_prefix (global_install, desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
766 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
767 archprefix = desc.dir; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
768 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
769 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
770 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
771 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
772 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
773 function finish_installation (desc, packdir, global_install) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
774 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
775 ## Is there a post-install to call? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
776 if (exist (fullfile (packdir, "post_install.m"), "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
777 wd = pwd (); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
778 try |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
779 cd (packdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
780 post_install (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
781 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
782 catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
783 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
784 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
785 rmdir (getarchdir (desc), "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
786 rethrow (lasterror ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
787 end_try_catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
788 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
789 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
790 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
791 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
792 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
793 function generate_lookfor_cache (desc) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
794 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
795 dirs = strtrim (ostrsplit (genpath (desc.dir), pathsep ())); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
796 for i = 1 : length (dirs) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
797 doc_cache_create (fullfile (dirs{i}, "doc-cache"), dirs{i}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
798 endfor |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
799 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
800 endfunction |