Index: openacs-4/packages/acs-admin/www/install/install-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/install/install-3.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-admin/www/install/install-3.tcl 27 Oct 2014 16:38:56 -0000 1.10 +++ openacs-4/packages/acs-admin/www/install/install-3.tcl 7 Aug 2017 23:47:45 -0000 1.11 @@ -89,19 +89,32 @@ array unset version array set version $repository($package_key) - if { ([info exists version(download_url)] && $version(download_url) ne "") } { + if { [info exists version(download_url)] && $version(download_url) ne "" } { + ns_write [subst { +

Transferring $version(download_url) ... + + }] set spec_file [apm_load_apm_file -url $version(download_url)] if { $spec_file eq "" } { - ns_log Error "Error downloading package $package_key from $version(download_url). Installing package failed." + set msg "Error downloading package $package_key from $version(download_url). Installing package failed." + ns_write [subst { +

$msg + + }] + ns_log Error $msg set success_p 0 continue } + ns_write [subst { + Done
+ + }] set package_path "[apm_workspace_install_dir]/$package_key" } else { set spec_file $version(path) set package_path "$::acs::rootdir/packages/$package_key" } - + set final_version_name $version(name) if { [apm_package_version_installed_p $version(package.key) $version(name)] } { @@ -139,12 +152,15 @@ ns_write [subst {

Installing $package_key ...
- + }] - # Install the packages -- this actually copies the files into the + + # Install the package -- this actually copies the files into the # right place in the file system and backs up any old files + set version_id [apm_package_install \ -enable \ + -install_from_repository \ -package_path $package_path \ -load_data_model \ -data_model_files $data_model_files \ @@ -155,16 +171,61 @@ # as there might be packages depending on the failed package. Ideally we should # probably check for such dependencies and continue if there are none. set success_p 0 - } elseif {[file exists $::acs::rootdir/packages/$package_key/install.xml]} { - ns_write "... configure $package_key
\n" - #ns_log notice "===== RUN /packages/$package_key/install.xml" - apm::process_install_xml /packages/$package_key/install.xml "" - ns_write "... installation OK
\n" } else { ns_write "... installation OK
\n" } + + if {$success_p} { + # + # The update has finished successfully. Since all the new + # files were sourced, the actual connection thread is already + # up to date. In order to provide this code to the other + # threads, it is necessary to update the internal + # blueprint. This works different in NaviServer and AOLserver, + # and is supported only by NaviServer for the time being. + # + # Other options: + # + # - run apm_package_install via "ns_eval": does not work, + # since "ns_eval" runs a script twice, a package can only + # be installed once. + # + # - run parts of apm_package_install: e.g. loading just the + # procs does not work, when it depends e.g. on package + # parameters, which have as well be updated in the + # blueprint. + # + # - fix the behavior in AOLserver + # + if {[info commands ::nstrace::statescript] ne ""} { + # + # NaviServer variant: + # - nstrace::statescript produces the blueprint + # - "ns_ictl save" updates it in the server + # + ns_ictl save [nstrace::statescript] + ns_write "... blueprint updated
\n" + } else { + # + # AOLserver: _ns_savenamespaces produces the update script + # and updates the blueprint, .... but it kills the + # internal state of the server. After running this + # command, e.g. all ns_sets are gone, later commands run + # into problems. + # + # _ns_savenamespaces + } + } else { + # + # At least one update has failed. Since it is not clear whether or + # not library files were sourced, it is necessary to delete this + # thread asap to avoid potential confusion with already updated + # procs. + # + ns_ictl markfordelete + } ns_write { - + } } @@ -177,3 +238,8 @@ ad_progress_bar_end -url [export_vars -base install-4 { repository_url success_p }] +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: