Mercurial > octave
annotate scripts/pkg/pkg.m @ 22529:640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
author | Philip Nienhuis <prnienhuis@users.sf.net> |
---|---|
date | Thu, 22 Sep 2016 22:00:32 +0200 |
parents | bac0d6f07a3e |
children | 3a2b891d0b33 3ac9f9ecfae5 |
rev | line source |
---|---|
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
21998
diff
changeset
|
1 ## Copyright (C) 2005-2016 Søren Hauberg |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
2 ## Copyright (C) 2010 VZLU Prague, a.s. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14446
diff
changeset
|
3 ## Copyright (C) 2012 Carlo de Falco |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
4 ## |
6440 | 5 ## This file is part of Octave. |
6 ## | |
7 ## Octave is free software; you can redistribute it and/or modify it | |
8 ## under the terms of the GNU General Public License as published by | |
7016 | 9 ## the Free Software Foundation; either version 3 of the License, or (at |
10 ## your option) any later version. | |
6440 | 11 ## |
12 ## Octave is distributed in the hope that it will be useful, but | |
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 ## General Public License for more details. | |
16 ## | |
5801 | 17 ## You should have received a copy of the GNU General Public License |
7016 | 18 ## along with Octave; see the file COPYING. If not, see |
19 ## <http://www.gnu.org/licenses/>. | |
5801 | 20 |
21 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
22 ## @deftypefn {} {} pkg @var{command} @var{pkg_name} |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
23 ## @deftypefnx {} {} pkg @var{command} @var{option} @var{pkg_name} |
22529
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
24 ## @deftypefnx {} {[@var{out1}, @dots{}] =} pkg (@var{command}, @dots{} ) |
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
25 ## Manage or query packages (groups of add-on functions) for Octave. |
19187 | 26 ## |
22529
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
27 ## Different actions are available depending on the value of @var{command} |
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
28 ## and on return arguments. |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
29 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
30 ## Available commands: |
6032 | 31 ## |
32 ## @table @samp | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
33 ## |
6032 | 34 ## @item install |
6070 | 35 ## Install named packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
36 ## |
6070 | 37 ## @example |
38 ## pkg install image-1.0.0.tar.gz | |
39 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
40 ## |
6070 | 41 ## @noindent |
9307
c2923c27c877
Various documentation improvements
Rik <rdrider0-list@yahoo.com>
parents:
9258
diff
changeset
|
42 ## installs the package found in the file @file{image-1.0.0.tar.gz}. |
6070 | 43 ## |
6645 | 44 ## The @var{option} variable can contain options that affect the manner |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
45 ## in which a package is installed. These options can be one or more of |
6645 | 46 ## |
47 ## @table @code | |
48 ## @item -nodeps | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
49 ## The package manager will disable dependency checking. With this option it |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
50 ## is possible to install a package even when it depends on another package |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
51 ## which is not installed on the system. @strong{Use this option with care.} |
6645 | 52 ## |
53 ## @item -local | |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12931
diff
changeset
|
54 ## A local installation (package available only to current user) is forced, |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
55 ## even if the user has system privileges. |
6258 | 56 ## |
6645 | 57 ## @item -global |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
58 ## A global installation (package available to all users) is forced, even if |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
59 ## the user doesn't normally have system privileges. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12561
diff
changeset
|
60 ## |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
61 ## @item -forge |
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
62 ## Install a package directly from the Octave-Forge repository. This |
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
63 ## requires an internet connection and the cURL library. |
6614 | 64 ## |
20708
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
65 ## @emph{Security risk}: no verification of the package is performed |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
66 ## before the installation. There are no signature for packages, or |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
67 ## checksums to confirm the correct file was downloaded. It has the |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
68 ## same security issues as manually downloading the package from the |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
69 ## Octave Forge repository and installing it. |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
70 ## |
6645 | 71 ## @item -verbose |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
72 ## The package manager will print the output of all commands as |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
73 ## they are performed. |
6645 | 74 ## @end table |
75 ## | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
76 ## @item update |
13931
9de488c6c59c
doc: Spellcheck documentation before 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents:
13864
diff
changeset
|
77 ## Check installed Octave-Forge packages against repository and update any |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
78 ## outdated items. This requires an internet connection and the cURL library. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
79 ## Usage: |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
80 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
81 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
82 ## pkg update |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
83 ## @end example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
84 ## |
6032 | 85 ## @item uninstall |
6070 | 86 ## Uninstall named packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
87 ## |
6070 | 88 ## @example |
89 ## pkg uninstall image | |
90 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
91 ## |
6070 | 92 ## @noindent |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
93 ## removes the @code{image} package from the system. If another installed |
6070 | 94 ## package depends on the @code{image} package an error will be issued. |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10685
diff
changeset
|
95 ## The package can be uninstalled anyway by using the @option{-nodeps} option. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
96 ## |
6032 | 97 ## @item load |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
98 ## Add named packages to the path. After loading a package it is |
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
99 ## possible to use the functions provided by the package. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
100 ## |
6070 | 101 ## @example |
102 ## pkg load image | |
103 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
104 ## |
6070 | 105 ## @noindent |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
106 ## adds the @code{image} package to the path. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
107 ## |
6203 | 108 ## @item unload |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
109 ## Remove named packages from the path. After unloading a package it is |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
110 ## no longer possible to use the functions provided by the package. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
111 ## |
6032 | 112 ## @item list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
113 ## Show the list of currently installed packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
114 ## |
6070 | 115 ## @example |
19187 | 116 ## pkg list |
6070 | 117 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
118 ## |
6070 | 119 ## @noindent |
19187 | 120 ## will produce a short report with the package name, version, and installation |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
121 ## directory for each installed package. Supply a package name to limit |
19187 | 122 ## reporting to a particular package. For example: |
123 ## | |
124 ## @example | |
125 ## pkg list image | |
126 ## @end example | |
127 ## | |
128 ## If a single return argument is requested then @code{pkg} returns a cell | |
129 ## array where each element is a structure with information on a single | |
130 ## package. | |
131 ## | |
132 ## @example | |
133 ## installed_packages = pkg ("list") | |
134 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
135 ## |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
136 ## If two output arguments are requested @code{pkg} splits the list of |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
137 ## installed packages into those which were installed by the current user, |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
138 ## and those which were installed by the system administrator. |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12931
diff
changeset
|
139 ## |
6070 | 140 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
141 ## [user_packages, system_packages] = pkg ("list") |
6070 | 142 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
143 ## |
19187 | 144 ## The @qcode{"-forge"} option lists packages available at the Octave-Forge |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
145 ## repository. This requires an internet connection and the cURL library. |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17243
diff
changeset
|
146 ## For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
147 ## |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
148 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
149 ## oct_forge_pkgs = pkg ("list", "-forge") |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
150 ## @end example |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
151 ## |
7497 | 152 ## @item describe |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
153 ## Show a short description of installed packages. With the option |
21546
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
21518
diff
changeset
|
154 ## @qcode{"-verbose"} also list functions provided by the package. For |
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
21518
diff
changeset
|
155 ## example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
156 ## |
7497 | 157 ## @example |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
158 ## pkg describe -verbose |
7497 | 159 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
160 ## |
7497 | 161 ## @noindent |
162 ## will describe all installed packages and the functions they provide. | |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
163 ## Display can be limited to a set of packages: |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
164 ## |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
165 ## @example |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
166 ## pkg describe control signal # describe control and signal packages |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
167 ## @end example |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
168 ## |
7497 | 169 ## If one output is requested a cell of structure containing the |
170 ## description and list of functions of each package is returned as | |
171 ## output rather than printed on screen: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
172 ## |
7497 | 173 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
174 ## desc = pkg ("describe", "secs1d", "image") |
7497 | 175 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
176 ## |
7497 | 177 ## @noindent |
19187 | 178 ## If any of the requested packages is not installed, @code{pkg} returns an |
7497 | 179 ## error, unless a second output is requested: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
180 ## |
7497 | 181 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
182 ## [desc, flag] = pkg ("describe", "secs1d", "image") |
7497 | 183 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
184 ## |
7497 | 185 ## @noindent |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17243
diff
changeset
|
186 ## @var{flag} will take one of the values @qcode{"Not installed"}, |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17243
diff
changeset
|
187 ## @qcode{"Loaded"}, or |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17243
diff
changeset
|
188 ## @qcode{"Not loaded"} for each of the named packages. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
189 ## |
6034 | 190 ## @item prefix |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
191 ## Set the installation prefix directory. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
192 ## |
6070 | 193 ## @example |
194 ## pkg prefix ~/my_octave_packages | |
195 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
196 ## |
6070 | 197 ## @noindent |
9307
c2923c27c877
Various documentation improvements
Rik <rdrider0-list@yahoo.com>
parents:
9258
diff
changeset
|
198 ## sets the installation prefix to @file{~/my_octave_packages}. |
6070 | 199 ## Packages will be installed in this directory. |
6034 | 200 ## |
6070 | 201 ## It is possible to get the current installation prefix by requesting an |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
202 ## output argument. For example: |
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
203 ## |
6070 | 204 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
205 ## pfx = pkg ("prefix") |
6070 | 206 ## @end example |
6925 | 207 ## |
208 ## The location in which to install the architecture dependent files can be | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
209 ## independently specified with an addition argument. For example: |
6925 | 210 ## |
211 ## @example | |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9079
diff
changeset
|
212 ## pkg prefix ~/my_octave_packages ~/my_arch_dep_pkgs |
6925 | 213 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
214 ## |
6189 | 215 ## @item local_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
216 ## Set the file in which to look for information on locally |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
217 ## installed packages. Locally installed packages are those that are |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
218 ## available only to the current user. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
219 ## |
6189 | 220 ## @example |
221 ## pkg local_list ~/.octave_packages | |
222 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
223 ## |
6189 | 224 ## It is possible to get the current value of local_list with the following |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
225 ## |
6189 | 226 ## @example |
227 ## pkg local_list | |
228 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
229 ## |
6189 | 230 ## @item global_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
231 ## Set the file in which to look for information on globally |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
232 ## installed packages. Globally installed packages are those that are |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
233 ## available to all users. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
234 ## |
6189 | 235 ## @example |
236 ## pkg global_list /usr/share/octave/octave_packages | |
237 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
238 ## |
6189 | 239 ## It is possible to get the current value of global_list with the following |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
240 ## |
6189 | 241 ## @example |
242 ## pkg global_list | |
243 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
244 ## |
6675 | 245 ## @item build |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
246 ## Build a binary form of a package or packages. The binary file produced |
6675 | 247 ## will itself be an Octave package that can be installed normally with |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
248 ## @code{pkg}. The form of the command to build a binary package is |
6675 | 249 ## |
250 ## @example | |
251 ## pkg build builddir image-1.0.0.tar.gz @dots{} | |
252 ## @end example | |
253 ## | |
254 ## @noindent | |
9079
4d610aba7347
Cleanup documentation for system.texi, package.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
255 ## where @code{builddir} is the name of a directory where the temporary |
6675 | 256 ## installation will be produced and the binary packages will be found. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
257 ## The options @option{-verbose} and @option{-nodeps} are respected, while |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
258 ## all other options are ignored. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
259 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
260 ## @item rebuild |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
261 ## Rebuild the package database from the installed directories. This can |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
262 ## be used in cases where the package database has been corrupted. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
263 ## |
6032 | 264 ## @end table |
19192
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
19187
diff
changeset
|
265 ## @seealso{ver, news} |
11547 | 266 ## @end deftypefn |
5947 | 267 |
6496 | 268 function [local_packages, global_packages] = pkg (varargin) |
19187 | 269 |
8202
cf59d542f33e
replace all TODOs and XXXs with FIXMEs
Jaroslav Hajek <highegg@gmail.com>
parents:
8174
diff
changeset
|
270 ## Installation prefix (FIXME: what should these be on windows?) |
6645 | 271 persistent user_prefix = false; |
16304
c8e1b0213e34
pkg.m: Fix str-to-num warnings (bug #37785)
Rik <rik@octave.org>
parents:
16173
diff
changeset
|
272 persistent prefix = false; |
6925 | 273 persistent archprefix = -1; |
7498 | 274 persistent local_list = tilde_expand (fullfile ("~", ".octave_packages")); |
6496 | 275 persistent global_list = fullfile (OCTAVE_HOME (), "share", "octave", |
10549 | 276 "octave_packages"); |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14466
diff
changeset
|
277 |
14472
045a5b85495d
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14471
diff
changeset
|
278 ## If user is superuser set global_istall to true |
045a5b85495d
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14471
diff
changeset
|
279 ## FIXME: is it OK to set this always true on windows? |
045a5b85495d
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14471
diff
changeset
|
280 global_install = ((ispc () && ! isunix ()) || (geteuid () == 0)); |
6683 | 281 |
16304
c8e1b0213e34
pkg.m: Fix str-to-num warnings (bug #37785)
Rik <rik@octave.org>
parents:
16173
diff
changeset
|
282 if (isbool (prefix)) |
18448
b26d6be1767a
Move definifion of default package paths to separate function.
Carlo de Falco <cdf@users.sourceforge.net>
parents:
17744
diff
changeset
|
283 [prefix, archprefix] = default_prefix (global_install); |
6645 | 284 prefix = tilde_expand (prefix); |
6925 | 285 archprefix = tilde_expand (archprefix); |
6496 | 286 endif |
287 | |
19187 | 288 mlock (); |
289 | |
290 confirm_recursive_rmdir (false, "local"); | |
291 | |
7498 | 292 available_actions = {"list", "install", "uninstall", "load", ... |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
293 "unload", "prefix", "local_list", ... |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
294 "global_list", "rebuild", "build", ... |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
295 "describe", "update"}; |
19187 | 296 |
297 ## Parse input arguments | |
298 if (isempty (varargin) || ! iscellstr (varargin)) | |
6496 | 299 print_usage (); |
300 endif | |
301 files = {}; | |
302 deps = true; | |
303 action = "none"; | |
6614 | 304 verbose = false; |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
305 octave_forge = false; |
19187 | 306 for i = 1:numel (varargin) |
6496 | 307 switch (varargin{i}) |
308 case "-nodeps" | |
10549 | 309 deps = false; |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
310 ## TODO completely remove these warnings after some releases. |
6496 | 311 case "-noauto" |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
312 warning ("Octave:deprecated-option", |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
313 ["pkg: autoload is no longer supported. The -noauto "... |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
314 "option is no longer required."]); |
6496 | 315 case "-auto" |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
316 warning ("Octave:deprecated-option", |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
317 ["pkg: autoload is no longer supported. Add a "... |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
318 "'pkg load ...' command to octaverc instead."]); |
6614 | 319 case "-verbose" |
10549 | 320 verbose = true; |
13275
635db52feab4
pkg.m: Display verbose output immediately rather than buffering it.
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
321 ## Send verbose output to pager immediately. Change setting locally. |
635db52feab4
pkg.m: Display verbose output immediately rather than buffering it.
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
322 page_output_immediately (true, "local"); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
323 case "-forge" |
21434
1da428cbf401
deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents:
20852
diff
changeset
|
324 if (! __octave_config_info__ ("CURL_LIBS")) |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
15184
diff
changeset
|
325 error ("pkg: can't download from forge without the cURL library"); |
15184
0b29c16a2645
pkg: check cURL library when using -forge
Carnë Draug <carandraug+dev@gmail.com>
parents:
15058
diff
changeset
|
326 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
327 octave_forge = true; |
6645 | 328 case "-local" |
10549 | 329 global_install = false; |
330 if (! user_prefix) | |
18448
b26d6be1767a
Move definifion of default package paths to separate function.
Carlo de Falco <cdf@users.sourceforge.net>
parents:
17744
diff
changeset
|
331 [prefix, archprefix] = default_prefix (global_install); |
10549 | 332 endif |
6645 | 333 case "-global" |
10549 | 334 global_install = true; |
335 if (! user_prefix) | |
18448
b26d6be1767a
Move definifion of default package paths to separate function.
Carlo de Falco <cdf@users.sourceforge.net>
parents:
17744
diff
changeset
|
336 [prefix, archprefix] = default_prefix (global_install); |
10549 | 337 endif |
7497 | 338 case available_actions |
19187 | 339 if (! strcmp (action, "none")) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
340 error ("pkg: more than one action specified"); |
10549 | 341 endif |
19187 | 342 action = varargin{i}; |
6496 | 343 otherwise |
10549 | 344 files{end+1} = varargin{i}; |
5801 | 345 endswitch |
6496 | 346 endfor |
347 | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
348 if (octave_forge && ! any (strcmp (action, {"install", "list"}))) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
349 error ("pkg: '-forge' can only be used with install or list"); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
350 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
351 |
6496 | 352 ## Take action |
353 switch (action) | |
354 case "list" | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
355 if (octave_forge) |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
356 if (nargout) |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
357 local_packages = list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
358 else |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
359 list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
360 endif |
6496 | 361 else |
20480
ad7fe3cb6fd2
pkg: fix regression on output of pkg list (bug #45873)
Carnë Draug <carandraug@octave.org>
parents:
20475
diff
changeset
|
362 if (nargout == 1) |
ad7fe3cb6fd2
pkg: fix regression on output of pkg list (bug #45873)
Carnë Draug <carandraug@octave.org>
parents:
20475
diff
changeset
|
363 local_packages = installed_packages (local_list, global_list, files); |
ad7fe3cb6fd2
pkg: fix regression on output of pkg list (bug #45873)
Carnë Draug <carandraug@octave.org>
parents:
20475
diff
changeset
|
364 elseif (nargout > 1) |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
365 [local_packages, global_packages] = installed_packages (local_list, |
19187 | 366 global_list, |
367 files); | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
368 else |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
369 installed_packages (local_list, global_list, files); |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
370 endif |
6496 | 371 endif |
372 | |
373 case "install" | |
19187 | 374 if (isempty (files)) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
375 error ("pkg: install action requires at least one filename"); |
6496 | 376 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
377 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
378 local_files = {}; |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
379 unwind_protect |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
380 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
381 if (octave_forge) |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
382 [urls, local_files] = cellfun ("get_forge_download", files, |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
383 "uniformoutput", false); |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
384 [files, succ] = cellfun ("urlwrite", urls, local_files, |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
385 "uniformoutput", false); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
386 succ = [succ{:}]; |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
387 if (! all (succ)) |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
388 i = find (! succ, 1); |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
389 error ("pkg: could not download file %s from url %s", |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
390 local_files{i}, urls{i}); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
391 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
392 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
393 |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
394 install (files, deps, prefix, archprefix, verbose, local_list, |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
395 global_list, global_install); |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
396 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
397 unwind_protect_cleanup |
12931
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12779
diff
changeset
|
398 cellfun ("unlink", local_files); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
399 end_unwind_protect |
6496 | 400 |
401 case "uninstall" | |
19187 | 402 if (isempty (files)) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
403 error ("pkg: uninstall action requires at least one package name"); |
6496 | 404 endif |
19187 | 405 uninstall (files, deps, verbose, local_list, global_list, global_install); |
6496 | 406 |
407 case "load" | |
19187 | 408 if (isempty (files)) |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
409 error ("pkg: load action requires at least one package name"); |
6496 | 410 endif |
411 load_packages (files, deps, local_list, global_list); | |
412 | |
413 case "unload" | |
19187 | 414 if (isempty (files)) |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
415 error ("pkg: unload action requires at least one package name"); |
6496 | 416 endif |
417 unload_packages (files, deps, local_list, global_list); | |
418 | |
419 case "prefix" | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
420 if (isempty (files) && ! nargout) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
421 printf ("Installation prefix: %s\n", prefix); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
422 printf ("Architecture dependent prefix: %s\n", archprefix); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
423 elseif (isempty (files) && nargout) |
10549 | 424 local_packages = prefix; |
425 global_packages = archprefix; | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
426 elseif (numel (files) >= 1 && ischar (files{1})) |
16173
40a9a4e0d12a
pkg.m: Restore ability to use '~' in specifying prefix directories.
Rik <rik@octave.org>
parents:
15966
diff
changeset
|
427 prefix = tilde_expand (files{1}); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
428 if (! exist (prefix, "dir")) |
19187 | 429 [status, msg] = mkdir (prefix); |
14858
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
430 if (status == 0) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
431 error ("pkg: cannot create prefix %s: %s", prefix, msg); |
14858
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
432 endif |
20727
a5949b3d2332
Preface warning() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20726
diff
changeset
|
433 warning ("pkg: creating the directory %s\n", prefix); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
434 endif |
15058
3691a606283e
Fix typo in pkg.m reported in bug #36994.
Muhali <muhali@shaw.ca>
parents:
15000
diff
changeset
|
435 local_packages = prefix = canonicalize_file_name (prefix); |
10549 | 436 user_prefix = true; |
19187 | 437 if (numel (files) >= 2 && ischar (files{2})) |
16173
40a9a4e0d12a
pkg.m: Restore ability to use '~' in specifying prefix directories.
Rik <rik@octave.org>
parents:
15966
diff
changeset
|
438 archprefix = tilde_expand (files{2}); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
439 if (! exist (archprefix, "dir")) |
19187 | 440 [status, msg] = mkdir (archprefix); |
14858
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
441 if (status == 0) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
442 error ("pkg: cannot create archprefix %s: %s", archprefix, msg); |
14858
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
443 endif |
20727
a5949b3d2332
Preface warning() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20726
diff
changeset
|
444 warning ("pkg: creating the directory %s\n", archprefix); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
445 global_packages = archprefix = canonicalize_file_name (archprefix); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
446 endif |
10549 | 447 endif |
6496 | 448 else |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
449 error ("pkg: prefix action requires a directory input, or an output argument"); |
6496 | 450 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
451 |
6496 | 452 case "local_list" |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
453 if (isempty (files) && ! nargout) |
10549 | 454 disp (local_list); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
455 elseif (isempty (files) && nargout) |
10549 | 456 local_packages = local_list; |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
457 elseif (numel (files) == 1 && ! nargout && ischar (files{1})) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
458 local_list = files{1}; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
459 if (! exist (local_list, "file")) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
460 try |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
461 ## Force file to be created |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
462 fclose (fopen (local_list, "wt")); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
463 catch |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
464 error ("pkg: cannot create file %s", local_list); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
465 end_try_catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
466 endif |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
467 local_list = canonicalize_file_name (local_list); |
6496 | 468 else |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
469 error ("pkg: specify a local_list file, or request an output argument"); |
6496 | 470 endif |
471 | |
472 case "global_list" | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
473 if (isempty (files) && ! nargout) |
19187 | 474 disp (global_list); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
475 elseif (isempty (files) && nargout) |
10549 | 476 local_packages = global_list; |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
477 elseif (numel (files) == 1 && ! nargout && ischar (files{1})) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
478 global_list = files{1}; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
479 if (! exist (global_list, "file")) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
480 try |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
481 ## Force file to be created |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
482 fclose (fopen (files{1}, "wt")); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
483 catch |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
484 error ("pkg: cannot create file %s", global_list); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
485 end_try_catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
486 endif |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
487 global_list = canonicalize_file_name (global_list); |
6496 | 488 else |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
489 error ("pkg: specify a global_list file, or request an output argument"); |
6496 | 490 endif |
6645 | 491 |
492 case "rebuild" | |
493 if (global_install) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
494 global_packages = rebuild (prefix, archprefix, global_list, files, |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
495 verbose); |
10549 | 496 global_packages = save_order (global_packages); |
497 save (global_list, "global_packages"); | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
498 if (nargout) |
10549 | 499 local_packages = global_packages; |
500 endif | |
6645 | 501 else |
19187 | 502 local_packages = rebuild (prefix, archprefix, local_list, files, |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
503 verbose); |
10549 | 504 local_packages = save_order (local_packages); |
505 save (local_list, "local_packages"); | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
506 if (! nargout) |
10549 | 507 clear ("local_packages"); |
508 endif | |
6645 | 509 endif |
510 | |
6675 | 511 case "build" |
19187 | 512 if (numel (files) < 2) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
513 error ("pkg: build action requires build directory and at least one filename"); |
6675 | 514 endif |
21518
2ee20a290d61
pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents:
21434
diff
changeset
|
515 build (files{1}, files(2:end), verbose); |
6675 | 516 |
7497 | 517 case "describe" |
19187 | 518 ## FIXME: name of the output variables is inconsistent with their content |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
519 if (nargout) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
520 [local_packages, global_packages] = describe (files, verbose, |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
521 local_list, global_list); |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
522 else |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
523 describe (files, verbose, local_list, global_list); |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
524 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
525 |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
526 case "update" |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
527 installed_pkgs_lst = installed_packages (local_list, global_list); |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
528 if (numel (files) > 0) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
529 update_lst = {}; |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
530 installed_names = {installed_pkgs_list.name}'; |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
531 for i = 1:numel (files) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
532 idx = find (strcmp (files{i}, installed_names), 1); |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
533 if (isempty (idx)) |
20727
a5949b3d2332
Preface warning() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20726
diff
changeset
|
534 warning ("pkg: package %s is not installed - skipping update", files{i}); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
535 else |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
536 update_lst = { update_lst, installed_pkgs_lst{idx} }; |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
537 endif |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
538 endfor |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
539 installed_pkgs_lst = update_lst; |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
540 endif |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
541 for i = 1:numel (installed_pkgs_lst) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
542 installed_pkg_name = installed_pkgs_lst{i}.name; |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
543 installed_pkg_version = installed_pkgs_lst{i}.version; |
21998
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
544 try |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
545 forge_pkg_version = get_forge_pkg (installed_pkg_name); |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
546 catch |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
547 warning ("pkg: package %s not found on forge - skipping update\n", |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
548 installed_pkg_name); |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
549 forge_pkg_version = "0"; |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
550 end_try_catch |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
551 if (compare_versions (forge_pkg_version, installed_pkg_version, ">")) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
552 feval (@pkg, "install", "-forge", installed_pkg_name); |
18556
4daf647c86c3
Implement pkg update pkgnametoupdate (Bug #41732)
John Donoghue <john.donoghue@ieee.org>
parents:
17744
diff
changeset
|
553 endif |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
554 endfor |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
555 |
6496 | 556 otherwise |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
557 error ("pkg: invalid action. See 'help pkg' for available actions"); |
6496 | 558 endswitch |
19187 | 559 |
6496 | 560 endfunction |