apm_generate_package_spec (public)

 apm_generate_package_spec version_id

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

Generates an XML-formatted specification for a version of a package.

Parameters:
version_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm__test_info_file apm__test_info_file (test acs-tcl) apm_generate_package_spec apm_generate_package_spec test_apm__test_info_file->apm_generate_package_spec apm::package_version::attributes::generate_xml apm::package_version::attributes::generate_xml (private) apm_generate_package_spec->apm::package_version::attributes::generate_xml apm_log apm_log (public) apm_generate_package_spec->apm_log apm_one_package_inherit_order apm_one_package_inherit_order (public) apm_generate_package_spec->apm_one_package_inherit_order db_1row db_1row (public) apm_generate_package_spec->db_1row db_foreach db_foreach (public) apm_generate_package_spec->db_foreach apm_package_install_spec apm_package_install_spec (public) apm_package_install_spec->apm_generate_package_spec packages/acs-admin/www/apm/version-generate-info.tcl packages/acs-admin/ www/apm/version-generate-info.tcl packages/acs-admin/www/apm/version-generate-info.tcl->apm_generate_package_spec

Testcases:
apm__test_info_file
Source code:
    set spec {}

    db_1row package_version_select {}

    apm_log APMDebug "APM: Writing Package Specification for $pretty_name $version_name"
    set auto_mount_tag [expr {$auto_mount ne "" ? "    <auto-mount>$auto_mount</auto-mount>\n" : ""}]
    append spec "<?xml version=\"1.0\"?>
<!-- Generated by the OpenACS Package Manager -->

<package key=\"[ns_quotehtml $package_key]\" url=\"[ns_quotehtml $package_uri]\" type=\"$package_type\">
    <package-name>[ns_quotehtml $pretty_name]</package-name>
    <pretty-plural>[ns_quotehtml $pretty_plural]</pretty-plural>
    <initial-install-p>$initial_install_p</initial-install-p>
    <singleton-p>$singleton_p</singleton-p>
    <implements-subsite-p>$implements_subsite_p</implements-subsite-p>
    <inherit-templates-p>$inherit_templates_p</inherit-templates-p>
${auto_mount_tag}
    <version name=\"$version_name\" url=\"[ns_quotehtml $version_uri]\">\n"

    db_foreach owner_info {} {
        append spec "        <owner"
        if { $owner_uri ne "" } {
            append spec " url=\"[ns_quotehtml $owner_uri]\""
        }
        append spec ">[ns_quotehtml $owner_name]</owner>\n"
    }

    apm_log APMDebug "APM: Writing Version summary and description"
    if { $summary ne "" } {
        append spec "        <summary>[ns_quotehtml $summary]</summary>\n"
    }
    if { $release_date ne "" } {
        append spec "        <release-date>[ns_quotehtml [string range $release_date 0 9]]</release-date>\n"
    }
    if { $vendor ne "" || $vendor_uri ne "" } {
        append spec "        <vendor"
        if { $vendor_uri ne "" } {
            append spec " url=\"[ns_quotehtml $vendor_uri]\""
        }
        append spec ">[ns_quotehtml $vendor]</vendor>\n"
    }
    if { $description ne "" } {
        append spec "        <description"
        if { $description_format ne "" } {
            append spec " format=\"[ns_quotehtml $description_format]\""
        }
        append spec ">[ns_quotehtml $description]</description>\n"
    }

    append spec [apm::package_version::attributes::generate_xml  -version_id $version_id  -indentation "        "]

    append spec "\n"

    apm_log APMDebug "APM: Writing Dependencies."
    db_foreach dependency_info {} {
        append spec "        <$dependency_type url=\"[ns_quotehtml $service_uri]\" version=\"[ns_quotehtml $service_version]\"/>\n"
    } else {
        append spec "        <!-- No dependency information -->\n"
    }

    append spec "\n        <callbacks>\n"
    apm_log APMDebug "APM: Writing callbacks"
    db_foreach callback_info {} {
        append spec "            <callback type=\"[ns_quotehtml $type]\"  proc=\"[ns_quotehtml $proc]\"/>\n"
    }
    append spec "        </callbacks>"
    append spec "\n        <parameters>\n"
    apm_log APMDebug "APM: Writing parameters"

    set parent_package_keys [lrange [apm_one_package_inherit_order $package_key] 0 end-1]

    db_foreach parameter_info {} {
        append spec "            <parameter scope=\"[ns_quotehtml $scope]\" datatype=\"[ns_quotehtml $datatype]\"  min_n_values=\"[ns_quotehtml $min_n_values]\"  max_n_values=\"[ns_quotehtml $max_n_values]\"  name=\"[ns_quotehtml $parameter_name]\" "
        if { $default_value ne "" } {
            append spec " default=\"[ns_quotehtml $default_value]\""
        }

        if { $description ne "" } {
            append spec " description=\"[ns_quotehtml $description]\""
        }

        if { $section_name ne "" } {
            append spec " section_name=\"[ns_quotehtml $section_name]\""
        }

        append spec "/>\n"
    } if_no_rows {
        append spec "        <!-- No version parameters -->\n"
    }

    append spec "        </parameters>\n\n"


    append spec "    </version>
</package>
"
    apm_log APMDebug "APM: Finished writing spec."
    return $spec
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
<fullquery name="apm_generate_package_spec.package_version_select">
    <querytext>
      
        select t.package_key, 
               t.package_uri, 
               t.pretty_name, 
               t.pretty_plural, 
               t.package_type,
	       t.initial_install_p, 
               t.singleton_p, 
               t.implements_subsite_p,
               t.inherit_templates_p,
               v.*
        from   apm_package_versions v, 
               apm_package_types t
        where  v.version_id = :version_id
        and    v.package_key = t.package_key
    
      </querytext>
</fullquery>

<fullquery name="apm_generate_package_spec.owner_info">
    <querytext>
      
        select owner_uri, owner_name
        from   apm_package_owners
        where  version_id = :version_id
        order  by sort_key, owner_uri
    
      </querytext>
</fullquery>

<fullquery name="apm_generate_package_spec.dependency_info">
    <querytext>
      
        select dependency_type, 
               service_uri, 
               service_version
        from   apm_package_dependencies
        where  version_id = :version_id
        order by dependency_type, service_uri
    
      </querytext>
</fullquery>

<fullquery name="apm_generate_package_spec.callback_info">
    <querytext>
        select type,
               proc
        from apm_package_callbacks
        where version_id = :version_id
      </querytext>
</fullquery>

<fullquery name="apm_generate_package_spec.parameter_info">
    <querytext>
      
	select ap.parameter_name, 
               ap.description, 
               ap.datatype, 
               ap.section_name, 
               ap.default_value, 
               ap.min_n_values, 
               ap.max_n_values,
               ap.scope
        from   apm_parameters ap
	where  ap.package_key = :package_key
          and not exists (select 1
                          from apm_parameters ap2
                          where ap.parameter_name = ap2.parameter_name
                            and ap2.package_key in ('[join $parent_package_keys ',']')
                         )
        order  by ap.parameter_name
    
      </querytext>
</fullquery>
packages/acs-tcl/tcl/apm-xml-procs.xql

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