Index: openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 17 Sep 2003 11:20:30 -0000 1.9 +++ openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 25 Sep 2003 10:47:55 -0000 1.10 @@ -105,10 +105,13 @@ set widget "
[ad_decode $install_enable_p 1 "" ""] " + foreach pkg_info $pkg_info_list { incr counter set package_key [pkg_info_key $pkg_info] + set package_path [pkg_info_path $pkg_info] + set package_rel_path [string range $package_path [string length [acs_root_dir]] end] set spec_file [pkg_info_spec $pkg_info] array set package [apm_read_package_info_file $spec_file] set version_name $package(name) @@ -148,7 +151,7 @@ append widget "> - + " } elseif { ![string compare [pkg_info_dependency_p $pkg_info] "f"] } { @@ -166,7 +169,7 @@ append widget "> - + - + " } Index: openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl 16 Jul 2003 00:15:31 -0000 1.8 +++ openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl 25 Sep 2003 10:47:55 -0000 1.9 @@ -22,10 +22,11 @@ set sql_file_list [list] set file_count 0 - foreach pkg_info $pkg_install_list { set package_key [pkg_info_key $pkg_info] + set package_path [pkg_info_path $pkg_info] + array set version [apm_read_package_info_file [pkg_info_spec $pkg_info]] set final_version_name $version(name) @@ -50,6 +51,7 @@ [apm_data_model_scripts_find \ -upgrade_from_version_name $initial_version_name \ -upgrade_to_version_name $final_version_name \ + -package_path $package_path \ $package_key] \ [apm_ctl_files_find $package_key]] Index: openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 18 Sep 2003 17:18:40 -0000 1.12 +++ openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 25 Sep 2003 10:47:55 -0000 1.13 @@ -14,8 +14,6 @@ set pkg_install_list [ad_get_client_property apm pkg_install_list] set pkg_enable_list [ad_get_client_property apm pkg_enable_list] set sql_file_paths [ad_get_client_property apm sql_file_paths] -set install_path [ad_get_client_property apm install_path] -set copy_files_p [ad_get_client_property apm copy_files_p] ReturnHeaders ns_write "[apm_header "Package Installation"] @@ -34,6 +32,8 @@ set installed_count 0 foreach pkg_info $pkg_install_list { set spec_file [pkg_info_spec $pkg_info] + set package_path [pkg_info_path $pkg_info] + if { [catch { array set version [apm_read_package_info_file $spec_file] } errmsg] } { @@ -67,28 +67,18 @@ } # Install the packages. - ns_log Debug "APM: Installing packages from $install_path." - if {$copy_files_p} { - set version_id [apm_package_install -install_path $install_path \ - -callback apm_ns_write_callback -copy_files -load_data_model \ - -data_model_files $data_model_files \ - -mount_path $selected_mount_path \ - $spec_file] - if {$version_id != 0} { - file delete -force $install_path/$package_key - } - } else { - set enable_p [expr [lsearch -exact $pkg_enable_list $package_key] != -1] + ns_log Debug "APM: Installing package at $package_path." - set version_id [apm_package_install \ + set enable_p [expr [lsearch -exact $pkg_enable_list $package_key] != -1] + + set version_id [apm_package_install \ -enable=$enable_p \ - -install_path $install_path \ + -package_path $package_path \ -callback apm_ns_write_callback \ -load_data_model \ -data_model_files $data_model_files \ -mount_path $selected_mount_path \ $spec_file] - } if { $version_id == 0 } { # Installation of the package failed and we shouldn't continue with installation Index: openacs-4/packages/acs-admin/www/apm/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-admin/www/apm/packages-install.tcl 28 Aug 2003 09:41:37 -0000 1.16 +++ openacs-4/packages/acs-admin/www/apm/packages-install.tcl 25 Sep 2003 10:47:55 -0000 1.17 @@ -7,26 +7,31 @@ } { {checked_by_default_p:boolean 0} - {install_path [apm_workspace_install_dir]} } ad_return_top_of_page "[apm_header "Package Installation"]

Please wait while the installer searches your system for packages to install ...

" -### Selection Phase -set all_spec_files [apm_scan_packages $install_path] -# Nothing in the install dir, maybe they just copied the files in under packages. -if { [empty_string_p $all_spec_files] } { - set actual_install_path "[acs_root_dir]/packages" - set all_spec_files [apm_scan_packages $actual_install_path] - # We don't need to copy any files, because they are already there. - ad_set_client_property apm copy_files_p 0 -} else { - ad_set_client_property apm copy_files_p 1 - set actual_install_path $install_path +### Get all the spec files +# If a package is in the apm_workspace dir then we assume that that is the package that +# should be installed and we ignore any such package in the packages dir. +# TODO: make sure that it's a later version than that in the packages dir? +set packages_root_dir "[acs_root_dir]/packages" +set packages_spec_files [apm_scan_packages $packages_root_dir] +set workspace_spec_files [apm_scan_packages [apm_workspace_install_dir]] +set workspace_filenames [list] +foreach spec_path $workspace_spec_files { + lappend workspace_filenames [file tail $spec_path] } +set all_spec_files $workspace_spec_files +foreach spec_path $packages_spec_files { + set spec_filename [file tail $spec_path] + if { [lsearch -exact $workspace_filenames $spec_filename] == -1 } { + lappend all_spec_files $spec_path + } +} # Determine which spec files are new installs; install all of the new items. set spec_files [list] @@ -90,8 +95,8 @@ this.href=''; } -uncheck all boxes | -check all boxes +uncheck all boxes | +check all boxes " ns_write "
" @@ -100,7 +105,6 @@ # But they are limited to the maximum length of a varchar ... ad_set_client_property -clob t apm spec_files $spec_files - ad_set_client_property apm install_path $actual_install_path set errors [list] set pkg_info_list [list] Index: openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl,v diff -u -r1.27 -r1.28 --- openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 23 Sep 2003 17:41:41 -0000 1.27 +++ openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 25 Sep 2003 10:47:56 -0000 1.28 @@ -163,6 +163,7 @@ ad_proc -public apm_get_package_files { {-all_db_types:boolean} {-package_key:required} + {-package_path {}} {-file_types {}} } {

@@ -180,16 +181,21 @@ @param package_key The key of the package to return file paths for @param file_types The type of files to return. If not provided files of all types recognized by the APM are returned. - - @return The paths, relative to the root dir of the package, of matching files. + @param package_path The full path of the root directory of the package. Defaults to + acs_package_root_dir. + @return The paths, relative to the root dir of the package, of matching files. + @author Peter Marklund @see apm_include_file_p @see apm_guess_file_type @see apm_guess_db_type } { - set package_path [acs_package_root_dir $package_key] + if { [empty_string_p $package_path] } { + set package_path [acs_package_root_dir $package_key] + } + set files [lsort [ad_find_all_files -check_file_func apm_include_file_p $package_path]] # We don't assume db_type proc is defined yet set system_db_type [nsv_get ad_database_type .] 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.26 -r1.27 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 24 Sep 2003 17:51:24 -0000 1.26 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 25 Sep 2003 10:47:56 -0000 1.27 @@ -123,7 +123,6 @@ } else { set path "$path/$package_key/$package_key.info" } - ns_log Notice "$path" if { [file exists $path] } { return $path } @@ -163,7 +162,8 @@ DCW - 2001-05-03, change to use the content repository for tarball storage. } { - set files [apm_version_file_list $version_id] + set package_key [apm_package_key_from_version_id $version_id] + set files [apm_get_package_files -all_db_types -package_key $package_key] set tmpfile [ns_tmpnam] db_1row package_key_select { Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.52 -r1.53 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 25 Sep 2003 10:26:36 -0000 1.52 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 25 Sep 2003 10:47:56 -0000 1.53 @@ -150,7 +150,17 @@ return [lindex $pkg_info 1] } +ad_proc -private pkg_info_path {pkg_info} { + + @return 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. + +} { + return [file dirname [pkg_info_spec $pkg_info]] +} + ad_proc -private pkg_info_provides {pkg_info} { @return The dependencies provided by the package. @@ -386,10 +396,9 @@ ad_proc -private apm_package_install { {-enable:boolean} {-callback apm_dummy_callback} - {-copy_files:boolean} {-load_data_model:boolean} {-data_model_files 0} - {-install_path ""} + {-package_path ""} {-mount_path ""} spec_file_path } { @@ -410,12 +419,20 @@ set upgrade_from_version_name [apm_package_upgrade_from $package_key $version(name)] set upgrade_p [expr ![empty_string_p $upgrade_from_version_name]] - if { $copy_files_p } { - if { [empty_string_p $install_path] } { - set install_path [apm_workspace_install_dir]/$package_key - } - ns_log Notice "Copying $install_path to [acs_package_root_dir $package_key]" - exec "cp" "-r" -- "$install_path/$package_key" [acs_root_dir]/packages/ + if { [string match "[apm_workspace_install_dir]*" $package_path] } { + # Package is being installed from the apm_workspace dir (expanded from .apm file) + set old_package_path [acs_package_root_dir $package_key] + if { [file exists $old_package_path] } { + # Backup existing (old) package in packages dir first + exec "mv" "$old_package_path" "${old_package_path}.bak" + } + + # Move the package into the packages dir + exec "mv" "$package_path" "[acs_root_dir]/packages" + + # We moved the spec file, so update its path + set package_path $old_package_path + set spec_file_path [apm_package_info_file_path -path [file dirname $package_path] $package_key] } with_catch errmsg { @@ -731,6 +748,7 @@ set data_model_files [apm_data_model_scripts_find \ -upgrade_from_version_name $upgrade_from_version_name \ -upgrade_to_version_name $upgrade_to_version_name \ + -package_path $path \ $package_key] } @@ -1206,6 +1224,7 @@ ad_proc -private apm_data_model_scripts_find { {-upgrade_from_version_name ""} {-upgrade_to_version_name ""} + {-package_path ""} package_key } { @param version_id What version the files belong to. @@ -1220,27 +1239,24 @@ } set data_model_list [list] set upgrade_file_list [list] - set file_list [apm_get_package_files -file_types $types_to_retrieve -package_key $package_key] + set file_list [apm_get_package_files -file_types $types_to_retrieve -package_path $package_path -package_key $package_key] + foreach path $file_list { set file_type [apm_guess_file_type $package_key $path] set file_db_type [apm_guess_db_type $package_key $path] apm_log APMDebug "APM: Checking \"$path\" of type \"$file_type\" and db_type \"$file_db_type\"." - # DRB: we return datamodel files which match the given database type or for which no db_type - # is defined. The latter case is a kludge to simplify support of legacy ACS Oracle-only - # modules which haven't had their datamodel files moved to sql/oracle. Eventually we should - # remove the kludge and insist that datamodel files live in the proper directory. - - if {[lsearch -exact $types_to_retrieve $file_type] != -1 && \ - ([db_compatible_rdbms_p $file_db_type])} { + if {[lsearch -exact $types_to_retrieve $file_type] != -1 } { if { ![string compare $file_type "data_model_upgrade"] } { + # Upgrade script if {[apm_upgrade_for_version_p $path $upgrade_from_version_name \ $upgrade_to_version_name]} { # Its a valid upgrade script. ns_log Debug "APM: Adding $path to the list of upgrade files." lappend upgrade_file_list [list $path $file_type $package_key] } } else { + # Install script apm_log APMDebug "APM: Adding $path to the list of data model files." lappend data_model_list [list $path $file_type $package_key ] }

InstallEnablePackageDirectoryComment
$package(package-name) $package(name)/packages/$package(package.key)/$package_rel_path Dependencies satisfied.
$package(package-name) $package(name)/packages/$package(package.key)/$package_rel_path " foreach comment [pkg_info_comment $pkg_info] { @@ -219,7 +222,7 @@ append widget " $package(package-name) $package(name)/packages/$package(package.key)/$package_rel_path $comment