Forum OpenACS Development: Re: TWiST OpenACS package

Collapse
4: Re: TWiST OpenACS package (response to 3)
Posted by Tom Jackson on
I hope someone can answer this question, but my guess is that the parameters are not added to the database before the tcl scripts (twist-procs.tcl and twist-init.tcl) are run.

Oh, wait! the default appears to be '1]', I'll see where that shows up in the source.

Collapse
6: Re: TWiST OpenACS package (response to 4)
Posted by Malte Sussdorff on
The problem does not lie in the 1, it lies in the fact that you run "init" in the before-install block. As the name implies, it is executed "before install", meaning the parameters are not yet written into the database as the package is not yet installed. Remove it and you are fine at this point :)

Furthermore you need to have SVN installed, which is not a good thing to require. Why not provide it at a download location (url) where one can download a .tar.gz?

After solving this riddle I hit the road again with the init in the after_install and here I am not sure why the parameter is not yet installed, but well. Do we really need it there? After all you are restarting the server after an install of a package anyway, and init runs upon server start, so ....

Just a minor thing though. As per convention the callback procedures (to which before_install and after_install belong) are put into a file $package_name-callback-procs.tcl or apm-callback-procs.tcl (new / old convention). But this is not documented in the developers guide, I think 😊.

Collapse
8: Re: TWiST OpenACS package (response to 6)
Posted by Tom Jackson on
There is a new version up at http://junom.com/openacs/ (0.9.3.2).

I finally figured it out, I hope. Before-install means that a Tcl proc is run prior to loading any database code. After-install means after the database code has been run. Both seem to run before APM considers the package to be installed, so it is before there is a package_id, so you can't use parameter::set... in either of these.

But there is another issue as well: I was thinking that the package parameters would be initially taken from the twist.info file, but they are not. This means that if you don't like the defaults (except the mount point, which works), you need to change them in twist-procs.tcl in the proc ::twist::install::init.

Although the normal install requires subversion, it isn't necessary. I don't have subversion on the server where I created the package; on the other hand, I don't have wget on my local machine, so coming up with an 'always sure to work' solution may not be possible. Here is the reasoning behind the way the package works:

If you want to upgrade TWiST, go to the application instance and change the version parameter. Restart your server. The old version remains in place, and you can revert back to it if there is some issue with the new version, just change the version number back and restart the server. You can remove the old version if you wish. The upgrade of TWiST version doesn't affect the OpenACS package.

The new OpenACS package removes the 'initialized' parameter and replaces it with an 'installed' parameter. The default in twist.info is '1', but until the package is installed, the 'init' procedure sets it to '0'. Once this becomes '1', which means that the package is installed, the sourceDirectory parameter is updated with the Tcl default. This parameter is set in Tcl code to [ns_info tcllib], so if you want the TWiST source somewhere else, you have to edit the Tcl code prior to installation, or change the sourceDirectory parameter and restart the server, after installation. This will force a re-download of the code using svn ... or just move it by hand into place and restart.