30-apm-load-procs.tcl

Routines needed by the bootstrapper to load package code.

Location:
packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl
Created:
26 May 2000
Author:
Jon Salz [jsalz@arsdigita.com]
CVS Identification:
$Id: 30-apm-load-procs.tcl,v 1.52 2024/09/11 06:15:47 gustafn Exp $

Procedures in this file

Detailed information

ad_after_server_initialization (public)

 ad_after_server_initialization name [ args... ]

Registers code to run after server initialization is complete.

Parameters:
name (required)
a human-readable name for the code block (for debugging purposes).

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_after_server_initialization ad_after_server_initialization (test acs-bootstrap-installer) ad_after_server_initialization ad_after_server_initialization test_ad_after_server_initialization->ad_after_server_initialization packages/acs-tcl/tcl/request-processor-init.tcl packages/acs-tcl/ tcl/request-processor-init.tcl packages/acs-tcl/tcl/request-processor-init.tcl->ad_after_server_initialization

Testcases:
ad_after_server_initialization

apm_backup_file_p (private)

 apm_backup_file_p path

Returns 1 if $path is a backup file, or 0 if not. We consider it a backup file if any of the following apply:

  • its name begins with #
  • its name is bak
  • its name begins with bak and one or more non-alphanumeric characters
  • its name ends with .old, .bak, or ~

Parameters:
path (required)

Partial Call Graph (max 5 caller/called nodes):
%3 apm_ignore_file_p apm_ignore_file_p (public) apm_backup_file_p apm_backup_file_p apm_ignore_file_p->apm_backup_file_p

Testcases:
No testcase defined.

apm_bootstrap_load_file (private)

 apm_bootstrap_load_file root_directory file [ errorVarName ]

Source a single file during initial bootstrapping and set APM data.

