apm_generate_tarball

one of the documented procedures in this installation of the ACS
Usage:
apm_generate_tarball   version_id
What it does:
Generates a tarball for a version, placing it in the version's distribution_tarball blob.
Defined in: /web/philip/packages/acs-core/apm-procs.tcl

Source code:


    set files [apm_version_file_list $version_id]

    set tmpfile [ns_tmpnam]

    db_1row "select package_key from apm_package_version_info where version_id = $version_id"

    # Generate a command like:
    #
    #   tar cf - -C /web/arsdigita/packages acs-core/00-proc-procs.tcl  #                 -C /web/arsdigita/packages 10-database-procs.tcl ...   #     | gzip -c > $tmpfile
    #
    # Note that -C changes the working directory before compressing the next
    # file; we need this to ensure that the tarballs are relative to the
    # package root directory ([acs_root_dir]/packages).

    set cmd [list exec tar cf -]
    foreach file $files {
	lappend cmd -C "[acs_root_dir]/packages"
	lappend cmd "$package_key/$file"
    }

    lappend cmd "|" "[ad_parameter GzipExecutableDirectory "" /usr/local/bin]/gzip" -c ">" $tmpfile
    eval $cmd

    # At this point, the APM tarball is sitting in $tmpfile. Save it in the database.

    db_with_handle db {
	ns_ora blob_dml_file $db "
            update apm_package_versions
            set distribution_tarball = empty_blob(),
                distribution_url = null,
                distribution_date = sysdate
            where version_id = $version_id
            returning distribution_tarball into :1
        " $tmpfile
    }

    file delete $tmpfile


philg@mit.edu