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.18.8.9 -r1.18.8.10 --- openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 12 Aug 2014 09:12:01 -0000 1.18.8.9 +++ openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 12 Aug 2014 10:29:17 -0000 1.18.8.10 @@ -59,7 +59,7 @@ # this is rather a hack, but just needed for streaming output # a more general solution can be provided at some later time... regsub "#acs-kernel.Main_Site#" $context_bar \ - [_ acs-kernel.Main_Site] context_bar + [_ acs-kernel.Main_Site] context_bar } append body [ad_header $title ""] "\n" @@ -181,7 +181,7 @@ append widget "> $package(package-name) $package(name) $package_rel_path - + " foreach comment [pkg_info_comment $pkg_info] { append widget "$comment
" @@ -195,18 +195,18 @@ # See if the install is already installed with a higher version number. if {[apm_package_registered_p $package_key]} { set higher_version_p [apm_higher_version_installed_p $package_key $version_name] - } else { - set higher_version_p 2 - } - if {$higher_version_p == 2 } { - set comment "New install." - } elseif {$higher_version_p == 1 } { - set comment "Upgrade." - } elseif {$higher_version_p == 0} { - set comment "Package version already installed." - } else { - set comment "Installing older version of package." - } + } else { + set higher_version_p 2 + } + if {$higher_version_p == 2 } { + set comment "New install." + } elseif {$higher_version_p == 1 } { + set comment "Upgrade." + } elseif {$higher_version_p == 0} { + set comment "Package version already installed." + } else { + set comment "Installing older version of package." + } append widget " " @@ -232,8 +232,8 @@ } append widget " - $package(package-name) $package(name) - $package_rel_path + $package(package-name) $package(name) + $package_rel_path $comment " } @@ -253,12 +253,12 @@ @param version_name The name of the currently installed version. @return The return value of this procedure doesn't really fit with its name. - What it returns is: + What it returns is: } { @@ -294,18 +294,18 @@ # Configuration Settings #---------------------------------------------------------------------- - set cd_helper "$::acs::rootdir/bin/cd-helper" + set cd_helper $::acs::rootdir/bin/cd-helper - set cvs_command "cvs" - set cvs_root ":pserver:anonymous@cvs.openacs.org:/cvsroot" + set cvs_command cvs + set cvs_root :pserver:anonymous@cvs.openacs.org:/cvsroot - set work_dir "$::acs::rootdir/repository-builder/" + set work_dir $::acs::rootdir/repository-builder/ - set repository_dir "$::acs::rootdir/www/repository/" - set repository_url "http://openacs.org/repository/" + set repository_dir $::acs::rootdir/www/repository/ + set repository_url http://openacs.org/repository/ - set channel_index_template "/packages/acs-admin/www/apm/repository-channel-index" - set index_template "/packages/acs-admin/www/apm/repository-index" + set channel_index_template /packages/acs-admin/www/apm/repository-channel-index + set index_template /packages/acs-admin/www/apm/repository-index set exclude_package_list {} @@ -328,32 +328,32 @@ set lines [split $output \n] for { set i 0 } { $i < [llength $lines] } { incr i } { - if { [string trim [lindex $lines $i]] eq "symbolic names:" } { - incr i - break - } + if { [string trim [lindex $lines $i]] eq "symbolic names:" } { + incr i + break + } } array set channel_tag [list] array set channel_bugfix_version [list] for { } { $i < [llength $lines] } { incr i } { - # Tag lines have the form tag: cvs-version - # openacs-5-0-0-final: 1.25.2.5 + # Tag lines have the form tag: cvs-version + # openacs-5-0-0-final: 1.25.2.5 - if { ![regexp {^\s+([^:]+):\s+([0-9.]+)} [lindex $lines $i] match tag_name version_name] } { - break - } - - # Look for tags named 'openacs-x-y-compat' - if { [regexp {^openacs-([1-9][0-9]*-[0-9]+)-compat$} $tag_name match oacs_version] } { - lassign [split $oacs_version "-"] major_version minor_version - if { $major_version >= 5 && $minor_version >= 3} { - set channel "${major_version}-${minor_version}" - ns_log Notice "Repository: Found channel $channel using tag $tag_name" - set channel_tag($channel) $tag_name - } - } + if { ![regexp {^\s+([^:]+):\s+([0-9.]+)} [lindex $lines $i] match tag_name version_name] } { + break + } + + # Look for tags named 'openacs-x-y-compat' + if { [regexp {^openacs-([1-9][0-9]*-[0-9]+)-compat$} $tag_name match oacs_version] } { + lassign [split $oacs_version "-"] major_version minor_version + if { $major_version >= 5 && $minor_version >= 3} { + set channel "${major_version}-${minor_version}" + ns_log Notice "Repository: Found channel $channel using tag $tag_name" + set channel_tag($channel) $tag_name + } + } } set channel_tag($head_channel) HEAD @@ -373,258 +373,258 @@ foreach channel [lsort -decreasing [array names channel_tag]] { - if {![string match $channels $channel]} continue - ns_log Notice "Repository: Channel $channel using tag $channel_tag($channel)" - - # Wipe and re-create the checkout directory - file delete -force "${work_dir}openacs-4" - file delete -force "${work_dir}dotlrn" - file mkdir "${work_dir}dotlrn/packages" - - # Prepare channel directory - set channel_dir "${work_dir}repository/$channel/" - file mkdir $channel_dir + if {![string match $channels $channel]} continue + ns_log Notice "Repository: Channel $channel using tag $channel_tag($channel)" + + # Wipe and re-create the checkout directory + file delete -force "${work_dir}openacs-4" + file delete -force "${work_dir}dotlrn" + file mkdir "${work_dir}dotlrn/packages" + + # Prepare channel directory + set channel_dir "${work_dir}repository/$channel/" + file mkdir $channel_dir - # Store the list of packages we've seen for this channel, so we don't include the same package twice - # Seems odd, but we have to do this given the forked packages sitting in /contrib - set packages [list] - - # Checkout from the tag given by channel_tag($channel) - if { $debug_p } { - # Smaller list for debugging purposes - set checkout_list [list $work_dir $cvs_root openacs-4/packages/acs-core-docs ] - } else { - # Full list for real use - set checkout_list [list \ - $work_dir $cvs_root openacs-4/packages \ - $work_dir $cvs_root openacs-4/contrib/packages] - } - - foreach { cur_work_dir cur_cvs_root cur_module } $checkout_list { - #cd $cur_work_dir - set cmd [list exec $cd_helper $cur_work_dir cvs -d $cur_cvs_root -z3 co] - if { $channel_tag($channel) ne "HEAD" } { - lappend cmd -r $channel_tag($channel) - } - catch { {*}$cmd $cur_module } output - ns_log Notice "Repository: $cur_module [llength $output] files ($channel_tag($channel))" - } - #cd $work_dir + # Store the list of packages we've seen for this channel, so we don't include the same package twice + # Seems odd, but we have to do this given the forked packages sitting in /contrib + set packages [list] + + # Checkout from the tag given by channel_tag($channel) + if { $debug_p } { + # Smaller list for debugging purposes + set checkout_list [list $work_dir $cvs_root openacs-4/packages/acs-core-docs ] + } else { + # Full list for real use + set checkout_list [list \ + $work_dir $cvs_root openacs-4/packages \ + $work_dir $cvs_root openacs-4/contrib/packages] + } + + foreach { cur_work_dir cur_cvs_root cur_module } $checkout_list { + #cd $cur_work_dir + set cmd [list exec $cd_helper $cur_work_dir cvs -d $cur_cvs_root -z3 co] + if { $channel_tag($channel) ne "HEAD" } { + lappend cmd -r $channel_tag($channel) + } + catch { {*}$cmd $cur_module } output + ns_log Notice "Repository: $cur_module [llength $output] files ($channel_tag($channel))" + } + #cd $work_dir - set manifest "\n" + set manifest "\n" - template::multirow create packages \ - package_path package_key version pretty_name \ - package_type summary description \ - release_date vendor_url vendor \ - maturity maturity_text \ - license license_url - - set work_dirs [list ${work_dir}openacs-4/packages ${work_dir}openacs-4/contrib/packages ] - foreach packages_dir $work_dirs { + template::multirow create packages \ + package_path package_key version pretty_name \ + package_type summary description \ + release_date vendor_url vendor \ + maturity maturity_text \ + license license_url + + set work_dirs [list ${work_dir}openacs-4/packages ${work_dir}openacs-4/contrib/packages ] + foreach packages_dir $work_dirs { - foreach spec_file [lsort [apm_scan_packages $packages_dir]] { - - set package_path [file join {*}[lrange [file split $spec_file] 0 end-1]] - set package_key [lindex [file split $spec_file] end-1] - - if { $package_key in $exclude_package_list } { - ns_log Debug "Repository: Package $package_key is on list of packages to exclude - skipping" - continue - } - - if { [array exists pkg_info] } { - array unset pkg_info - } - if { [info exists pkg_info] } { - unset pkg_info - } - - with_catch errmsg { - array set pkg_info [apm_read_package_info_file $spec_file] - - if { $pkg_info(package.key) in $packages } { - ns_log Debug "Repository: Skipping package $package_key, because we already have another version of it" - } else { - lappend packages $pkg_info(package.key) - - append manifest \ - " " \n \ - " [ad_quotehtml $pkg_info(package.key)]\n" \ - " [ad_quotehtml $pkg_info(name)]\n" \ - " [ad_quotehtml $pkg_info(package-name)]\n" \ - " [ad_quotehtml $pkg_info(package.type)]\n" \ - " [ad_quotehtml $pkg_info(summary)]\n" \ - " " \ - [ad_quotehtml $pkg_info(description)] "\n" \ - " [ad_quotehtml $pkg_info(release-date)]\n" \ - " " \ - [ad_quotehtml $pkg_info(vendor)] "\n" \ - " " \ - [ad_quotehtml $pkg_info(license)] "\n" \ - " $pkg_info(maturity)\n" - - if {![info exists pkg_info(maturity_text)]} { - set pkg_info(maturity_text) "" - } - - template::multirow append packages \ - $package_path $package_key $pkg_info(name) $pkg_info(package-name) \ - $pkg_info(package.type) $pkg_info(summary) $pkg_info(description) \ - $pkg_info(release-date) $pkg_info(vendor.url) $pkg_info(vendor) \ - $pkg_info(maturity) $pkg_info(maturity_text) \ - $pkg_info(license) $pkg_info(license_url) - - set apm_file "${channel_dir}${pkg_info(package.key)}-${pkg_info(name)}.apm" - ns_log Notice "Repository: Building package $package_key for channel $channel" - - set files [apm_get_package_files \ - -all \ - -include_data_model_files \ - -all_db_types \ - -package_key $pkg_info(package.key) \ - -package_path $package_path] - - if { [llength $files] == 0 } { - ns_log Notice "Repository: No files in package" - } else { - ns_log Notice "Repository: [llength $files] files in package $pkg_info(package.key) ($channel)" - set cmd [list exec [apm_tar_cmd] cf - 2>/dev/null] - - # The path to the 'packages' directory in the checkout - set packages_root_path [file join {*}[lrange [file split $spec_file] 0 end-2]] - - set tmp_filename [ad_tmpnam] - lappend cmd --files-from $tmp_filename -C $packages_root_path - - set fp [open $tmp_filename w] - foreach file $files { - puts $fp $package_key/$file - } - close $fp - - lappend cmd "|" [apm_gzip_cmd] -c ">" $apm_file - ns_log Notice "Executing: $cmd" - if {[catch "exec $cd_helper $packages_root_path $cmd" errmsg]} { - ns_log notice "Error during tar in repository creation for\ - file ${channel_dir}$pkg_info(package.key)-$pkg_info(name).apm:\ - \n$errmsg\n$::errorCode,$::errorInfo" - } - file delete $tmp_filename - } - - set apm_url "${repository_url}$channel/$pkg_info(package.key)-$pkg_info(name).apm" - - append manifest " $apm_url\n" - foreach elm $pkg_info(provides) { - append manifest " \n" - } - - foreach elm $pkg_info(requires) { - append manifest " \n" - } - append manifest " \n" - } - } { - ns_log Notice "Repository: Error on spec_file $spec_file: $errmsg\n$::errorInfo\n" - } - } - } - append manifest "\n" - - ns_log Notice "Repository: Writing $channel manifest to ${channel_dir}manifest.xml" - set fw [open "${channel_dir}manifest.xml" w] - puts $fw $manifest - close $fw + foreach spec_file [lsort [apm_scan_packages $packages_dir]] { + + set package_path [file join {*}[lrange [file split $spec_file] 0 end-1]] + set package_key [lindex [file split $spec_file] end-1] + + if { $package_key in $exclude_package_list } { + ns_log Debug "Repository: Package $package_key is on list of packages to exclude - skipping" + continue + } + + if { [array exists pkg_info] } { + array unset pkg_info + } + if { [info exists pkg_info] } { + unset pkg_info + } + + with_catch errmsg { + array set pkg_info [apm_read_package_info_file $spec_file] + + if { $pkg_info(package.key) in $packages } { + ns_log Debug "Repository: Skipping package $package_key, because we already have another version of it" + } else { + lappend packages $pkg_info(package.key) + + append manifest \ + " " \n \ + " [ad_quotehtml $pkg_info(package.key)]\n" \ + " [ad_quotehtml $pkg_info(name)]\n" \ + " [ad_quotehtml $pkg_info(package-name)]\n" \ + " [ad_quotehtml $pkg_info(package.type)]\n" \ + " [ad_quotehtml $pkg_info(summary)]\n" \ + " " \ + [ad_quotehtml $pkg_info(description)] "\n" \ + " [ad_quotehtml $pkg_info(release-date)]\n" \ + " " \ + [ad_quotehtml $pkg_info(vendor)] "\n" \ + " " \ + [ad_quotehtml $pkg_info(license)] "\n" \ + " $pkg_info(maturity)\n" + + if {![info exists pkg_info(maturity_text)]} { + set pkg_info(maturity_text) "" + } + + template::multirow append packages \ + $package_path $package_key $pkg_info(name) $pkg_info(package-name) \ + $pkg_info(package.type) $pkg_info(summary) $pkg_info(description) \ + $pkg_info(release-date) $pkg_info(vendor.url) $pkg_info(vendor) \ + $pkg_info(maturity) $pkg_info(maturity_text) \ + $pkg_info(license) $pkg_info(license_url) + + set apm_file "${channel_dir}${pkg_info(package.key)}-${pkg_info(name)}.apm" + ns_log Notice "Repository: Building package $package_key for channel $channel" + + set files [apm_get_package_files \ + -all \ + -include_data_model_files \ + -all_db_types \ + -package_key $pkg_info(package.key) \ + -package_path $package_path] + + if { [llength $files] == 0 } { + ns_log Notice "Repository: No files in package" + } else { + ns_log Notice "Repository: [llength $files] files in package $pkg_info(package.key) ($channel)" + set cmd [list exec [apm_tar_cmd] cf - 2>/dev/null] + + # The path to the 'packages' directory in the checkout + set packages_root_path [file join {*}[lrange [file split $spec_file] 0 end-2]] + + set tmp_filename [ad_tmpnam] + lappend cmd --files-from $tmp_filename -C $packages_root_path + + set fp [open $tmp_filename w] + foreach file $files { + puts $fp $package_key/$file + } + close $fp + + lappend cmd "|" [apm_gzip_cmd] -c ">" $apm_file + ns_log Notice "Executing: $cmd" + if {[catch "exec $cd_helper $packages_root_path $cmd" errmsg]} { + ns_log notice "Error during tar in repository creation for\ + file ${channel_dir}$pkg_info(package.key)-$pkg_info(name).apm:\ + \n$errmsg\n$::errorCode,$::errorInfo" + } + file delete $tmp_filename + } + + set apm_url "${repository_url}$channel/$pkg_info(package.key)-$pkg_info(name).apm" + + append manifest " $apm_url\n" + foreach elm $pkg_info(provides) { + append manifest " \n" + } + + foreach elm $pkg_info(requires) { + append manifest " \n" + } + append manifest " \n" + } + } { + ns_log Notice "Repository: Error on spec_file $spec_file: $errmsg\n$::errorInfo\n" + } + } + } + append manifest "\n" + + ns_log Notice "Repository: Writing $channel manifest to ${channel_dir}manifest.xml" + set fw [open "${channel_dir}manifest.xml" w] + puts $fw $manifest + close $fw - ns_log Notice "Repository: Writing $channel index page to ${channel_dir}index.adp" - set fw [open "${channel_dir}index.adp" w] - set packages [lsort $packages] - puts $fw "\nOpenACS $channel Compatible Packages\n\n" - puts $fw "

