661
edits
Carandraug (talk | contribs) m (→Package names: undo unmade inbetween changes) |
Carandraug (talk | contribs) (expanding explanantion of type of installs and one more user case) |
||
Line 7: | Line 7: | ||
This document attempts to design a solution for this. | This document attempts to design a solution for this. | ||
The main idea | The main idea is to have multiple databases with information from installed packages | ||
in different locations in the filesystem. While this is similar to the current implementation, | |||
we plan to design solutions for when package installations clash. | |||
This proposal also suggests to keep the source of the packages. This will allow for | |||
easy reinstall of packages (after an Octave upgrade) and test of .oct files from | |||
packages (since their tests are in the .cc sources). | |||
== Rationale | == Rationale == | ||
This design is meant to allow the following: | This design is meant to make allow the following: | ||
* keep multiple versions of the same package installed side-by-side | |||
* keep multiple versions of Octave in a system using the same installed packages | |||
* deal with dependencies correctly when multiple Octave and packages co-exist | |||
* allow use of packages that may have been installed anywhere | |||
* reinstall a package | |||
* test installed packages | |||
See the user cases section below for several examples. | |||
== Available vs Loaded == | == Available vs Loaded == | ||
To avoid problems reading this document, the distinction between available and loaded | To avoid problems reading this document, the distinction between available and loaded | ||
package should be done early. An available package is a package that is currently | package should be done early. | ||
available to pkg | |||
A loaded package is an installed package whose functions have been added to Octave's function search | An available package is a package that is currently available to pkg for loading, | ||
path. | unloading or reinstall. It is already installed but not necessarily loaded. | ||
A loaded package is an installed package whose functions have been added to Octave's | |||
function search path. | |||
== Types of package installs == | == Types of package installs == | ||
This design supports 3 types of package installations: global (relative to the | This design supports 3 types of package installations: global (relative to the | ||
Octave installation), local (user specific) and external (in any other place). | |||
;global install | |||
: available from startup to everyone. | |||
;local install | |||
: available from startup only for the user that installed it. | |||
;external install | |||
: needs to be made available first. Octave install has no information about it. | |||
Note that Octave itself can be installed in some different ways. It might be a system-wide | |||
installation (located somewhere in {{Path|/usr/local/}} for example), a local installation | |||
of a normal user ({{Path|/home/user/anywhere}}), or installed in the home | |||
directory of a system user (anywhere really). | |||
=== Global installs === | === Global installs === | ||
Packages installed globally will be available to everyone from startup. This is the | Packages installed globally will be available to everyone from startup. This is the | ||
type of package installation that a system administrator would do | type of package installation that a system administrator would most likely do. The | ||
meaning of global here is relative to the Octave installation though. If an Octave | meaning of global here is relative to the Octave installation though. If an Octave | ||
installation is local (installed by a user in ~/ | installation is local (installed by a user in {{Path|~/my-builds}}), a global installation | ||
of a package will still place its files in the home directory of the user (in | of a package will still place its files in the home directory of the user (in | ||
~/ | {{Path|~/my-builds}}). | ||
A global installation is performed automatically if the user installing the package | A global installation is performed automatically if the user installing the package | ||
has write permissions to those directories (localfcnfiledir and localapioctfiledir). | has write permissions to those directories (''localfcnfiledir'' and ''localapioctfiledir''). | ||
In case it has no permissions, a local package installation is performed instead. | In case it has no permissions, a local package installation is performed instead. | ||
=== Local installs === | === Local installs === | ||
Local packages are specific to a user. They are located in that user home directory | Local packages are specific to a user. They are located in that user home directory | ||
into | into an {{Path|.octave}} directory. As with global package installations, they are available | ||
from startup. Unlike global, they are user specific, only available to the user that | from startup. Unlike global, they are user specific, only available to the user that | ||
installed it. A local install for a user can be an external install for some other | installed it. A local install for a user can be an external install for some other | ||
user. | user. | ||
This are the type of package installation done by users that want to have the latest | |||
package version before is available in their system repository, but are not going to | |||
build Octave themselves. Also to be used by those who run Octave in a system that they | |||
do not maintain where Octave is installed but not packages. | |||
=== External installs === | === External installs === | ||
These are like local packages but in a non-standard location. Octave does not know | These are like local packages but in a non-standard location. Octave does not know | ||
about this installations at startup even | about this installations at startup even though they might have been installing the | ||
Octave | same Octave that is running at the moment. These can be packages installed in a | ||
mounted, local packages installs from another user in the same system, or anything | filesystem that is not always mounted, local packages installs from another user | ||
else really. | in the same system, or anything else really. | ||
An external package was installed with pkg, | An external package was still installed with pkg, the difference being that the | ||
by Octave. An external package install will have a | record is not kept by Octave after it. An external package install will have a db | ||
associated file just like the db files for the local installs. To load an external | |||
file needs to be passed to pkg and the db named | package, the path for the db file needs to be passed to pkg and the db named (because | ||
there may be more than onde db. | |||
These are most like the less used type of packages and will require a bit more | |||
the | knowledge (they will need to point pkg to a .db file, that is all). They will be | ||
mostly used for places that develop their own packages and people who don't want to | |||
the packages | install the package themselves, instead simply using a local install of others as | ||
an external package. | |||
=== Playing nice with downstream packagers === | |||
The recommended method for installing Octave and its packages is to use their OS packaging | |||
system. Downstream packagers should have the packaging systems make global installs of the | |||
packages. If a user wants to install a new version of a package that is not yet available | |||
on its system repository, it should make a local package install (default since has a normal | |||
user he won't have write permissions to the Octave directory). | |||
If the user decides to make a global package install (install the package using pkg while | |||
runnig Octave with sudo), then he's trying to act as system administrator and should know | |||
what he's doing. If he breaks it, its his own fault. Installation of system-wide software | |||
is meant to be handled by the system packaging tool. It is just not possible to make pkg | |||
cover all of them. | |||
=== User case #1 === | |||
Jenny is using Octave on the department cluster. She is not the administrator but | |||
there's already a system-wide installation of Octave with the general and | |||
signal image installed. She starts Octave and has these 2 packages available to | |||
her. These are globally installed packages, available to everyone that starts | |||
Octave. | |||
But Jenny also requires the image package and she installs it with "pkg install -forge image". She | |||
does not have permissions to administer the system so the image package is installed | |||
locally in her home directory. When she starts Octave, she now has 3 packages available, | |||
general and signal package which are global (available to everyone that starts Octave), and | |||
the image package which is local (available only to her). | |||
Jenny's supervisor is working on a new package (img_analysis) that he makes available | |||
for all his students and wants Jenny to use it. Rather than sending them the packages, | |||
he wants them to use the package he has installed on his own home directory and tells | |||
them to load it as an external package. Jenny uses | |||
"pkg load-db boss /home/supervisor/.octave/octave_packages.db" to make his supervisor | |||
packages available to her. She now has 4 available packages, the new one (img_analysis) | |||
being an external package. However, relative to her supervisor, the same package is a | |||
local installation. | |||
The next time she starts Octave, there is no trace of the external packages, pkg still | |||
only have 3 available packages so she adds the "pkg load-db" command to her {{Path|.octaverc}} | |||
file. | |||
In this case however, her supervisor would do better in installing his img_analysis package | |||
in some other place to avoid clash with his own local packages. For example, he could | |||
have installed it at {{Path|/home/supervisor/group/octave}}. Or he could have a filesystem | |||
on the network that his students could mount whenever they needed it. | |||
== Package names == | == Package names == | ||
Line 94: | Line 159: | ||
be loaded? I'd propose the default to be: | be loaded? I'd propose the default to be: | ||
- load the latest version availale | |||
- load the local install of the package | |||
- load the global install of the package | |||
- load the package from the external .db, starting from the latest added in case there's more than one. | |||
For package names, the proposal is to limit package names to the same as variable | For package names, the proposal is to limit package names to the same as variable | ||
Line 105: | Line 170: | ||
it would create problems when installing packages in filesystems that are not case | it would create problems when installing packages in filesystems that are not case | ||
sensitive (creating directories named Image and image would not be possible in FAT | sensitive (creating directories named Image and image would not be possible in FAT | ||
systems). | |||
== User cases == | == User cases == | ||
=== | |||
=== User case #2 === | |||
Denise installs Octave 3.4.3 and installs the latest version of the financial (1.0.4) and | Denise installs Octave 3.4.3 and installs the latest version of the financial (1.0.4) and | ||
image (2.0.0) package with "pkg install -forge financial image". After installing the packages, | image (2.0.0) package with "pkg install -forge financial image". After installing the packages, | ||
Line 135: | Line 202: | ||
will only load financial 1.0.4. | will only load financial 1.0.4. | ||
=== | === User case #3 === | ||
Owen is stuck using the financial package 1.0.4 because some of his code no | Owen is stuck using the financial package 1.0.4 because some of his code no | ||
longer works in the latest versions. However the latest version of financial | longer works in the latest versions. However the latest version of financial | ||
Line 149: | Line 212: | ||
while "pkg load financial" always loads the latest version of the package. | while "pkg load financial" always loads the latest version of the package. | ||
=== | === User case #4 === | ||
Lisa is using Octave in a remote machine on the biochemistry department. The | Lisa is using Octave in a remote machine on the biochemistry department. The | ||
system administrator installed Octave 3.6.2, signal package 1.2.0, and | system administrator installed Octave 3.6.2, signal package 1.2.0, and | ||
Line 162: | Line 225: | ||
does not want to make the update and tells her to build it herself locally | does not want to make the update and tells her to build it herself locally | ||
=== | === User case #5 === | ||
Diana is a student that wants to run her code in the departmental cluster. However, | Diana is a student that wants to run her code in the departmental cluster. However, | ||
the system does not have an installation of Octave and she needs to install it on | the system does not have an installation of Octave and she needs to install it on | ||
Line 183: | Line 246: | ||
to her own list of available packages. which she can load. | to her own list of available packages. which she can load. | ||
=== | === User case #6 === | ||
John is a professor of biomechanics and uses Octave on his classes. Most of the | John is a professor of biomechanics and uses Octave on his classes. Most of the | ||
exercises he gives to the class require the use of multiple packages in Octave | exercises he gives to the class require the use of multiple packages in Octave |