Index: openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl,v diff -u -r1.12.4.11 -r1.12.4.12 --- openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl 17 Aug 2014 12:36:27 -0000 1.12.4.11 +++ openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl 23 Aug 2014 12:35:45 -0000 1.12.4.12 @@ -30,49 +30,82 @@ ##### apm_get_package_repository -array repository - array set result [apm_dependency_check_new \ - -repository_array repository \ - -package_keys $package_key] - array set failed $result(failed) + set install_pkgs $package_key + while 1 { + set fixpoint_p 1 - #ns_log notice [array get result] + ns_log notice "run apm_dependency_check_new with <$install_pkgs>" + array set result [apm_dependency_check_new \ + -repository_array repository \ + -package_keys $install_pkgs] + #ns_log notice "RESULT of apm_dependency_check_new: [array get result]" - switch $result(status) { - ok { - set title "Confirm" + array set failed $result(failed) + + switch $result(status) { + ok { + set title "Confirm" + } + failed { + set title "Missing Required Packages" + } + default { + error "Bad status returned from apm_depdendency_check_new: '$result(status)'" + } } - failed { - set title "Missing Required Packages" - } - default { - error "Bad status returned from apm_depdendency_check_new: '$result(status)'" - } - } - # - # Get the package info list with potential unresolved dependencies - # - set pkg_info_list {} - foreach pkg $result(packages) { - set spec_file [apm_package_info_file_path $pkg] - array set package [apm_read_package_info_file $spec_file] - - if {[info exists failed($pkg)]} { - set comments {} - foreach e $failed($pkg) { - lappend comments "Requires: [lindex $e 0] [lindex $e 1]" + # + # Get the package info list with potential unresolved dependencies + # + set pkg_info_list {} + foreach pkg $result(packages) { + + # + # Load package info from spec file. + # + if {[catch {set spec_file [apm_package_info_file_path $pkg]}]} { + # + # In case the spec file is not found (unknown package) + # produce an empty entry. + # + array set package [list package.key $pkg embeds "" extends "" \ + provides "" requires "" properties {install ""}] + } else { + array set package [apm_read_package_info_file $spec_file] } - set flag f - } else { - lassign {t ""} flag comments + + if {[info exists failed($pkg)]} { + set comments {} + foreach e $failed($pkg) { + lappend comments "Requires: [lindex $e 0] [lindex $e 1]" + } + set flag f + } else { + lassign {t ""} flag comments + array set properties $package(properties) + + set must_add {} + foreach p $properties(install) { + if {$p ni $install_pkgs} { + lappend must_add $p + } + } + if {[llength $must_add] > 0} { + lappend install_pkgs {*}$must_add + ns_log notice "+++ install_pkgs <$install_pkgs> after must_add <$must_add>" + set fixpoint_p 0 + break + } + } + lappend pkg_info_list [pkg_info_new $package(package.key) \ + $spec_file \ + $package(embeds) \ + $package(extends) \ + $package(provides) \ + $package(requires) \ + $flag $comments] } - lappend pkg_info_list [pkg_info_new $package(package.key) \ - $spec_file \ - $package(embeds) \ - $package(extends) \ - $package(provides) \ - $package(requires) \ - $flag $comments] + if {$fixpoint_p} break } # @@ -81,6 +114,7 @@ # if {$result(status) eq "ok" && [llength $result(install)] > [llength $package_key]} { + set body [subst {

Additional Packages Automatically Added

@@ -90,7 +124,6 @@ of packages below.

- [export_vars -form {package_key}]

}] append body [apm_package_selection_widget $pkg_info_list $result(install)] @@ -113,6 +146,8 @@ ### Check failed. Offer user an explanation and an ability to ### select unselect packages. + #[export_vars -form {package_key}]

+ set body [subst {

Unsatisfied Dependencies

@@ -127,9 +162,6 @@

If you think you might want to use a package later (but not right away), install it but don't enable it. - - [export_vars -form {package_key}]

- }] append body \