Mercurial > octave
annotate scripts/pkg/private/install.m @ 21633:dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
* libinterp/corefcn/file-io.cc: extracted printf, puts, and scanf to M-files.
* scripts/deprecated/printf.m: new function, equivalent to version file-io.cc.
* scripts/deprecated/puts.m: new function, equivalent to version file-io.cc.
* scripts/deprecated/scanf.m: new function, equivalent to version file-io.cc.
* scripts/deprecated/module.mk: added printf, puts, and scanf.
* scripts/io/fputs.m: new function, equivalent to version file-io.cc.
* scripts/io/module.mk: added fputs.
* doc/interpreter/io.txi: adapted documentation to current implementation.
* NEWS: announced changes.
* doc/interpreter/basics.txi: replaced printf by fprintf.
* doc/interpreter/stmt.txi: replaced printf by fprintf.
* doc/interpreter/var.txi: replaced printf by fprintf.
* doc/refcard/refcard.tex: removed printf and scanf.
* examples/code/@FIRfilter/display.m: replaced printf by fprintf.
* examples/code/@polynomial/display.m: replaced printf by fprintf.
* scripts/@ftp/display.m: replaced printf by fprintf.
* scripts/general/inputParser.m: replaced printf by fprintf.
* scripts/general/methods.m: replaced printf by fprintf.
* scripts/general/profexplore.m: replaced printf by fprintf.
* scripts/general/profshow.m: replaced printf by fprintf.
* scripts/help/help.m: replaced puts by fputs and printf by fprintf.
* scripts/help/lookfor.m: replaced puts by fputs and printf by fprintf.
* scripts/help/which.m: replaced printf by fprintf.
* scripts/image/imformats.m: replaced printf by fprintf.
* scripts/io/beep.m: replaced puts by fputs.
* scripts/io/textread.m: replaced printf by fprintf.
* scripts/java/javaclasspath.m: replaced printf by fprintf.
* scripts/java/javamem.m: replaced printf by fprintf.
* scripts/miscellaneous/dir.m: replaced printf by fprintf.
* scripts/miscellaneous/dos.m: replaced printf by fprintf.
* scripts/miscellaneous/fact.m: replaced printf by fprintf.
* scripts/miscellaneous/info.m: replaced printf by fprintf.
* scripts/miscellaneous/license.m: replaced printf by fprintf.
* scripts/miscellaneous/ls.m: replaced puts by fputs.
* scripts/miscellaneous/menu.m: replaced printf by fprintf.
* scripts/miscellaneous/mkoctfile.m: replaced printf by fprintf.
* scripts/miscellaneous/private/display_info_file.m:
* scripts/miscellaneous/unix.m: replaced printf by fprintf.
* scripts/miscellaneous/ver.m: replaced printf by fprintf.
* scripts/miscellaneous/what.m: replaced printf by fprintf.
* scripts/ode/ode23.m: replaced printf by fprintf.
* scripts/ode/ode45.m: replaced printf by fprintf.
* scripts/optimization/fminbnd.m: replaced printf by fprintf.
* scripts/optimization/optimset.m: replaced puts by fputs and printf by fprintf.
* scripts/optimization/sqp.m: replaced printf by fprintf.
* scripts/pkg/pkg.m: replaced printf by fprintf.
* scripts/pkg/private/describe.m: replaced printf by fprintf.
* scripts/pkg/private/install.m: replaced printf by fprintf.
* scripts/pkg/private/installed_packages.m: replaced printf by fprintf.
* scripts/pkg/private/list_forge_packages.m: replaced puts by fputs and printf by fprintf.
* scripts/pkg/private/rebuild.m: replaced printf by fprintf.
* scripts/plot/util/__gnuplot_drawnow__.m: replaced puts by fputs and printf by fprintf.
* scripts/signal/stft.m: replaced printf by fprintf.
* scripts/sparse/bicg.m: replaced printf by fprintf.
* scripts/sparse/bicgstab.m: replaced printf by fprintf.
* scripts/sparse/cgs.m: replaced printf by fprintf.
* scripts/sparse/pcg.m: replaced printf by fprintf.
* scripts/sparse/pcr.m: replaced printf by fprintf.
* scripts/sparse/qmr.m: replaced printf by fprintf.
* scripts/statistics/models/logistic_regression.m: replaced printf by fprintf.
* scripts/statistics/tests/anova.m: replaced printf by fprintf.
* scripts/statistics/tests/bartlett_test.m: replaced printf by fprintf.
* scripts/statistics/tests/chisquare_test_homogeneity.m: replaced printf by fprintf.
* scripts/statistics/tests/chisquare_test_independence.m: replaced printf by fprintf.
* scripts/statistics/tests/cor_test.m: replaced printf by fprintf.
* scripts/statistics/tests/f_test_regression.m: replaced printf by fprintf.
* scripts/statistics/tests/hotelling_test.m: replaced printf by fprintf.
* scripts/statistics/tests/hotelling_test_2.m: replaced printf by fprintf.
* scripts/statistics/tests/kolmogorov_smirnov_test.m: replaced printf by fprintf.
* scripts/statistics/tests/kolmogorov_smirnov_test_2.m: replaced printf by fprintf.
* scripts/statistics/tests/kruskal_wallis_test.m: replaced printf by fprintf.
* scripts/statistics/tests/manova.m: replaced printf by fprintf.
* scripts/statistics/tests/mcnemar_test.m: replaced printf by fprintf.
* scripts/statistics/tests/prop_test_2.m: replaced printf by fprintf.
* scripts/statistics/tests/run_test.m: replaced printf by fprintf.
* scripts/statistics/tests/sign_test.m: replaced printf by fprintf.
* scripts/statistics/tests/t_test.m: replaced printf by fprintf.
* scripts/statistics/tests/t_test_2.m: replaced printf by fprintf.
* scripts/statistics/tests/t_test_regression.m: replaced printf by fprintf.
* scripts/statistics/tests/u_test.m: replaced printf by fprintf.
* scripts/statistics/tests/var_test.m: replaced printf by fprintf.
* scripts/statistics/tests/welch_test.m: replaced printf by fprintf.
* scripts/statistics/tests/wilcoxon_test.m: replaced printf by fprintf.
* scripts/statistics/tests/z_test.m: replaced printf by fprintf.
* scripts/statistics/tests/z_test_2.m: replaced printf by fprintf.
* scripts/strings/strtok.m: replaced printf by fprintf.
* scripts/testfun/__run_test_suite__.m: replaced puts by fputs and printf by fprintf.
* scripts/testfun/demo.m: replaced printf by fprintf.
* scripts/testfun/example.m: replaced printf by fprintf.
* scripts/testfun/private/compare_plot_demos.m: replaced printf by fprintf.
* scripts/testfun/rundemos.m: replaced printf by fprintf.
* scripts/testfun/runtests.m: replaced puts by fputs and printf by fprintf.
* scripts/testfun/speed.m: replaced printf by fprintf.
* scripts/testfun/test.m: replaced printf by fprintf.
* scripts/time/calendar.m: replaced puts by fputs and printf by fprintf.
* test/io.tst: replaced printf by fprintf.
author | Kai T. Ohlhus <k.ohlhus@gmail.com> |
---|---|
date | Wed, 20 Apr 2016 17:53:10 +0200 |
parents | cf227735d5fd |
children | 96518f623c91 |
rev | line source |
---|---|
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1 ## Copyright (C) 2005-2015 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 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
9 ## your option) any later version. |
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 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
14 ## General Public License for more details. |
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 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
28 ## Check that the directory in prefix exist. If it doesn't: create it! |
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) |
21633
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
70 fprintf ("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) |
21633
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
79 fprintf ("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 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
245 ## Check if the installed directory is empty. If it is remove it |
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) |
21633
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
279 fprintf ("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 |
21633
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
281 fprintf ("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")) |
21633
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
299 fprintf ("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 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
302 endfunction |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
303 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
304 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
305 function pkg = extract_pkg (nm, pat) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
306 fid = fopen (nm, "rt"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
307 pkg = ""; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
308 if (fid >= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
309 while (! feof (fid)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
310 ln = fgetl (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
311 if (ln > 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
312 t = regexp (ln, pat, "tokens"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
313 if (! isempty (t)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
314 pkg = [pkg "\n" t{1}{1}]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
315 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
316 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
317 endwhile |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
318 if (! isempty (pkg)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
319 pkg = [pkg "\n"]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
320 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
321 fclose (fid); |
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 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
324 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
325 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
326 ## 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
|
327 function verify_directory (dir) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
328 needed_files = {"COPYING", "DESCRIPTION"}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
329 for f = needed_files |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
330 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
|
331 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
|
332 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
333 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
334 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
335 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
336 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
337 function prepare_installation (desc, packdir) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
338 ## 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
|
339 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
|
340 wd = pwd (); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
341 try |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
342 cd (packdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
343 pre_install (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
344 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
345 catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
346 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
347 rethrow (lasterror ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
348 end_try_catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
349 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
350 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
351 ## 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
|
352 inst_dir = fullfile (packdir, "inst"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
353 if (! exist (inst_dir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
354 [status, msg] = mkdir (inst_dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
355 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
356 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
357 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
|
358 msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
359 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
360 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
361 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
362 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
363 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
364 function copy_built_files (desc, packdir, verbose) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
365 src = fullfile (packdir, "src"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
366 if (! exist (src, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
367 return |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
368 endif |
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 ## 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
|
371 files = fullfile (src, "FILES"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
372 instdir = fullfile (packdir, "inst"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
373 archdir = fullfile (packdir, "inst", getarch ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
374 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
375 ## Get filenames. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
376 if (exist (files, "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
377 [fid, msg] = fopen (files, "r"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
378 if (fid < 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
379 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
|
380 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
381 filenames = char (fread (fid))'; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
382 fclose (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
383 if (filenames(end) == "\n") |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
384 filenames(end) = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
385 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
386 filenames = strtrim (ostrsplit (filenames, "\n")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
387 delete_idx = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
388 for i = 1:length (filenames) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
389 if (! all (isspace (filenames{i}))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
390 filenames{i} = fullfile (src, filenames{i}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
391 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
392 delete_idx(end+1) = i; |
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 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
395 filenames(delete_idx) = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
396 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
397 m = dir (fullfile (src, "*.m")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
398 oct = dir (fullfile (src, "*.oct")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
399 mex = dir (fullfile (src, "*.mex")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
400 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
401 filenames = cellfun (@(x) fullfile (src, x), |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
402 {m.name, oct.name, mex.name}, |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
403 "uniformoutput", false); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
404 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
405 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
406 ## 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
|
407 if (isempty (filenames)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
408 idx = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
409 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
410 idx = cellfun ("is_architecture_dependent", filenames); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
411 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
412 archdependent = filenames(idx); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
413 archindependent = filenames(! idx); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
414 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
415 ## Copy the files. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
416 if (! all (isspace ([filenames{:}]))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
417 if (! exist (instdir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
418 mkdir (instdir); |
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 if (! all (isspace ([archindependent{:}]))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
421 if (verbose) |
21633
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
422 fprintf ("copyfile"); |
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
423 fprintf (" %s", archindependent{:}); |
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
424 fprintf ("%s\n", instdir); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
425 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
426 [status, output] = copyfile (archindependent, instdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
427 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
428 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
429 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
|
430 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
431 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
432 if (! all (isspace ([archdependent{:}]))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
433 if (verbose) |
21633
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
434 fprintf ("copyfile"); |
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
435 fprintf (" %s", archdependent{:}); |
dcf8922b724b
Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21624
diff
changeset
|
436 fprintf (" %s\n", archdir); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
437 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
438 if (! exist (archdir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
439 mkdir (archdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
440 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
441 [status, output] = copyfile (archdependent, archdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
442 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
443 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
444 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
|
445 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
446 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
447 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
448 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
449 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
450 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
451 function dep = is_architecture_dependent (nm) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
452 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
|
453 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
454 dep = false; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
455 for i = 1 : length (archdepsuffix) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
456 ext = archdepsuffix{i}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
457 if (ext(end) == "*") |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
458 isglob = true; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
459 ext(end) = []; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
460 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
461 isglob = false; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
462 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
463 pos = strfind (nm, ext); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
464 if (pos) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
465 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
|
466 continue; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
467 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
468 dep = true; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
469 break; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
470 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
471 endfor |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
472 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17016
diff
changeset
|
473 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
474 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
475 function copy_files (desc, packdir, global_install) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
476 ## Create the installation directory. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
477 if (! exist (desc.dir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
478 [status, output] = mkdir (desc.dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
479 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
480 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
|
481 desc.dir, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
482 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
483 endif |
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 octfiledir = getarchdir (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
486 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
487 ## 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
|
488 instdir = fullfile (packdir, "inst"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
489 if (! dirempty (instdir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
490 [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
|
491 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
492 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
493 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
|
494 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
495 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
|
496 && ! strcmp (fullfile (desc.dir, getarch ()), octfiledir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
497 if (! exist (octfiledir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
498 ## 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
|
499 octm1 = fileparts (octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
500 if (! exist (octm1, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
501 octm2 = fileparts (octm1); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
502 if (! exist (octm2, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
503 octm3 = fileparts (octm2); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
504 if (! exist (octm3, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
505 [status, output] = mkdir (octm3); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
506 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
507 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
508 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
|
509 octm3, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
510 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
511 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
512 [status, output] = mkdir (octm2); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
513 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
514 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
515 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
|
516 octm2, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
517 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
518 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
519 [status, output] = mkdir (octm1); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
520 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
521 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
522 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
|
523 octm1, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
524 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
525 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
526 [status, output] = mkdir (octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
527 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
528 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
529 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
|
530 octfiledir, output); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
531 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
532 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
533 [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
|
534 octfiledir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
535 rmdir (fullfile (desc.dir, getarch ()), "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
536 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
537 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
538 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
539 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
540 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
|
541 endif |
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 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
544 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
545 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
546 ## Create the "packinfo" directory. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
547 packinfo = fullfile (desc.dir, "packinfo"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
548 [status, msg] = mkdir (packinfo); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
549 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
550 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
551 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
552 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
|
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 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
562 ## 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
|
563 index_file = fullfile (packdir, "INDEX"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
564 if (exist (index_file, "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
565 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
|
566 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
567 try |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
568 write_index (desc, fullfile (packdir, "inst"), |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
569 fullfile (packinfo, "INDEX"), global_install); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
570 catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
571 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
572 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
573 rethrow (lasterror ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
574 end_try_catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
575 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
576 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
577 ## 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
|
578 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
|
579 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
580 ## 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
|
581 docdir = fullfile (packdir, "doc"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
582 if (exist (docdir, "dir") && ! dirempty (docdir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
583 [status, output] = copyfile (docdir, desc.dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
584 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
585 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
586 ## 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
|
587 ## 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
|
588 bindir = fullfile (packdir, "bin"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
589 if (exist (bindir, "dir") && ! dirempty (bindir)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
590 [status, output] = copyfile (bindir, desc.dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
591 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
592 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
593 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
594 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
595 function packinfo_copy_file (filename, requirement, packdir, packinfo, desc, octfiledir) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
596 filepath = fullfile (packdir, filename); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
597 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
|
598 ## do nothing, it's still OK |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
599 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
600 [status, output] = copyfile (filepath, packinfo); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
601 if (status != 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
602 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
603 rmdir (octfiledir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
604 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
|
605 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
606 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
607 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
608 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
609 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
610 ## 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
|
611 ## 'desc' describes the package. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
612 ## '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
|
613 ## '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
|
614 function write_index (desc, dir, index_file, global_install) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
615 ## Get names of functions in dir |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
616 [files, err, msg] = readdir (dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
617 if (err) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
618 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
|
619 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
620 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
621 ## Get classes in dir |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
622 class_idx = find (strncmp (files, '@', 1)); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
623 for k = 1:length (class_idx) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
624 class_name = files {class_idx(k)}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
625 class_dir = fullfile (dir, class_name); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
626 if (exist (class_dir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
627 [files2, err, msg] = readdir (class_dir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
628 if (err) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
629 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
|
630 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
631 files2 = strcat (class_name, filesep (), files2); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
632 files = [files; files2]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
633 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
634 endfor |
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 ## Check for architecture dependent files. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
637 tmpdir = getarchdir (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
638 if (exist (tmpdir, "dir")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
639 [files2, err, msg] = readdir (tmpdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
640 if (err) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
641 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
|
642 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
643 files = [files; files2]; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
644 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
645 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
646 functions = {}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
647 for i = 1:length (files) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
648 file = files{i}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
649 lf = length (file); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
650 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
|
651 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
|
652 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
|
653 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
|
654 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
655 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
656 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
657 ## Does desc have a categories field? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
658 if (! isfield (desc, "categories")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
659 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
|
660 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
661 categories = strtrim (strsplit (desc.categories, ",")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
662 if (length (categories) < 1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
663 error ("the Category field is empty"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
664 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
665 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
666 ## Write INDEX. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
667 fid = fopen (index_file, "w"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
668 if (fid == -1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
669 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
|
670 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
671 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
|
672 fprintf (fid, "%s\n", categories{1}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
673 fprintf (fid, " %s\n", functions{:}); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
674 fclose (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
675 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
676 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
677 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
678 function create_pkgadddel (desc, packdir, nm, global_install) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
679 instpkg = fullfile (desc.dir, nm); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
680 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
|
681 ## 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
|
682 ## architecture dependent directory so that the autoload/mfilename |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
683 ## commands work as expected. The only part that doesn't is the |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
684 ## part in the main directory. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
685 archdir = fullfile (getarchprefix (desc, global_install), |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
686 [desc.name "-" desc.version], getarch ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
687 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
|
688 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
|
689 archfid = fopen (archpkg, "at"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
690 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
691 archpkg = instpkg; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
692 archfid = instfid; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
693 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
694 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
695 if (archfid >= 0 && instfid >= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
696 ## 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
|
697 lst = dir (fullfile (packdir, "inst", "*.m")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
698 for i = 1:length (lst) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
699 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
|
700 fwrite (instfid, extract_pkg (nam, ['^[#%][#%]* *' nm ': *(.*)$'])); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
701 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
702 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
703 ## 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
|
704 lst = dir (fullfile (packdir, "src", "*.cc")); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
705 for i = 1:length (lst) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
706 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
|
707 fwrite (archfid, extract_pkg (nam, ['^//* *' nm ': *(.*)$'])); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
708 fwrite (archfid, extract_pkg (nam, ['^/\** *' nm ': *(.*) *\*/$'])); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
709 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
710 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
711 ## Add developer included PKG commands. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
712 packdirnm = fullfile (packdir, nm); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
713 if (exist (packdirnm, "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
714 fid = fopen (packdirnm, "rt"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
715 if (fid >= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
716 while (! feof (fid)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
717 ln = fgets (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
718 if (ln > 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
719 fwrite (archfid, ln); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
720 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
721 endwhile |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
722 fclose (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
723 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
724 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
725 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
726 ## 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
|
727 fclose (instfid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
728 t = dir (instpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
729 if (t.bytes <= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
730 unlink (instpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
731 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
732 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
733 if (instfid != archfid) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
734 fclose (archfid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
735 t = dir (archpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
736 if (t.bytes <= 0) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
737 unlink (archpkg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
738 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
739 endif |
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 endfunction |
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 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
744 function archprefix = getarchprefix (desc, global_install) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
745 if (global_install) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
746 [~, archprefix] = default_prefix (global_install, desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
747 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
748 archprefix = desc.dir; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
749 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
750 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
751 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
752 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
753 function finish_installation (desc, packdir, global_install) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
754 ## 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
|
755 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
|
756 wd = pwd (); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
757 try |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
758 cd (packdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
759 post_install (desc); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
760 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
761 catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
762 cd (wd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
763 rmdir (desc.dir, "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
764 rmdir (getarchdir (desc), "s"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
765 rethrow (lasterror ()); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
766 end_try_catch |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
767 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
768 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
769 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
770 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
771 function generate_lookfor_cache (desc) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
772 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
|
773 for i = 1 : length (dirs) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
774 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
|
775 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
776 endfunction |