Attempting to install Ffidl using teacup

Posted by kmorlang on 2010-11-02 10:15

When I use teacup to try to install Ffidl from my local drive I get this error message:
Unable to install. No TEAPOT meta data found in TM archive
"C:/Users/kpmorlax/AppData/Local/Temp/tpmqAZzC06xR4", no
embedded meta data block

This is the command line:
C:\Users\kpmorlax>teacup install C:\Users\kpmorlax\Documents\WCS\TCL\Ffidl0.6\pk
gIndex.tcl

(imagine it's all on one line).

andreas.kupries
ActiveState Staff
Tue, 2010-11-02 12:57

When installing a file the 'install' method of teacup expects to get either

(1) A Tcl Module, which is a package in a single file, which can be sourced. This file has to contain the meta data expected by teacup in the beginning of the file. Use 'teacup get aes' to get a few files demonstrating this format.

(2) Or a .zip archive containing the files of the package. There the meta data is expected in a file teapot.txt. Use 'teacup get Trf' to get a few files in this format.

See also the documentation at http://docs.activestate.com/activetcl/8.5/tpm/tpm/files/CTP_metadata.html for the format of meta data, and
http://docs.activestate.com/activetcl/8.5/tpm/tpm/files/CTP_teazip.html
about the 'teapot-pkg' command line tool which helps in the conversion of a regular directory structure for a package into a .tm or .zip per (1) and (2). There is also the TclPE gui tool (http://docs.activestate.com/tdk/5.0/Package.html). Both are part of the Tcl Dev Kit. As the relevant files (teapot.txt) are plain text files they can be created with a regular editor as well.

The main thing to take home here is that you have to prepare your package (ffidl here) a bit before teacup will accept it as proper archive. The pkgIndex.tcl is no such proper archive.

kmorlang | Tue, 2010-11-02 13:26

Thanks for the help. I also looked at the meta data requirements in ActiveTcl and found that I could put the required meta data entries in the pkgIndex.tcl file, at the top. I used this:
# @@ Meta Begin
# Package Ffidl 0.6
# Meta platform win32-x86_64
# @@ Meta End

and it allows teacup to install without error. However, now the library is not found in the search routine that uses "::info load" -

proc ::ffidl::find-pkg-lib {pkg} {
package require $pkg
foreach i [::info loaded {}] {
foreach {l p} $i {}
if {$p eq "$pkg"} {
return $l
}
}
# ignore errors when running under pkg_mkIndex:
if {![llength [info commands __package_orig]] } {
return -code error "Library for package $pkg not found"
}
}

andreas.kupries
ActiveState Staff
Wed, 2010-11-03 07:51

When you put the meta data into pkgIndex.tcl like you described then pkgIndex.tcl will be treated like case (1) of my description. That means pkgIndex.tcl is considered to be the only file of the package and thus the only file which got installed. Making it a broken unusable thing, not even looking for its files, and if it were it would not be able to find them in the expected place. This way of installing multi-file packages is not supported by teacup. Go with (2).