OpenACS $channel Core and compatibile packages

+ ns_log Notice "Repository: Writing $channel index page to ${channel_dir}index.adp" + set fw [open "${channel_dir}index.adp" w] + set packages [lsort $packages] + puts $fw "\nOpenACS $channel Compatible Packages\n\n" + puts $fw "

OpenACS $channel Core and compatibile packages

Packages can be installed with the OpenACS Automated Installer on your OpenACS site at /acs-admin/install. Only packages designated compatible with your OpenACS kernel will be shown.

" - set category_title(core) "Core Packages" - set package_keys(core) { - acs-admin - acs-api-browser - acs-authentication - acs-automated-testing - acs-bootstrap-installer - acs-content-repository - acs-core-docs - acs-kernel - acs-lang - acs-mail-lite - acs-messaging - acs-reference - acs-service-contract - acs-subsite - acs-tcl - acs-templating - ref-timezones - acs-translations - intermedia-driver - openacs-default-theme - notifications - search - tsearch2-driver - } - set category_title(common-app) "Common Applications" - set package_keys(common-app) { - xowiki - xotcl-request-monitor - file-storage - acs-developer-support - forums - calendar - news - faq - } - set category_title(extra) "Extra Packages and Libraries" - set package_keys(extra) "" - foreach p $packages { - if {$p ni $package_keys(core) && $p ni $package_keys(common-app)} { - lappend package_keys(extra) $p - } - } + set category_title(core) "Core Packages" + set package_keys(core) { + acs-admin + acs-api-browser + acs-authentication + acs-automated-testing + acs-bootstrap-installer + acs-content-repository + acs-core-docs + acs-kernel + acs-lang + acs-mail-lite + acs-messaging + acs-reference + acs-service-contract + acs-subsite + acs-tcl + acs-templating + ref-timezones + acs-translations + intermedia-driver + openacs-default-theme + notifications + search + tsearch2-driver + } + set category_title(common-app) "Common Applications" + set package_keys(common-app) { + xowiki + xotcl-request-monitor + file-storage + acs-developer-support + forums + calendar + news + faq + } + set category_title(extra) "Extra Packages and Libraries" + set package_keys(extra) "" + foreach p $packages { + if {$p ni $package_keys(core) && $p ni $package_keys(common-app)} { + lappend package_keys(extra) $p + } + } - foreach category {core common-app extra} { + foreach category {core common-app extra} { - template::multirow create pkgs \ - package_path package_key version pretty_name \ - package_type summary description \ - release_date vendor_url vendor \ - maturity maturity_text \ - license license_url - - template::multirow foreach packages { - if {$package_key in $package_keys($category)} { - template::multirow append pkgs \ - $package_path $package_key $version $pretty_name \ - $package_type $summary $description \ - $release_date $vendor_url $vendor \ - $maturity $maturity_text \ - $license $license_url - } - } + template::multirow create pkgs \ + package_path package_key version pretty_name \ + package_type summary description \ + release_date vendor_url vendor \ + maturity maturity_text \ + license license_url + + template::multirow foreach packages { + if {$package_key in $package_keys($category)} { + template::multirow append pkgs \ + $package_path $package_key $version $pretty_name \ + $package_type $summary $description \ + $release_date $vendor_url $vendor \ + $maturity $maturity_text \ + $license $license_url + } + } - puts $fw "\n