Parameters:
root_directory (required)
file (required)
errorVarName (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 apm_bootstrap_load_libraries apm_bootstrap_load_libraries (private) apm_bootstrap_load_file apm_bootstrap_load_file apm_bootstrap_load_libraries->apm_bootstrap_load_file ad_file ad_file (public) apm_bootstrap_load_file->ad_file apm_source apm_source (public) apm_bootstrap_load_file->apm_source

Testcases:
No testcase defined.

apm_bootstrap_load_libraries (private)

 apm_bootstrap_load_libraries [ -load_tests ] [ -init ] [ -procs ] \
    package_key [ errorVarName ]

Scan all the files in the "tcl" dir of the package and load those asked for by the init and procs flags. This proc is an analog of apm_load_libraries. In addition though this proc sets apm_first_time_loading_p variable.

Switches:
-load_tests (optional, boolean, defaults to "0")
-init (optional, boolean)
Load initialization files
-procs (optional, boolean)
Load the proc library files
Parameters:
package_key (required)
The package to load (normally acs-tcl)
errorVarName (optional)
Authors:
Don Baccus <dhogaza@pacifier.com>
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-admin/www/install/install-3.tcl packages/acs-admin/ www/install/install-3.tcl apm_bootstrap_load_libraries apm_bootstrap_load_libraries packages/acs-admin/www/install/install-3.tcl->apm_bootstrap_load_libraries packages/acs-bootstrap-installer/bootstrap.tcl packages/acs-bootstrap-installer/ bootstrap.tcl packages/acs-bootstrap-installer/bootstrap.tcl->apm_bootstrap_load_libraries acs_package_root_dir acs_package_root_dir (public) apm_bootstrap_load_libraries->acs_package_root_dir apm_bootstrap_load_file apm_bootstrap_load_file (private) apm_bootstrap_load_libraries->apm_bootstrap_load_file apm_get_package_files apm_get_package_files (public) apm_bootstrap_load_libraries->apm_get_package_files db_release_unused_handles db_release_unused_handles (public) apm_bootstrap_load_libraries->db_release_unused_handles

Testcases:
No testcase defined.

apm_bootstrap_upgrade (public)

 apm_bootstrap_upgrade -from_version_name from_version_name \
    -to_version_name to_version_name

Copy the files from acs-bootstrap-installer/installer/tcl to the Tcl files in the acs root directory. This makes it possible to incorporate changes to these files by only updating the acs-bootstrap-installer package (rather than a full tar file install as in earlier versions). Caveat: don't modify these files in your local installation, adding extra files to $::acs::rootdir/tcl is fine.

Switches:
-from_version_name (required)
-to_version_name (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_bootstrap_upgrade apm_bootstrap_upgrade (test acs-bootstrap-installer) apm_bootstrap_upgrade apm_bootstrap_upgrade test_apm_bootstrap_upgrade->apm_bootstrap_upgrade

Testcases:
apm_bootstrap_upgrade

apm_first_time_loading_p (public)

 apm_first_time_loading_p

Returns 1 if this is a -procs.tcl file's first time loading, or 0 otherwise.

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_first_time_loading_p apm_first_time_loading_p (test acs-bootstrap-installer) apm_first_time_loading_p apm_first_time_loading_p test_apm_first_time_loading_p->apm_first_time_loading_p ad_register_filter ad_register_filter (public) ad_register_filter->apm_first_time_loading_p

Testcases:
apm_first_time_loading_p

apm_get_package_files (public)

 apm_get_package_files [ -include_data_model_files ] [ -all ] \
    [ -all_db_types ] -package_key package_key \
    [ -package_path package_path ] [ -file_types file_types ]

Returns all files, or files of a certain types, belonging to an APM package. Ignores files based on proc apm_include_file_p and determines file type of files with proc apm_guess_file_type. Only returns file with no db type or a db type matching that of the system, unless '-all' is specified.

Goes directly to the filesystem to find files instead of using a file listing in the package info file or the database.

Switches:
-include_data_model_files (optional, boolean)
-all (optional, boolean)
When specified, return all files in the package, regardless of their file or database type.
-all_db_types (optional, boolean)
-package_key (required)
The key of the package to return file paths for
-package_path (optional)
The full path of the root directory of the package. Defaults to acs_package_root_dir.
-file_types (optional)
The type of files to return. If not provided files of all types recognized by the APM are returned.
Returns:
The paths, relative to the root dir of the package, of matching files.
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_tarballs apm_tarballs (test acs-tcl) apm_get_package_files apm_get_package_files test_apm_tarballs->apm_get_package_files test_files__check_upgrade_ordering files__check_upgrade_ordering (test acs-tcl) test_files__check_upgrade_ordering->apm_get_package_files test_files__check_xql_files files__check_xql_files (test acs-tcl) test_files__check_xql_files->apm_get_package_files test_files__page_contracts files__page_contracts (test acs-tcl) test_files__page_contracts->apm_get_package_files test_files__tcl_file_syntax_errors files__tcl_file_syntax_errors (test acs-tcl) test_files__tcl_file_syntax_errors->apm_get_package_files acs_package_root_dir acs_package_root_dir (public) apm_get_package_files->acs_package_root_dir ad_find_all_files ad_find_all_files (public) apm_get_package_files->ad_find_all_files apm_guess_db_type apm_guess_db_type (public) apm_get_package_files->apm_guess_db_type apm_guess_file_type apm_guess_file_type (public) apm_get_package_files->apm_guess_file_type api_add_calling_info_to_procdoc api_add_calling_info_to_procdoc (private) api_add_calling_info_to_procdoc->apm_get_package_files apm::metrics_internal apm::metrics_internal (private) apm::metrics_internal->apm_get_package_files apm_bootstrap_load_libraries apm_bootstrap_load_libraries (private) apm_bootstrap_load_libraries->apm_get_package_files apm_build_repository apm_build_repository (private) apm_build_repository->apm_get_package_files apm_data_model_scripts_find apm_data_model_scripts_find (public) apm_data_model_scripts_find->apm_get_package_files

Testcases:
get_package_files, apm_tarballs, files__tcl_file_syntax_errors, files__check_upgrade_ordering, files__check_xql_files, files__trailing_whitespace, files__page_contracts

apm_guess_db_type (public)

 apm_guess_db_type package_key path

Guesses and returns the database type key corresponding to a particular path (or an empty string if none is known). $path should be relative to the package directory (e.g., www/index.tcl for /packages/bboard/admin-www/index.tcl). We consider two cases: 1. Data model files. If the path contains a string matching "sql/" followed by a database type known to this version of OpenACS, the file is assumed to be specific to that database type. The empty string is returned for all other data model files. Example: "sql/postgresql/apm-create.sql" is assumed to be the PostgreSQL-specific file used to create the APM datamodel. If the path contains a string matching "sql/common" the file is assumed to be compatible with all supported RDBMS's and a blank db_type is returned. Otherwise "oracle" is returned. This is a hardwired kludge to allow us to handle legacy ACS 4 packages. 2. Other files. If it is a .tcl, .xql, or .sqlj file not under the "sql" dir and whose name ends in a dash and database type, the file is assumed to be specific to that database type. Example: "tcl/10-database-postgresql-proc.tcl" is assumed to be the file that defines the PostgreSQL-specific portions of the database API.

Parameters:
package_key (required)
path (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_files__check_upgrade_ordering files__check_upgrade_ordering (test acs-tcl) apm_guess_db_type apm_guess_db_type test_files__check_upgrade_ordering->apm_guess_db_type ad_file ad_file (public) apm_guess_db_type->ad_file apm_guess_file_type apm_guess_file_type (public) apm_guess_db_type->apm_guess_file_type apm_data_model_scripts_find apm_data_model_scripts_find (public) apm_data_model_scripts_find->apm_guess_db_type apm_file_watchable_p apm_file_watchable_p (public) apm_file_watchable_p->apm_guess_db_type apm_get_package_files apm_get_package_files (public) apm_get_package_files->apm_guess_db_type apm_load_queries apm_load_queries (private) apm_load_queries->apm_guess_db_type packages/acs-admin/www/apm/version-files.tcl packages/acs-admin/ www/apm/version-files.tcl packages/acs-admin/www/apm/version-files.tcl->apm_guess_db_type

Testcases:
files__check_upgrade_ordering

apm_guess_file_type (public)

 apm_guess_file_type package_key path

Guesses and returns the file type key corresponding to a particular path (or an empty string if none is known). $path should be relative to the package directory (e.g., www/index.tcl) for /packages/bboard/admin-www/index.tcl. We use the following rules:

  1. Files with extension .sql are considered data-model files,
  2. Files with extension .dat are considered SQL data files.
  3. Files with extension .ctl are considered sql data loader control files. or if any path contains the substring upgrade, data-model upgrade files.
  4. Files with extension .sqlj are considered sqlj_code files.
  5. Files with extension .info are considered package specification files.
  6. Files with extension .xql are considered query files.
  7. Files with extension .java are considered java code files.
  8. Files with extension .jar are considered java archive files.
  9. Files with a path component named doc are considered documentation files.
  10. Files with extension .pl or .sh or which have a path component named bin, are considered shell-executable files.
  11. Files with a path component named templates are considered template files.
  12. Files with extension .html or .adp, in the top level of the package, are considered documentation files.
  13. Files with a path component named www or admin-www are considered content-page files.
  14. Files with a path component named lib are considered include_page files.
  15. Files under package-key/tcl ending in -procs(-)+()*.tcl) or -init.tcl are considered Tcl procedure or Tcl initialization files, respectively.
  16. File ending in .tcl are considered Tcl utility script files (normally found only in the bootstrap installer).
  17. Files with extension .xml in the directory catalog are considered message catalog files.
  18. Tcl procs or init files under package-key/tcl in a test directory are of type test_procs and test_init respectively.
Rules are applied in this order (stopping with the first match).

Parameters:
package_key (required)
path (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_guess_file_type apm_guess_file_type (test acs-bootstrap-installer) apm_guess_file_type apm_guess_file_type test_apm_guess_file_type->apm_guess_file_type ad_file ad_file (public) apm_guess_file_type->ad_file apm_is_catalog_file apm_is_catalog_file (public) apm_guess_file_type->apm_is_catalog_file apm_data_model_scripts_find apm_data_model_scripts_find (public) apm_data_model_scripts_find->apm_guess_file_type apm_file_watchable_p apm_file_watchable_p (public) apm_file_watchable_p->apm_guess_file_type apm_get_package_files apm_get_package_files (public) apm_get_package_files->apm_guess_file_type apm_guess_db_type apm_guess_db_type (public) apm_guess_db_type->apm_guess_file_type apm_load_queries apm_load_queries (private) apm_load_queries->apm_guess_file_type

Testcases:
apm_guess_file_type

apm_ignore_file_p (public)

 apm_ignore_file_p [ -data_model_files ] path

Return 1 if $path should, in general, be ignored for package operations. Currently, a file is ignored if it is a backup file or a CVS directory.

Switches:
-data_model_files (optional, boolean)
Parameters:
path (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_files__page_contracts files__page_contracts (test acs-tcl) apm_ignore_file_p apm_ignore_file_p test_files__page_contracts->apm_ignore_file_p ad_file ad_file (public) apm_ignore_file_p->ad_file apm_backup_file_p apm_backup_file_p (private) apm_ignore_file_p->apm_backup_file_p apm_include_data_model_file_p apm_include_data_model_file_p (private) apm_include_data_model_file_p->apm_ignore_file_p apm_include_file_p apm_include_file_p (private) apm_include_file_p->apm_ignore_file_p apm_scan_packages apm_scan_packages (public) apm_scan_packages->apm_ignore_file_p

Testcases:
files__page_contracts

apm_include_data_model_file_p (private)

 apm_include_data_model_file_p filename

Check if the APM should consider a file found by ad_find_all_files. Files for which apm_ignore_file_p returns true will be ignored. Backup files are ignored.

Parameters:
filename (required)

Partial Call Graph (max 5 caller/called nodes):
%3 apm_ignore_file_p apm_ignore_file_p (public) apm_include_data_model_file_p apm_include_data_model_file_p apm_include_data_model_file_p->apm_ignore_file_p

Testcases:
No testcase defined.

apm_include_file_p (private)

 apm_include_file_p filename

Check if the APM should consider a file found by ad_find_all_files. Files for which apm_ignore_file_p returns true will be ignored. Backup files and SQL scripts (including the ones in upgrade directory) are ignored.

Parameters:
filename (required)

Partial Call Graph (max 5 caller/called nodes):
%3 apm_ignore_file_p apm_ignore_file_p (public) apm_include_file_p apm_include_file_p apm_include_file_p->apm_ignore_file_p

Testcases:
No testcase defined.

apm_install_xml_file_path (private)

 apm_install_xml_file_path

Get the path of the install.xml file.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 apm_load_install_xml_file apm_load_install_xml_file (private) apm_install_xml_file_path apm_install_xml_file_path apm_load_install_xml_file->apm_install_xml_file_path

Testcases:
No testcase defined.

apm_is_catalog_file (public)

 apm_is_catalog_file file_path

Given a file path return 1 if the path represents a message catalog file and 0 otherwise.

Parameters:
file_path (required)
Should be absolute or relative to OpenACS /packages dir or one of its parent dirs.
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_guess_file_type apm_guess_file_type (test acs-bootstrap-installer) apm_is_catalog_file apm_is_catalog_file test_apm_guess_file_type->apm_is_catalog_file apm_parse_catalog_path apm_parse_catalog_path (public) apm_is_catalog_file->apm_parse_catalog_path apm_guess_file_type apm_guess_file_type (public) apm_guess_file_type->apm_is_catalog_file lang::catalog::assert_catalog_file lang::catalog::assert_catalog_file (private) lang::catalog::assert_catalog_file->apm_is_catalog_file lang::catalog::get_catalog_files lang::catalog::get_catalog_files (private) lang::catalog::get_catalog_files->apm_is_catalog_file

Testcases:
apm_guess_file_type

apm_load_install_xml_file (private)

 apm_load_install_xml_file

Loads any install.xml file and returns the root node. Returns the empty string if there is no install.xml file.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 ad_file ad_file (public) apm_install_xml_file_path apm_install_xml_file_path (private) xml_doc_get_first_node xml_doc_get_first_node (public) xml_parse xml_parse (public) apm_load_install_xml_file apm_load_install_xml_file apm_load_install_xml_file->ad_file apm_load_install_xml_file->apm_install_xml_file_path apm_load_install_xml_file->xml_doc_get_first_node apm_load_install_xml_file->xml_parse

Testcases:
No testcase defined.

apm_package_supports_rdbms_p (public)

 apm_package_supports_rdbms_p -package_key package_key

Returns 1 if the given package supports the rdbms of the system and 0 otherwise. The package is considered to support the given rdbms if there is at least one file in the package of matching db_type, or if there are no files in the package of a certain db type.

Switches:
-package_key (required)
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_package_supports_rdbms_p apm_package_supports_rdbms_p (test acs-bootstrap-installer) apm_package_supports_rdbms_p apm_package_supports_rdbms_p test_apm_package_supports_rdbms_p->apm_package_supports_rdbms_p acs_package_root_dir acs_package_root_dir (public) apm_package_supports_rdbms_p->acs_package_root_dir ad_file ad_file (public) apm_package_supports_rdbms_p->ad_file db_type db_type (public) apm_package_supports_rdbms_p->db_type apm_dependency_check apm_dependency_check (private) apm_dependency_check->apm_package_supports_rdbms_p apm_get_package_repository apm_get_package_repository (public) apm_get_package_repository->apm_package_supports_rdbms_p apm_package_supported_databases apm_package_supported_databases (public) apm_package_supported_databases->apm_package_supports_rdbms_p apm_simple_package_install apm_simple_package_install (public) apm_simple_package_install->apm_package_supports_rdbms_p packages/acs-admin/www/apm/packages-install.tcl packages/acs-admin/ www/apm/packages-install.tcl packages/acs-admin/www/apm/packages-install.tcl->apm_package_supports_rdbms_p

Testcases:
apm_package_supports_rdbms_p

apm_parse_catalog_path (public)

 apm_parse_catalog_path file_path

Given the path of a file attempt to extract package_key, prefix, charset and locale information from the path assuming the path is on valid format for a message catalog file. If the parsing fails then the file is not considered a catalog file and the empty list is returned.

Parameters:
file_path (required)
Path of file, relative to the OpenACS /packages dir, one of its parent directories, or absolute path.
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_parse_catalog_path apm_parse_catalog_path (test acs-bootstrap-installer) apm_parse_catalog_path apm_parse_catalog_path test_apm_parse_catalog_path->apm_parse_catalog_path apm_is_catalog_file apm_is_catalog_file (public) apm_is_catalog_file->apm_parse_catalog_path lang::catalog::export_to_file lang::catalog::export_to_file (private) lang::catalog::export_to_file->apm_parse_catalog_path lang::catalog::import_from_file lang::catalog::import_from_file (private) lang::catalog::import_from_file->apm_parse_catalog_path lang::catalog::is_upgrade_backup_file lang::catalog::is_upgrade_backup_file (private) lang::catalog::is_upgrade_backup_file->apm_parse_catalog_path

Testcases:
apm_parse_catalog_path

apm_source (public)

 apm_source __file [ errorVarName ]

Sources $__file in a clean environment, returning 1 if successful or 0 if not. Records that the file has been sourced and stores its mtime in the nsv array apm_library_mtime

Parameters:
__file (required)
errorVarName (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_source apm_source (test acs-bootstrap-installer) apm_source apm_source test_apm_source->apm_source ad_file ad_file (public) apm_source->ad_file ad_make_relative_path ad_make_relative_path (public) apm_source->ad_make_relative_path apm_bootstrap_load_file apm_bootstrap_load_file (private) apm_bootstrap_load_file->apm_source apm_files_load apm_files_load (private) apm_files_load->apm_source db_qd_get_fullname db_qd_get_fullname (public) db_qd_get_fullname->apm_source packages/acs-automated-testing/www/admin/init-file-resource.tcl packages/acs-automated-testing/ www/admin/init-file-resource.tcl packages/acs-automated-testing/www/admin/init-file-resource.tcl->apm_source packages/acs-automated-testing/www/admin/rerun.tcl packages/acs-automated-testing/ www/admin/rerun.tcl packages/acs-automated-testing/www/admin/rerun.tcl->apm_source

Testcases:
apm_source
[ show source ]