apm_extract_tarball (public)

 apm_extract_tarball version_id dir

Defined in packages/acs-tcl/tcl/apm-file-procs.tcl

Extracts a distribution tarball into a particular directory, overwriting any existing files. DCW - 2001-05-03, modified to extract tarball from content repository.

Parameters:
version_id
dir

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_tarballs apm_tarballs (test acs-tcl) apm_extract_tarball apm_extract_tarball test_apm_tarballs->apm_extract_tarball ad_tmpnam ad_tmpnam (public) apm_extract_tarball->ad_tmpnam apm_dev_null apm_dev_null (private) apm_extract_tarball->apm_dev_null apm_gzip_cmd apm_gzip_cmd (public) apm_extract_tarball->apm_gzip_cmd apm_tar_cmd apm_tar_cmd (public) apm_extract_tarball->apm_tar_cmd db_blob_get_file db_blob_get_file (public) apm_extract_tarball->db_blob_get_file

Testcases:
apm_tarballs
Source code:
    set apm_file [ad_tmpnam]

    db_blob_get_file distribution_tar_ball_select {
        select content
        from cr_revisions
        where revision_id = (select content_item.get_latest_revision(item_id)
                             from apm_package_versions
                             where version_id = :version_id)
    } -file $apm_file

    file mkdir $dir

    #
    # This would avoid the exec and could also be used elsewhere, but
    # there are known issues with the tar package. See
    # e.g. https://groups.google.com/g/comp.lang.tcl/c/vDKy7x_Q0cM/m/noKeUD6UCAAJ
    # or
    # https://core.tcl-lang.org/tcllib/tktview/27bed812fa2ec3d5d1aa96a31f7cad2f7917ad14.
    #
    # set rfd [open $apm_file rb]
    # zlib push gunzip $rfd
    # package require tar
    # ::tar::untar $rfd -chan -dir $dir
    # close $rfd
    #

    exec [apm_gzip_cmd] -d -q -c -S .apm $apm_file | [apm_tar_cmd] -xf - -C $dir 2> [apm_dev_null]

    file delete -- $apm_file
Generic XQL file:
packages/acs-tcl/tcl/apm-file-procs.xql

PostgreSQL XQL file:
<fullquery name="apm_extract_tarball.distribution_tar_ball_select">
    <querytext>

   select '[cr_fs_path]' || r.content as content, i.storage_type
     from cr_revisions r, cr_items i
    where r.item_id = i.item_id
      and r.revision_id = (select content_item__get_latest_revision(item_id)
                             from apm_package_versions 
                            where version_id = :version_id)

      </querytext>
</fullquery>
packages/acs-tcl/tcl/apm-file-procs-postgresql.xql

Oracle XQL file:
<fullquery name="apm_extract_tarball.distribution_tar_ball_select">
    <querytext>

   select  '[cr_fs_path]' || r.filename as content, i.storage_type
     from cr_revisions r, cr_items i
    where r.item_id = i.item_id
      and r.revision_id = (select content_item.get_latest_revision(item_id)
                           from apm_package_versions 
                          where version_id = :version_id)

      </querytext>
</fullquery>
packages/acs-tcl/tcl/apm-file-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: