Teaget is a tcl only script that can be used as a command line utility to retrieve packages, applications and profiles from the ActiveTcl web repository. Teaget mimics some of commands implemented by teacup, but is not part of ActiveTcl.
The idea comes to me after read this discussion between jcw and Jeff Hobbs on "Teacup/-pot questions" [L1 ], particularly this statement:
> Which brings up multiple-choice question 3a: is there a way to access > a teapot repository directly over the net? Yes / no / please don't / > not ever / not yet / no interest? http://teapot.activestate.com/ While not intended for human consumption, the server itself does serve something you can browse. Jeff
My intention was to make a tcl only script to download and install packages from the repository. I think teaget solve some of the troubles and cons of teacup:
% time {exec teacup search Expect >@ stdout} entity name version platform ------- ------------ ------------------------- --------------------- package Expect 5.43 win32-ix86 package Expect 5.43.0 aix-powerpc package Expect 5.43.0 hpux-parisc package Expect 5.43.0 linux-glibc2.2-ix86 ... ------- ------------ ------------------------- --------------------- 115 entities found Problems which occurred during the operation: * http://teapot.activestate.com : Retrieval of INDEX failed (timeout). The system used slow(er) remote queries to keep working. Please use the 'teacup timeout' command to adjust or disable the transfer timeout. It is currently set to 30 seconds. 34059168 microseconds per iteration
My internet connection is not fast really, but 34 seconds are too much for me.
Just make the same with teaget. First we have to 'refresh' the packages list, wich takes around 16 seconds:
% time {exec teaget refresh >@ stdout} Retrieving 'list' 15834230 microseconds per iteration
But then I can make search without require retrieve the package list every time.
% time {exec teaget search Expect >@ stdout} package Expect 5.44.1.3 linux-glibc2.3-ix86 0 package Expect 5.44.1.3 linux-glibc2.3-x86_64 0 package Expect 5.44.1.4 linux-glibc2.3-x86_64 0 ... 25 entities found. 74308 microseconds per iteration
Really fast! Note also that teaget only show packages for architectures selected.
There is no secrets for the difference in the execution time of the same command: teaget make a cache with the big package list and the details page for every package when is used. These pages not change all the time, so can be very efficient to store it. If you want to clear the cache, just run teaget purge.
I made a google code site to store some of my tcl projects. Teaget is a single tcl file that can be downloaded from here: [L2 ]
Be sure to select the latest version, and you must rename it to "teaget.tcl" after download.
In order to use teaget you need to edit some settings:
To use teaget with a tclkit you need another tclkit or tclsh and then run:
> tclsh teaget.tcl link path-to-tclkit (choose the tclkit architecture) Tclkit 'path-to-tclkit' patched successfully
Then using the patched tclkit:
> tclkit % package require tdom can't find package tdom % exit > tclkit teaget.tcl install tdom Checking dependencies of entity 'tdom' Retrieving 'package/name/tdom/ver/0.8.3/arch/win32-ix86/details' The following entities need to be installed in your system. package tdom 0.8.3 win32-ix86 0 1 entities required. 1 entities to install. Do you want to continue? (y/n): Downloading '/package/name/tdom/ver/0.8.3/arch/win32-ix86/file.zip' Progress: 177.967 Kb / 177.967 Kb (100%) > tclkit % package require tdom 0.8.3
Windows:
@tclkitsh path-to-teaget.tcl %*
Linux:
#!/bin/sh exec tclkit path-to-teaget.tcl ${1+"$@"}
I use this to keep teaget.tcl in a user directory, so I can edit without use sudo.
To enable the auto-completion of subcommands from the console (bash), these steps are required:
_teaget() { local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" opts="help search refresh link unlink purge install settings" if [[ ${cur} == * ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi } complete -F _teaget teaget
source path-to-completion.bash
> teag<TAB> i<TAB>
and the line will be completed to:
> teaget install
Also you can type:
> teaget <TAB>
and all the possibilities should be displayed:
> teaget help link refresh settings install purge search unlink
If you are lazy to type like me, you will love this feature!
gasty Please let me know your opinions/critics/whatever.
RLH So this snags them over HTTP like a Tcl wget? If that is so, good! I know I can set a "proxy" for teacup but my firewall guys never give that out and this might let me work around that.
If there are teacup commands that would help to give you an idea for the defaults above maybe those would be good to list. For example, teacup default, tells you the location of the teapot directory. Just a thought...
gasty Try "teaget settings":
>teaget settings * TEAget settings * Directory used as cache: 'C:/Documents and Settings/gaston/.teaget/cache' Tcl version: '8.6' Platforms supported: win32-ix86 tcl Library paths: D:/Tcl/teapot/win32-ix86 D:/Tcl/teapot/tcl
LV You should be cautious about mixing teaget and teacup directories. There are checksums, etc. that teacup maintains and if you start adding new files or overwriting files you could end up with your local repository in an unusable state. gasty That is very true!
jblz Rock on! Great work gasty!