On Sat, Mar 08, 2014 at 04:44:29AM -0800, Philip Nienhuis wrote:
Julien Bect wrote
Hi everyone,
Is there any reason why the PKG_ADD/PKG_DEL scripts located at the root
of a package source (.tar.gz) should end up being moved to the
arch-dependent subdirectory after installation with "pkg install" ?
Because this is the behaviour that I currently observe while trying to
create my first octave package (Octave 3.8.1 / Ubutu 13.04).
The documentation here :
http://www.gnu.org/software/octave/doc/interpreter/Creating-Packages.html
doesn't say explicitely where PKG_ADD will be, just that it is "run when
the package is added to the users path".
If there is a arch-dependent subdir (some OF packages don't have one),
PKG_ADD will end up there. Otherwise PKG_ADD ends up in the scripts subdir
(AFAIK, I'm not sure).
Yep, sometimes this behavior is very undesired.
E.g. in the io package, PKG_ADD (in the arch-dependent subdir) was already
run when the package hadn't fully been loaded yet, so a number of commands
needed for proper operation of the io package couldn't be executed.
That's why in post_install.m I entered some stanzas that move PKG_ADD to the
scripts subdir.
If it solves your problem you can copy those lines to your package's
post_install.m.
A better solution would be some flag in e.g. the file DESCRIPTION in the
package .tar.gz telling pkg.m where PKG_ADD is to be moved to.
AFAIK the arch-debendent path is added (with addpath) after the
scripts path in 'pkg install', so since the rootdir/PKGADD directives
get into the arch-dependent directory, they won't be executed until
both the scripts directory and the arch-dependent directory are in
Octaves path.
This seems reasonable to me and shoudn't cause problems
in 'pkg install'.