On 3/15/25 11:35, Scott Pitcher wrote:
Hi,
I'm having a little trouble loading a specific version of a package in
my Rivet based website.
I have a package called Lockfile 1.0 which was originally part of the
website base code. That lives in a directory titled "3rdparty". During
the ChildInitScript (called "childboot.tcl") this directory is added to
the auto_path -
namespace eval ::Website {
variable website ; # Where all library and site
configuration is stored.
try {
#
# Setup the library directories.
#
set website(basedir) [file dir [info script]]
set website(logdir) [file join $website(basedir) .. log]
set website(libdir) [file join $website(basedir) lib]
* set website(3rdpartydir) [file join $website(basedir) .. 3rdparty]*
set website(tmpdir) [file join $website(basedir) .. tmp]
..............................................................................................
#
# Set the path for loading tclIndex files. This is all we need and
the rest of the library
# will load. Any source directories in the website configuration
should be in
# website(SourceDirs) after content is loaded, and we'll set those
after.
#
lappend ::auto_path [file normalize $website(libdir)]
if {[file isdirectory $website(3rdpartydir)]} {
*lappend ::auto_path [file normalize $website(3rdpartydir)]*
}
Further down this script calls the childinit.tcl which loads the website
content, opens data bases etc and three of those modules "package
require Lockfile" and away it goes and just works.
Well it did, until I installed a Lockfile 1.1 package independently in /
usr/local/lib/tcltk. This was a more recent version and I was using it
with some other tools not related to the Rivet website. This library was
not completely compatible with the version sitting alongside the Rivet
website, but all good - I'd changed the version number to 1.1.
Over on the website the incompatible library caused the Apache threads
to run at 50% CPU and it sat there and span its wheels. The old Lockfile
automatically waited but the new one doesn't so the database maintenance
threads were running as fast as the CPU would let them. The new 1.1
library has a -wait option so as to act like the old version.
it's advisable to introduce some delay in a thread loop to avoid races
on the processor's cores
So I thought easy - require Lockfile 1.0, and the package can be loaded
out of the 3rdparty directory like it did before -
namespace eval ::TicketMaster {
package require Thread
package require sha1
package require -exact Lockfile 1.0
But no, now it fails with a complaint that it needs 1.0 but it has 1.1,
with the 1.1 being the package over in /usr/local......
I got lost. Are you trying to load two versions of a package within the
same interpreter? But if they provide commands within the same namespace
how can they coexist?
-- Massimo
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org