$category_title($category)

\n" - - puts $fw [template::adp_include $channel_index_template \ - [list channel $channel &pkgs pkgs update_pretty_date $update_pretty_date]] - - } - close $fw + puts $fw "\n

$category_title($category)

\n" + + puts $fw [template::adp_include $channel_index_template \ + [list channel $channel &pkgs pkgs update_pretty_date $update_pretty_date]] + + } + close $fw - ns_log Notice "Repository: Channel $channel complete." - + ns_log Notice "Repository: Channel $channel complete." + } ns_log Notice "Repository: Finishing Repository" @@ -633,12 +633,12 @@ ns_log Notice "Repository: Writing repository index page to ${work_dir}repository/index.adp" template::multirow create channels name tag foreach channel [lsort -decreasing [array names channel_tag]] { - template::multirow append channels $channel $channel_tag($channel) + template::multirow append channels $channel $channel_tag($channel) } set fw [open "${work_dir}repository/index.adp" w] puts $fw "\nOpenACS Package Repository\n\n" puts $fw [template::adp_include -- $index_template \ - [list &channels channels update_pretty_date $update_pretty_date]] + [list &channels channels update_pretty_date $update_pretty_date]] close $fw @@ -650,15 +650,21 @@ ns_log Notice "Repository: Moving work repository $work_repository_dirname to live repository dir at $repository_dir\n" if { [file exists $repository_bak] } { - file delete -force $repository_bak + file delete -force $repository_bak } if { [file exists $repository_dirname] } { - file rename $repository_dirname $repository_bak + file rename $repository_dirname $repository_bak } file rename $work_repository_dirname $repository_dirname ns_log Debug "Repository: DONE" return 0 } - + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: