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.12 -r1.12.2.1 --- openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 11 Dec 2003 21:39:45 -0000 1.12 +++ openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 18 Dec 2004 00:42:27 -0000 1.12.2.1 @@ -264,3 +264,300 @@ return [db_string apm_higher_version_installed_p {} -default 1] } + + +ad_proc -private apm_build_repository { + {debug_p 0} + {head_channel 5-2} +} { + + Rebuild the repository on the local machine. Only useful for the openacs.org site. Adapted from Lars' build-repository.tcl page. + @param debug_p Set to 1 to test with only a small subset of packages instead of the whole cvs tree. + @param head_channel The artificial branch label to apply to HEAD. Should be one minor version past the current release. + @author Lars Pind (lars@collaboraid.biz) + @return 0 for success. Also outputs debug strings to log. + +} { + + #---------------------------------------------------------------------- + # Configuration Settings + #---------------------------------------------------------------------- + + set cvs_command "cvs" + set cvs_root ":pserver:anonymous@cvs.openacs.org:/cvsroot" + + set work_dir "[acs_root_dir]/repository-builder/" + + set repository_dir "[acs_root_dir]/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 exclude_package_list {} + + #---------------------------------------------------------------------- + # Prepare output + #---------------------------------------------------------------------- + + ReturnHeaders + ns_log Debug [ad_header "Building repository"] + ns_log Debug "Repository: Building Package Repository" + + #---------------------------------------------------------------------- + # Find available channels + #---------------------------------------------------------------------- + + # Prepare work dir + file mkdir $work_dir + + cd $work_dir + catch { exec $cvs_command -d $cvs_root -z3 co openacs-4/readme.txt } + + catch { exec $cvs_command -d $cvs_root -z3 log -h openacs-4/readme.txt } output + + set lines [split $output \n] + for { set i 0 } { $i < [llength $lines] } { incr i } { + if { [string equal [string trim [lindex $lines $i]] "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 + + 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] } { + + set major_version [lindex [split $oacs_version "-"] 0] + set minor_version [lindex [split $oacs_version "-"] 1] + + if { $major_version >= 5 } { + set channel "${major_version}-${minor_version}" + + ns_log Debug "Repository: Found channel $channel using tag $tag_name" + + set channel_tag($channel) $tag_name + } + } + } + + set channel_tag($head_channel) HEAD + + ns_log Debug "Repository: Channels are: [array get channel_tag]" + + + #---------------------------------------------------------------------- + # Read all package .info files, building manifest file + #---------------------------------------------------------------------- + + # Wipe and re-create the working directory + file delete -force $work_dir + file mkdir ${work_dir} + cd $work_dir + + foreach channel [lsort -decreasing [array names channel_tag]] { + ns_log Debug "Repository:

Channel $channel using tag $channel_tag($channel)