apm_install_package_spec

one of the documented procedures in this installation of the ACS
Usage:
apm_install_package_spec   version_id
What it does:
Writes the XML-formatted specification for a package to disk, marking it in the database as the only installed version of the package. Creates the package directory if it doesn't already exist. Overwrites any existing specification file; or if none exists yet, creates $package_key/$package_key.info and adds this new file to apm_version_files in the database.
Defined in: /web/philip/packages/acs-core/apm-procs.tcl

Source code:


    set spec [apm_generate_package_spec $version_id]

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

    set root [acs_package_root_dir $package_key]
    if { ![file exists $root] } {
	file mkdir $root
	file attributes $root -permissions [ad_parameter "InfoFilePermissionsMode" "apm" 0755]
    }

    db_transaction {
	# Make sure we have a .info file set up in the data model.
	if { [db_0or1row "
            select path
            from apm_package_files
            where version_id = $version_id
            and file_type = 'package_spec'
        "] } {
	    # The .info file was already there. The path to is is now in $path.
	} else {
	    # Nothing there! We need to create add a .info file.
	    set path "$package_key.info"
	    db_dml "
                insert into apm_package_files(file_id, version_id, path, file_type)
                values(apm_package_file_id_seq.nextval, $version_id, '$package_key.info', 'package_spec')
            "
	}
    
	set path "$root/$package_key.info"
	set file [open $path "w"]
	puts -nonewline $file $spec
	close $file

	# Mark $version_id as the only installed version of the package.
	db_dml "
            update apm_package_versions
            set    installed_p = decode(version_id, $version_id, 't', 'f')
            where  package_id = $package_id
        "
    }


philg@mit.edu