Index: openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl,v diff -u -r1.11 -r1.11.10.1 --- openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl 10 Jan 2007 21:21:59 -0000 1.11 +++ openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl 25 Aug 2014 09:27:10 -0000 1.11.10.1 @@ -29,7 +29,7 @@ set attribute_value [ns_set iget [rp_getform] $attribute_name] if { [info exists attribute(validation_proc)] } { - set attribute_error [eval $attribute(validation_proc) $attribute_value] + set attribute_error [$attribute(validation_proc) $attribute_value] if { $attribute_error ne "" } { ad_return_complaint 1 $attribute_error Index: openacs-4/packages/acs-admin/www/install/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/install/index.adp,v diff -u -r1.7.8.1 -r1.7.8.2 --- openacs-4/packages/acs-admin/www/install/index.adp 11 Sep 2013 18:40:07 -0000 1.7.8.1 +++ openacs-4/packages/acs-admin/www/install/index.adp 25 Aug 2014 09:27:10 -0000 1.7.8.2 @@ -17,18 +17,12 @@ - Install from Repository + Install or + upgrade + from repository. - Install from Local + Install or upgrade from local file system. - - - Upgrade from Repository - - - Upgrade from Local - -

Installed Packages

Index: openacs-4/packages/acs-admin/www/install/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/install/index.tcl,v diff -u -r1.7 -r1.7.16.1 --- openacs-4/packages/acs-admin/www/install/index.tcl 20 Apr 2004 21:12:29 -0000 1.7 +++ openacs-4/packages/acs-admin/www/install/index.tcl 25 Aug 2014 09:27:10 -0000 1.7.16.1 @@ -5,10 +5,8 @@ } set page_title "Install Software" - set context [list $page_title] - template::list::create \ -name packages \ -multirow packages \ @@ -48,24 +46,21 @@ where t.package_key = v.package_key and v.enabled_p = 't' and v.installed_p = 't' - [template::list::filter_where_clauses -and -name "packages"] + [template::list::filter_where_clauses -and -name packages] order by t.package_type, t.pretty_name " { set package_type_pretty [string totitle [lindex [split $package_type "_"] 1]] } +#set local_install_url [export_vars -base "install" { { package_type apm_application } }] +#set local_service_install_url [export_vars -base "install" { { package_type apm_service } }] +#set local_upgrade_url [export_vars -base "install" { { upgrade_p 1 } }] -set local_install_url [export_vars -base "install" { { package_type apm_application } }] +set local_install_url "[ad_conn package_url]/apm/packages-install" -set local_service_install_url [export_vars -base "install" { { package_type apm_service } }] - -set local_upgrade_url [export_vars -base "install" { { upgrade_p 1 } }] - - -set repository_url "http://openacs.org/repository/[apm_get_repository_channel]/" - -set remote_install_url [export_vars -base "install" { repository_url { package_type apm_application } }] - -set remote_service_install_url [export_vars -base "install" { { package_type apm_service } repository_url }] - -set remote_upgrade_url [export_vars -base "install" { { upgrade_p 1 } repository_url }] +set repository_url "http://openacs.org/repository/" +set head_channel [lindex [apm_get_repository_channels $repository_url] 0] +set current_channel [apm_get_repository_channel] +set channel $current_channel +set remote_install_url [export_vars -base "install" { repository_url channel current_channel head_channel }] +set remote_upgrade_url [export_vars -base "install" { { upgrade_p 1 } repository_url channel current_channel head_channel}] Index: openacs-4/packages/acs-admin/www/install/install-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/install/install-2.tcl,v diff -u -r1.2.10.1 -r1.2.10.2 --- openacs-4/packages/acs-admin/www/install/install-2.tcl 2 Oct 2013 08:56:25 -0000 1.2.10.1 +++ openacs-4/packages/acs-admin/www/install/install-2.tcl 25 Aug 2014 09:27:10 -0000 1.2.10.2 @@ -6,48 +6,76 @@ } if { [llength $package_key] == 0 } { - ad_returnredirct . + ad_returnredirect . ad_script_abort } +if { $repository_url ne "" } { + set parent_page_title "Install From OpenACS Repository" +} else { + set parent_page_title "Install From Local File System" +} + ##### # # Check dependencies # ##### - apm_get_package_repository -repository_url $repository_url -array repository -array set result [apm_dependency_check_new \ - -repository_array repository \ - -package_keys $package_key] +set install_pkgs $package_key +set count 0 +while 1 { + set fixpoint_p 1 -switch $result(status) { - ok { - set continue_url [export_vars -base "install-3" { repository_url }] - ad_set_client_property acs-admin install $result(install) - set page_title "Confirm" + ns_log notice "run apm_dependency_check_new [incr count] with <$install_pkgs>" + + array set result [apm_dependency_check_new \ + -repository_array repository \ + -package_keys $install_pkgs] + array set failed $result(failed) + + switch $result(status) { + ok { + set continue_url [export_vars -base "install-3" { repository_url }] + set page_title "Confirm" + } + failed { + set page_title "Missing Required Packages" + } + default { + error "Bad status returned from apm_depdendency_check_new: '$result(status)'" + } } - failed { - set page_title "Missing Required Packages" + + set must_add {} + foreach pkg $result(packages) { + + if {$pkg ni $install_pkgs} { + lappend install_pkgs $pkg + } + + array unset version + array set version $repository($pkg) + + foreach p $version(install) { + if {$p ni $install_pkgs} { + lappend install_pkgs $p + set fixpoint_p 0 + } + } } - default { - error "Bad status returned from apm_depdendency_check_new: '$result(status)'" - } + + if {$fixpoint_p} break } -if { $repository_url ne "" } { - set parent_page_title "Install From OpenACS Repository" -} else { - set parent_page_title "Install From Local File System" -} +#ns_log notice "install_pkgs $install_pkgs" +ad_set_client_property acs-admin install $install_pkgs - set context [list [list "." "Install Software"] [list "install" $parent_page_title] $page_title] - ##### # # Build list to display to user @@ -58,11 +86,9 @@ set problems_p 0 set extras_p 0 -array set failed $result(failed) - multirow create install package_key version_name package_name comment extra_p -foreach key $result(packages) { +foreach key $install_pkgs { set extra_p [expr {$key ni $package_key}] if { $extra_p } { set extras_p 1 @@ -74,7 +100,7 @@ foreach elm $failed($key) { lappend comments "[lindex $elm 0] [lindex $elm 1]" } - set comment "Requires [join $comments "; "]" + set comment "Requires [join $comments {; }]" } else { set comment {} } 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 -r1.9.10.2 -r1.9.10.3 --- openacs-4/packages/acs-admin/www/install/install-3.tcl 17 Oct 2013 08:44:30 -0000 1.9.10.2 +++ openacs-4/packages/acs-admin/www/install/install-3.tcl 25 Aug 2014 09:27:10 -0000 1.9.10.3 @@ -13,13 +13,11 @@ # ##### - ad_progress_bar_begin \ -title "Installing Packages" \ -message_1 "Installing selected packages, please wait ..." \ -message_2 "We will continue automatically when installation is complete." - ##### # # Get packages to install @@ -29,7 +27,6 @@ apm_get_package_repository -repository_url $repository_url -array repository set install [ad_get_client_property acs-admin install] - if { [llength $install] == 0 } { ns_log Notice "install-3.tcl: Nothing to install. Is this a double-click?" } @@ -38,8 +35,46 @@ ad_set_client_property acs-admin install {} +# +# Perform a topological sort for the right install order +# +set install_order "" +set to_install $install +ns_log notice "to_install: $to_install" +while {[llength $to_install] > 0} { + foreach package_key $to_install { + array unset version + array set version $repository($package_key) + + set satisfied_p 1 + foreach req [concat $version(embeds) $version(extends) $version(requires)] { + lassign $req pkg req_version + + # + # A package can be installed, when its requirements are + # installed before the package. All other dependencies + # were checked earlier. + # + + if { $pkg in $to_install } { + set satisfied_p 0 + #ns_log notice "we have to delay $pkg" + break + } + } + if {$satisfied_p} { + lappend install_order $package_key + set pos [lsearch $to_install $package_key] + set to_install [lreplace $to_install $pos $pos] + } + } + #ns_log notice "iteration: \nto_install: $to_install\ninstall_order: $install_order" +} + +ns_log notice "Install packages in this order: $install_order" + ##### # # Install packages @@ -48,7 +83,7 @@ set success_p 1 -foreach package_key $install { +foreach package_key $install_order { ns_log Notice "Installing $package_key" array unset version @@ -102,7 +137,12 @@ ns_log Debug "Data model scripts: \nupgrade_from_version_name = $initial_version_name\nupgrade_to_version_name=$final_version_name\npackage_path=$package_path\npackage_key=$package_key\n => $data_model_files" - # Install the packages -- this actually copies the files into the right place in the file system and backs up any old files + ns_write [subst { +

Installing $package_key ...
+ + }] + # Install the packages -- 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 \ -package_path $package_path \ @@ -115,7 +155,17 @@ # 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" } + ns_write { + + } } ##### Index: openacs-4/packages/acs-admin/www/install/install.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/install/install.adp,v diff -u -r1.2.16.1 -r1.2.16.2 --- openacs-4/packages/acs-admin/www/install/install.adp 11 Sep 2013 18:40:07 -0000 1.2.16.1 +++ openacs-4/packages/acs-admin/www/install/install.adp 25 Aug 2014 09:27:10 -0000 1.2.16.2 @@ -10,10 +10,10 @@ -

