one of the documented procedures in this installation of the ACS
apm_extract_tarball   version_id   dir
What it does:
Extracts a distribution tarball into a particular directory, overwriting any existing files.
Defined in: /web/philip/packages/acs-core/apm-procs.tcl

Source code:

    set apm_file [ns_tmpnam]
    db_with_handle db { 
	ns_ora blob_get_file $db "select distribution_tarball from apm_package_versions where version_id = $version_id" $apm_file

    file mkdir $dir
    # cd, gunzip, and untar all in the same subprocess (to avoid having to
    # chdir first).
    exec sh -c "cd $dir ; [ad_parameter GzipExecutableDirectory "" /usr/local/bin]/gunzip -c $apm_file | tar xf -"
    file delete $apm_file