- Publicity: Public Only All
apm-install-procs.tcl
Routines used for installing packages.
- Location:
- packages/acs-tcl/tcl/apm-install-procs.tcl
- Created:
- September 11 2000
- Author:
- Bryan Quinn <bquinn@arsdigita.com>
- CVS Identification:
$Id: apm-install-procs.tcl,v 1.132 2024/10/09 14:42:06 antoniop Exp $
Procedures in this file
- apm::package_version::attributes::default_value (public)
- apm::package_version::attributes::get (public)
- apm::package_version::attributes::get_pretty_name (public)
- apm::package_version::attributes::get_spec (public)
- apm::package_version::attributes::maturity_int_to_text (public)
- apm::process_install_xml (public)
- apm_copy_inherited_params (public)
- apm_copy_param_to_descendents (public)
- apm_data_model_scripts_find (public)
- apm_dependency_check_new (public)
- apm_dependency_provided_p (public)
- apm_get_package_repository (public)
- apm_get_repository_channel (public)
- apm_get_repository_channels (public)
- apm_invoke_install_proc (public)
- apm_package_deinstall (public)
- apm_package_delete (public)
- apm_package_install (public)
- apm_package_install_owners (public)
- apm_package_install_owners_prepare (public)
- apm_package_install_spec (public)
- apm_package_install_version (public)
- apm_package_register (public)
- apm_package_upgrade_p (public)
- apm_scan_packages (public)
- apm_simple_package_install (public)
- apm_unregister_disinherited_params (public)
- apm_upgrade_logic (public)
- apm_version_disable (public)
- apm_version_enable (public)
- apm_version_names_compare (public)
- apm_version_sortable (public)
- apm_version_update (public)
- apm_version_upgrade (public)
- pkg_info_comment (public)
- pkg_info_dependency_p (public)
- pkg_info_key (public)
- pkg_info_new (public)
- pkg_info_path (public)
- pkg_info_spec (public)
Detailed information
apm::package_version::attributes::default_value (public)
apm::package_version::attributes::default_value attribute_name
Return the default value for the given attribute name.
- Parameters:
- attribute_name (required)
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm::package_version::attributes::get (public)
apm::package_version::attributes::get -version_id version_id \ -array array
Set an array with the attribute values of a certain package version.
- Switches:
- -version_id (required)
- The id of the package version to return attribute values for
- -array (required)
- The name of an array in the callers environment in which the attribute values will be set (with attribute names as keys and attribute values as values).
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm::package_version::attributes::get_pretty_name (public)
apm::package_version::attributes::get_pretty_name attribute_name
Return the pretty name of attribute with given short name.
- Parameters:
- attribute_name (required)
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm::package_version::attributes::get_spec (public)
apm::package_version::attributes::get_spec
Return dynamic attributes of package versions in an array list. The rationale for introducing the dynamic package version attributes is to make it easy to add new package attributes.
- Returns:
- An array list with attribute names as keys and attribute specs as values. The attribute specs are themselves array lists with keys default_value, validation_proc, and pretty_name.
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm::package_version::attributes::maturity_int_to_text (public)
apm::package_version::attributes::maturity_int_to_text maturity
Get the internationalized maturity description corresponding to the given integer package maturity level.
- Parameters:
- maturity (required)
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm::process_install_xml (public)
apm::process_install_xml [ -nested ] [ -install_from_repository ] \ filename binds
process an XML install definition file which is expected to contain directives to install, mount and configure a series of packages.
- Switches:
- -nested (optional, boolean)
- -install_from_repository (optional, boolean)
- Parameters:
- filename (required)
- path to the XML file relative to serverroot.
- binds (required)
- list of {variable value variable value ...}
- Returns:
- list of messages
- Author:
- Jeff Davis <swiped from acs-bootstrap-installer though>
- Created:
- 2003-10-30
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_copy_inherited_params (public)
apm_copy_inherited_params new_package_key dependencies
Copy parameters from a packages ancestors. Called for "embeds" and "extends" dependencies.
- Parameters:
- new_package_key (required)
- dependencies (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_copy_param_to_descendents (public)
apm_copy_param_to_descendents new_package_key parameter_name
Copy a new parameter in a package to its descendents. Called when a package is upgraded or a parameter added in the APM.
- Parameters:
- new_package_key (required)
- parameter_name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_data_model_scripts_find (public)
apm_data_model_scripts_find \ [ -upgrade_from_version_name upgrade_from_version_name ] \ [ -upgrade_to_version_name upgrade_to_version_name ] \ [ -package_path package_path ] package_key
- Switches:
- -upgrade_from_version_name (optional)
- From which version do we want the files
- -upgrade_to_version_name (optional)
- To what version do we want the files
- -package_path (optional)
- The package path
- Parameters:
- package_key (required)
- The package key
- Returns:
- A list of files and file types of form [list [list "foo.sql" "data_model_upgrade"] ...]
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_dependency_check_new (public)
apm_dependency_check_new -repository_array repository_array \ -package_keys package_keys
Checks dependencies and finds out which packages are required to install the requested packages. In case some packages cannot be installed due to failed dependencies, it returns which packages out of the requested can be installed, and which packages, either originally requested or required by those, could not be installed, and why.
- Switches:
- -repository_array (required)
- Name of an array in the caller's namespace containing the repository of available packages as returned by apm_get_package_repository.
- -package_keys (required)
- The list of package_keys of the packages requested to be installed.
- Returns:
- An array list with the following elements:
- status: 'ok' or 'failed'.
- install: If status is 'ok', this is the complete list of packages that need to be installed, in the order in which they need to be installed. If status is 'failed', the list of packages that can be installed.
- failed: If status is 'failed', an array list keyed by package_key of 2-tuples of (required-uri, required-version) of requirements that could not be satisfied.
- packages: The list of package_keys of the packages touched upon, either because they were originally requested, or because they were required. If status is 'ok', will be identical to 'install'.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_dependency_provided_p (public)
apm_dependency_provided_p [ -dependency_list dependency_list ] \ dependency_uri dependency_version
Returns 1 if the current system provides the dependency inquired about. Returns -1 if the version number is too low. Returns 0 otherwise.
- Switches:
- -dependency_list (optional, defaults to
"[list]"
)- Specify this if you want to a check a list of dependencies of form {dependency_name dependency_version} in addition to querying the database for what the system currently provides.
- Parameters:
- dependency_uri (required)
- The dependency that is being checked.
- dependency_version (required)
- The version of the dependency being checked.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_get_package_repository (public)
apm_get_package_repository [ -repository_url repository_url ] \ -array array
Gets a list of packages available for install from either a remote package repository or the local filesystem.
- Switches:
- -repository_url (optional)
- The URL for the repository channel to get from, or the empty string to search the local filesystem instead.
- -array (required)
- Name of an array where you want the repository stored. It will be keyed by package-key, and each entry will be an array list returned by apm_read_package_info_file.
- Author:
- Lars Pind <lars@collaboraid.biz>
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_get_repository_channel (public)
apm_get_repository_channel
Returns the channel to use when installing software from the repository. Based on the version of the acs-kernel package, e.g. if acs-kernel is version 5.0.1, then this will return 5-0.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_get_repository_channels (public)
apm_get_repository_channels [ repository_url ]
Returns the channels and URLs from a repository
- Parameters:
- repository_url (optional, defaults to
"https://openacs.org/repository/"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_respositories_api
apm_invoke_install_proc (public)
apm_invoke_install_proc [ -install_from_repository ] [ -type type ] \ -node node
read an XML install element and invoke the appropriate processing procedure.
- Switches:
- -install_from_repository (optional, boolean)
- -type (optional, defaults to
"action"
)- the type of element to search for
- -node (required)
- the XML node to process
- Returns:
- the result of the invoked proc
- Author:
- Lee Denison
- Created:
- 2004-06-16
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_package_deinstall (public)
apm_package_deinstall [ -callback callback ] package_key
Deinstalls a package from the filesystem.
- Switches:
- -callback (optional, defaults to
"apm_dummy_callback"
)- Parameters:
- package_key (required)
- The package to be deinstaleled.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_package_delete (public)
apm_package_delete [ -sql_drop_scripts sql_drop_scripts ] \ [ -callback callback ] [ -remove_files ] [ -delete_site_nodes ] \ package_key
De-install a package from the system. Will unmount and uninstantiate package instances, invoke any before-uninstall callback, source any provided sql drop scripts, remove message keys, and delete the package from the APM tables.
- Switches:
- -sql_drop_scripts (optional)
- -callback (optional, defaults to
"apm_dummy_callback"
)- -remove_files (optional, boolean)
- -delete_site_nodes (optional, boolean)
- Parameters:
- package_key (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- upgrade
apm_package_install (public)
apm_package_install [ -enable ] [ -callback callback ] \ [ -load_data_model ] [ -install_from_repository ] \ [ -data_model_files data_model_files ] \ [ -package_path package_path ] [ -mount_path mount_path ] \ spec_file_path
Registers a new package and/or version in the database, returning the version_id. If $callback is provided, periodically invokes this procedure with a single argument containing a human-readable (English) status message.
- Switches:
- -enable (optional, boolean)
- -callback (optional, defaults to
"apm_dummy_callback"
)- -load_data_model (optional, boolean)
- -install_from_repository (optional, boolean)
- -data_model_files (optional, defaults to
"0"
)- -package_path (optional)
- -mount_path (optional)
- Parameters:
- spec_file_path (required)
- The path to an XML .info file relative to
- Returns:
- The version_id if successfully installed, 0 otherwise.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- upgrade
apm_package_install_owners (public)
apm_package_install_owners [ -callback callback ] owners version_id
Install all of the owners of the package version.
- Switches:
- -callback (optional, defaults to
"apm_dummy_callback"
)- Parameters:
- owners (required)
- version_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- upgrade
apm_package_install_owners_prepare (public)
apm_package_install_owners_prepare owner_names owner_uris
Prepare the owners data structure for installation.
- Parameters:
- owner_names (required)
- owner_uris (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_package_install_spec (public)
apm_package_install_spec version_id
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. Adds minimal directories.
- Parameters:
- version_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_package_install_version (public)
apm_package_install_version [ -callback callback ] -array array \ [ -version_id version_id ] package_key version_name version_uri \ summary description description_format vendor vendor_uri \ auto_mount [ release_date ]
Installs a version of a package.
- Switches:
- -callback (optional, defaults to
"apm_dummy_callback"
)- -array (required)
- The name of the array in the callers scope holding package version attributes
- -version_id (optional)
- Parameters:
- package_key (required)
- version_name (required)
- version_uri (required)
- summary (required)
- description (required)
- description_format (required)
- vendor (required)
- vendor_uri (required)
- auto_mount (required)
- release_date (optional)
- Returns:
- The assigned version id.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- upgrade
apm_package_register (public)
apm_package_register [ -spec_file_path spec_file_path ] \ [ -spec_file_mtime spec_file_mtime ] package_key pretty_name \ pretty_plural package_uri package_type initial_install_p \ singleton_p implements_subsite_p inherit_templates_p
Register the package in the system.
- Switches:
- -spec_file_path (optional)
- -spec_file_mtime (optional)
- Parameters:
- package_key (required)
- pretty_name (required)
- pretty_plural (required)
- package_uri (required)
- package_type (required)
- initial_install_p (required)
- singleton_p (required)
- implements_subsite_p (required)
- inherit_templates_p (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- upgrade
apm_package_upgrade_p (public)
apm_package_upgrade_p package_key version_name
- Parameters:
- package_key (required)
- version_name (required)
- Returns:
- 1 if a version of the indicated package_key of version lower than version_name is already installed in the system, 0 otherwise.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_scan_packages (public)
apm_scan_packages [ -callback callback ] [ -new ] [ path ]
Scans a directory for unregistered package specification files.
- Switches:
- -callback (optional, defaults to
"apm_dummy_callback"
)- -new (optional, boolean)
- Parameters:
- path (optional)
- Returns:
- A list of unregistered .info files that can be parsed for further information.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_simple_package_install (public)
apm_simple_package_install package_key
Simple basic package install function. Wraps up basically what the old install XML action did.
- Parameters:
- package_key (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_unregister_disinherited_params (public)
apm_unregister_disinherited_params package_key dependency_id
Remove parameters for package_key that have been disinherited (i.e., the dependency that caused them to be inherited have been removed). Called only by the APM and keep it that way, please.
- Parameters:
- package_key (required)
- dependency_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_upgrade_logic (public)
apm_upgrade_logic -from_version_name from_version_name \ -to_version_name to_version_name -spec spec
Logic to help upgrade a package. The spec contains a flat list of triples of the form { "from_version" "to_version" "code_chunk" "from_version" "to_version" "code_chunk ..." }. The list is compared against the "from_version_name" and "to_version_name" parameters supplied, and the code_chunks that fall within the from_version_name and to_version_name it'll get executed in the caller's namespace, ordered by the from_version.
Example:
ad_proc my_upgrade_callback { {-from_version_name:required} {-to_version_name:required} } { apm_upgrade_logic -from_version_name $from_version_name -to_version_name $to_version_name -spec { 1.1 1.2 { ... } 1.2 1.3 { ... } 1.4d 1.4d1 { ... } 2.1 2.3 { ... } 2.3 2.4 { ... } } }
- Switches:
- -from_version_name (required)
- The version you're upgrading from, e.g. '1.3'.
- -to_version_name (required)
- The version you're upgrading to, e.g. '2.4'.
- -spec (required)
- The code chunks in the format described above
- Author:
- Lars Pind
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_version_disable (public)
apm_version_disable [ -callback callback ] version_id
Disables a version of a package.
- Switches:
- -callback (optional, defaults to
"apm_dummy_callback"
)- Parameters:
- version_id (required)
- The id of the version to be disabled.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_version_enable (public)
apm_version_enable [ -callback callback ] version_id
Enables a version of a package (disabling any other version of the package).
- Switches:
- -callback (optional, defaults to
"apm_dummy_callback"
)- Parameters:
- version_id (required)
- The id of the version to be enabled.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- upgrade
apm_version_names_compare (public)
apm_version_names_compare version_name_1 version_name_2
Compare two version names for which is earlier than the other. Example:
- apm_version_names_compare "1.2d3" "3.5b" => -1
- apm_version_names_compare "3.5b" "3.5b" => 0
- apm_version_names_compare "3.5b" "1.2d3" => 1
- Parameters:
- version_name_1 (required)
- the first version name
- version_name_2 (required)
- the second version name
- Returns:
- -1: the first version is smallest
- 0: they're identical
- 1: the second version is smallest
- Author:
- Lars Pind
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_version_names_compare
apm_version_sortable (public)
apm_version_sortable version
Return a sortable version of the version name.
- Parameters:
- version (required)
- Author:
- Jeff Davis
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- files__check_upgrade_ordering
apm_version_update (public)
apm_version_update [ -callback callback ] -array array version_id \ version_name version_uri summary description description_format \ vendor vendor_uri auto_mount [ release_date ]
Update a version in the system to new information.
- Switches:
- -callback (optional, defaults to
"apm_dummy_callback"
)- -array (required)
- Parameters:
- version_id (required)
- version_name (required)
- version_uri (required)
- summary (required)
- description (required)
- description_format (required)
- vendor (required)
- vendor_uri (required)
- auto_mount (required)
- release_date (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_version_upgrade (public)
apm_version_upgrade version_id
Upgrade a package to a locally maintained later version.
- Parameters:
- version_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
pkg_info_comment (public)
pkg_info_comment pkg_info
- Parameters:
- pkg_info (required)
- Returns:
- Any comment specified about this package.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
pkg_info_dependency_p (public)
pkg_info_dependency_p pkg_info
- Parameters:
- pkg_info (required)
- Returns:
- Does it pass the dependency checker? "" Means it has not been run yet.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
pkg_info_key (public)
pkg_info_key pkg_info
- Parameters:
- pkg_info (required)
- Returns:
- The package-key stored in the package info map.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
pkg_info_new (public)
pkg_info_new package_key spec_file_path embeds extends provides \ requires [ dependency_p ] [ comment ]
Returns a datastructure that maintains information about a package.
- Parameters:
- package_key (required)
- The key of the package.
- spec_file_path (required)
- The path to the package specification file
- embeds (required)
- A list of packages to be embedded in the package.
- extends (required)
- A list of packages extended by the package.
- provides (required)
- A list of dependencies provided by the package.
- requires (required)
- A list of requirements provided by the package..
- dependency_p (optional)
- Can the package be installed without violating dependency checking.
- comment (optional)
- Some text about the package. Useful to explain why it fails dependency check.
- Returns:
- a list whose first element is a package key and whose second element is a path to the associated .info file.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
pkg_info_path (public)
pkg_info_path pkg_info
- Parameters:
- pkg_info (required)
- Returns:
- The full path of the packages dir stored in the package info map. Assumes that the info file is stored in the root dir of the package.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
pkg_info_spec (public)
pkg_info_spec pkg_info
- Parameters:
- pkg_info (required)
- Returns:
- The .info file stored in the package info map.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.