Index: openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 5 Apr 2001 18:23:38 -0000 1.2 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 12 Apr 2001 16:58:18 -0000 1.3 @@ -232,10 +232,6 @@ unset apm_first_time_loading_p } - - - - ad_proc -public apm_file_watch {path} { Marks the file of the indicated path to be watched. If the file changes, @@ -351,150 +347,6 @@ "] } - -ad_proc -private 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, - or if any path contains the substring upgrade, data-model upgrade - files. -
  2. Files with extension .sqlj are considered sqlj_code files. -
  3. Files with extension .info are considered package specification files. -
  4. Files with extension .xql are considered query files. -
  5. Files with extension .java are considered java code files. -
  6. Files with extension .jar are considered java archive files. -
  7. Files with a path component named doc are considered - documentation files. -
  8. Files with extension .pl or .sh or - which have a path component named - bin, are considered shell-executable files. -
  9. Files with a path component named templates are considered - template files. -
  10. Files with extension .html or .adp, in the top - level of the package, are considered documentation files. -
  11. Files with a path component named www or admin-www - are considered content-page files. -
  12. Files ending in -procs(-)+()*.tcl) or -init.tcl are considered - Tcl procedure or Tcl initialization files, respectively. -
  13. File ending in .tcl are considered Tcl utility script files (normally - found only in the bootstrap installer). -
- - Rules are applied in this order (stopping with the first match). - -} { - set components [split $path "/"] - set extension [file extension $path] - set type "" - - # DRB: someone named a file "acs-mail-create-packages.sql" rather than - # the conventional "acs-mail-packages-create.sql", causing it to be - # recognized as a data_model_create file, causing it to be explicitly - # run by the installer (the author intended it to be included by - # acs-mail-create.sql only). I've tightened up the regexp below to - # avoid this problem, along with renaming the file... - - if { [string equal $extension ".sql"] } { - if { [lsearch -glob $components "*upgrade-*-*"] >= 0 } { - set type "data_model_upgrade" - } elseif { [regexp -- "$package_key-(create|drop)\.sql" [file tail $path] "" kind] } { - set type "data_model_$kind" - } else { - set type "data_model" - } - } elseif { [string equal $extension ".sqlj"] } { - set type "sqlj_code" - } elseif { [string equal $extension ".info"] } { - set type "package_spec" - } elseif { [string equal $extension ".xql"] } { - set type "query_file" - } elseif { [string equal $extension ".java"] } { - set type "java_code" - } elseif { [string equal $extension ".jar"] } { - set type "java_archive" - } elseif { [lsearch $components "doc"] >= 0 } { - set type "documentation" - } elseif { [string equal $extension ".pl"] || \ - [string equal $extension ".sh"] || \ - [lsearch $components "bin"] >= 0 } { - set type "shell" - } elseif { [lsearch $components "templates"] >= 0 } { - set type "template" - } elseif { [llength $components] == 1 && \ - ([string equal $extension ".html"] || [string equal $extension ".adp"]) } { - # HTML or ADP file in the top level of a package - assume it's documentation. - set type "documentation" - } elseif { [lsearch $components "www"] >= 0 || [lsearch $components "admin-www"] >= 0 } { - set type "content_page" - } else { - if { [string equal $extension ".tcl"] } { - if { [regexp -- {-(procs|init)(-[0-9a-zA-Z]*)?\.tcl$} [file tail $path] "" kind] } { - set type "tcl_$kind" - } else { - set type "tcl_util" - } - } - } - return $type -} - - -ad_proc -private 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. - - 2. Other files. - - If the file name contains a dash and database type, the file is assumed to be - specific to that database type. - - Example: "tcl/10-database-postgresql-proc.tcl" is asusmed to be the file that - defines the PostgreSQL-specific portions of the database API. - -} { - set components [split $path "/"] - - if { [string match "data_model*" [apm_guess_file_type $package_key $path]] } { - set sql_index [lsearch $components "sql"] - if { $sql_index >= 0 } { - set db_dir [lindex $components [expr $sql_index + 1]] - foreach known_database_type [db_known_database_types] { - if { [string match [lindex $known_database_type 0] $db_dir] } { - return $db_dir - } - } - } - return "" - } - - set file_name [file tail $path] - foreach known_database_type [db_known_database_types] { - if { [string match "*-[lindex $known_database_type 0]\.*" $file_name] } { - return [lindex $known_database_type 0] - } - } - return "" -} - ad_proc -private apm_ignore_file_p { path } { Return 1 if $path should, in general, be ignored for package operations.