apm_serve_archive

one of the documented procedures in this installation of the ACS
Usage:
apm_serve_archive
What it does:
Serves a tarball (.apm file) for a package.
Defined in: /web/philip/packages/acs-core/apm-admin-procs.tcl

Source code:


    ad_page_variables {
	version_id
    }

    set files [db_list "select path from apm_package_files where version_id = $version_id order by path"]
    if { [llength $files] == 0 } {
	return
    }

    db_1row "
    select p.package_key, p.package_url, v.*
    from   apm_packages p, apm_package_versions v
    where  v.version_id = $version_id
    and    v.package_id = p.package_id
    "
    
    set version_tag [apm_package_version_release_tag $package_key $version_name]
    ns_log "Notice" "Version tag is $version_tag"

    set tmpdir [ns_tmpnam]
    set cvs    [ad_parameter CvsPath vc]

    foreach file $files {
	set full_path [acs_package_root_dir $package_key]/$file
	set cvsroot   [vc_fetch_root $full_path]
	set tmpfile   "$tmpdir/$package_key/$file"
	
	file mkdir [file dirname $tmpfile]
	exec $cvs -q -d $cvsroot update -p -r $version_tag $full_path > $tmpfile
    }

    set tmpfile [ns_tmpnam]

    exec tar cf - -C $tmpdir $package_key |  "[ad_parameter GzipExecutableDirectory "" /usr/local/bin]/gzip" -c > $tmpfile

    ns_returnfile 200 application/octet-stream $tmpfile

    file delete -force $tmpdir
    file delete $tmpfile


philg@mit.edu