There are no un-installed applications in your file system.

+

There are no un-installed applications in your file system meeting the filter criteria.

-

There are no un-installed applications in the OpenACS repository.

+

There are no un-installed applications in the OpenACS repository meeting the filter criteria.

Index: openacs-4/packages/acs-admin/www/install/install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/install/install.tcl,v diff -u -r1.7.2.2 -r1.7.2.3 --- openacs-4/packages/acs-admin/www/install/install.tcl 12 Oct 2013 14:29:49 -0000 1.7.2.2 +++ openacs-4/packages/acs-admin/www/install/install.tcl 25 Aug 2014 09:27:10 -0000 1.7.2.3 @@ -1,12 +1,34 @@ ad_page_contract { Install from local file system } { - package_type:optional - {upgrade_p 0} + {package_type ""} + {upgrade_p:boolean 0} {repository_url ""} + {channel ""} + {maturity:naturalnum ""} + {current_channel} + {head_channel} } +# +# In upgrade mode, offer per default all maturities, in install-mode, +# start with mature packages. +# +if {$upgrade_p} { + set default_maturity 0 +} else { + set default_maturity 2 +} + +if {$maturity eq ""} { + set maturity $default_maturity +} + +# +# Set page title to reflect install from repository or from file system +# + if { $repository_url ne "" } { set page_title "Install or Upgrade From OpenACS Repository" } else { @@ -26,29 +48,57 @@ set upgrades_p 0 array set package [list] -apm_get_package_repository -repository_url $repository_url -array repository +if {$channel eq ""} {set channel $current_channel} +set fetch_url $repository_url/$channel/ +apm_get_package_repository -repository_url $fetch_url -array repository + foreach package_key [array names repository] { array unset version array set version $repository($package_key) - if { (![info exists package_type] || $package_type eq "") || $version(package.type) eq $package_type } { + if {![info exists version(maturity)] || $version(maturity) eq ""} { + set version(maturity) 0 + } + + #ns_log notice "$version(package.key) $repository($package_key)" + #ns_log notice "compare $version(package.key) $version(maturity) < $maturity" + if {$version(maturity) < $maturity} continue + if {![apm_package_supports_rdbms_p -package_key $package_key]} continue + + if { $package_type eq "" || $version(package.type) eq $package_type } { set package_key $version(package.key) - - # If in upgrade mode, only add to list if it's an upgrade - if { !$upgrade_p || $version(install_type) eq "upgrade" } { - if {(![info exists version(maturity)] || $version(maturity) eq "")} { - set version(maturity) "" + + # + # If in upgrade mode, only add to list if it's an upgrade, in + # install-mode list only installs. + # + if { (!$upgrade_p && $version(install_type) eq "install") + || ($upgrade_p && $version(install_type) eq "upgrade") + } { + + if {[info commands ::apm::package_version::attributes::maturity_int_to_text] ne ""} { + set maturity_text [::apm::package_version::attributes::maturity_int_to_text $version(maturity)] + } else { + set maturity_text "" } + set package([string toupper $version(package-name)]) \ [list \ $version(package.key) \ $version(package-name) \ $version(name) \ $version(package.type) \ $version(install_type) \ - $version(summary) \ - $version(maturity)] + $version(summary) \ + $maturity_text \ + $version(vendor) \ + $version(vendor.url) \ + $version(owner) \ + $version(owner.url) \ + $version(release-date) \ + $version(license) \ + ] } } } @@ -61,36 +111,22 @@ ##### # Sort the list alphabetically (in case package_name and package_key doesn't sort the same) -multirow create packages package_key package_name version_name package_type install_type summary maturity +multirow create packages package_key package_name version_name package_type install_type summary \ + maturity vendor vendor_url owner owner_url release_date license if {[catch {set maturity_label [apm::package_version::attributes::get_pretty_name maturity]} errmsg]} { set maturity_label "Maturity" } foreach name [lsort -ascii [array names package]] { - set row $package($name) - if {[info commands ::apm::package_version::attributes::maturity_int_to_text] ne ""} { - set maturity_text [::apm::package_version::attributes::maturity_int_to_text [lindex $row 6]] - } else { - set maturity_text "" - } - - multirow append packages \ - [lindex $row 0] \ - [lindex $row 1] \ - [lindex $row 2] \ - [lindex $row 3] \ - [lindex $row 4] \ - [lindex $row 5] \ - $maturity_text + multirow append packages {*}$package($name) } multirow extend packages install_url multirow -unclobber foreach packages { - set install_url [export_vars -base install-2 { package_key repository_url }] + set install_url [export_vars -base install-2 { package_key {repository_url $fetch_url}}] } - # Build the list-builder list template::list::create \ -name packages \ @@ -100,7 +136,7 @@ "Install or upgrade checked applications" "install-2" "Install or upgrade checked applications" } \ -bulk_action_export_vars { - repository_url + {repository_url $fetch_url} } \ -elements { package_name { @@ -110,6 +146,13 @@ } summary { label "Summary" + display_template {@packages.summary@
+ Vendor: @packages.vendor@ + @packages.vendor@ + (released on @packages.release_date@, license: @packages.license@) +
+ Details: @packages.package_key@ + } } maturity { label "$maturity_label" @@ -127,6 +170,26 @@ display_eval {[ad_decode $install_type "upgrade" "Upgrade" ""]} } } -filters { + channel { + label "Channel" + values { + {Current $current_channel} + {Head $head_channel} + } + default_value $current_channel + } + + maturity { + label "Maturity at least" + values { + {New 0} + {Immature 1} + {Mature 2} + {"Mature and Standard" 3} + } + default_value default_maturity + } + package_type { label "Type" values { @@ -142,9 +205,9 @@ } default_value 0 } - repository_url { - hide_p 1 - } + repository_url { hide_p 1 } + current_channel { hide_p 1 } + head_channel { hide_p 1 } }