Index: openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl,v diff -u -r1.43 -r1.44 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 25 Jul 2018 17:44:25 -0000 1.43 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 25 Jul 2018 17:49:26 -0000 1.44 @@ -5,14 +5,14 @@ @author Bryan Quinn (bquinn@arsdigita.com) @creation-date Fri Oct 6 21:46:05 2000 @cvs-id $Id$ -} +} ad_proc -private apm_mkdir {path} { Creates the directory specified by path and returns it. -} { +} { if { [catch { file mkdir $path }] } { @@ -28,20 +28,20 @@ } ad_proc -public apm_workspace_dir {} { - + Return the path to the apm-workspace, creating the directory if necessary. - + } { set path [file join $::acs::rootdir apm-workspace] if { [file isdirectory $path] } { return $path } else { return [apm_mkdir $path] } -} +} ad_proc -public apm_workspace_install_dir {} { - + Return the path to the installation directory of the apm-workspace, creating the directory if necessary. } { @@ -89,16 +89,16 @@ @see apm_file_type_names @see apm_pretty_name_for_file_type - + @author Peter Marklund } { array set file_type_names [apm_file_type_names] return [array names file_type_names] } -ad_proc -public apm_package_info_file_path { +ad_proc -public apm_package_info_file_path { {-path ""} - package_key + package_key } { Returns the path to a .info file in a package directory, or throws an @@ -129,15 +129,15 @@ set apm_file [ad_tmpnam] db_blob_get_file distribution_tar_ball_select { - select content - from cr_revisions + select content + from cr_revisions where revision_id = (select content_item.get_latest_revision(item_id) - from apm_package_versions + from apm_package_versions where version_id = :version_id) } $apm_file file mkdir $dir - # avoid chdir + # avoid chdir #ns_log notice "exec sh -c 'cd $dir ; [apm_gzip_cmd] -d -q -c $apm_file | [apm_tar_cmd] xf - 2>/dev/null'" exec [apm_gzip_cmd] -d -q -c -S .apm $apm_file | [apm_tar_cmd] -xf - -C $dir 2> [apm_dev_null] @@ -146,15 +146,15 @@ ad_proc -private apm_generate_tarball { version_id } { - + Generates a tarball for a version, placing it in the content repository. DCW - 2001-05-03, change to use the content repository for tarball storage. - + } { set package_key [apm_package_key_from_version_id $version_id] set files [apm_get_package_files -all -package_key $package_key] set tmpfile [ad_tmpnam] - + db_1row package_key_select {} # Generate a command like: @@ -172,11 +172,11 @@ lappend cmd -C "$::acs::rootdir/packages" lappend cmd "$package_key/$file" } - + lappend cmd "|" [apm_gzip_cmd] -c ">" $tmpfile {*}$cmd - # At this point, the APM tarball is sitting in $tmpfile. Save it in + # At this point, the APM tarball is sitting in $tmpfile. Save it in # the database. set creation_ip [ad_conn peeraddr] @@ -189,7 +189,7 @@ db_1row item_exists_p {} if {!$item_id} { - # content item hasen't been created yet - create one. + # content item hasen't been created yet - create one. set item_id [content::item::new \ -name $name \ -title $title \ @@ -198,12 +198,12 @@ -creation_user $user_id \ -creation_ip $creation_ip \ -is_live true] - + db_dml set_item_id {} } set revision_id [content::item::get_live_revision -item_id $item_id] - + # No live revision for this item. Possible if somebody already # generated the archive, then deleted or modified the revision # manually or by other means. We create a new live revision. @@ -227,7 +227,7 @@ ad_proc -private apm_files_load { {-force_reload:boolean 0} - {-callback apm_dummy_callback} + {-callback apm_dummy_callback} files } { @@ -260,7 +260,7 @@ apm_callback_and_log $callback "Loaded packages/$package_key/$path." unset apm_current_package_key } else { - apm_callback_and_log $callback "Unable to load packages/$package_key/$path - file is marked as contained in a package but is not present in the filesystem" + apm_callback_and_log $callback "Unable to load packages/$package_key/$path - file is marked as contained in a package but is not present in the filesystem" } } } @@ -302,7 +302,7 @@ ad_proc -public apm_file_watchable_p { path } { Given the path of a file determine if it is appropriate to be watched for reload. The file should - be db compatible with the system and be of right + be db compatible with the system and be of right type (for example contain Tcl procs or xql queries). @param The path of the file relative to server root @@ -315,7 +315,7 @@ @see apm_guess_db_type @author Peter Marklund -} { +} { # The apm_guess procs need package_key and a path relative to package root # so parse those out of the given path if { [regexp {^packages/([^/]+)/(.*)$} $path match package_key package_rel_path] } { @@ -351,7 +351,7 @@ @see apm_get_watchable_files @author Peter Marklund -} { +} { foreach rel_path [apm_get_watchable_files $package_key] { apm_file_watch $rel_path } @@ -391,7 +391,7 @@ } return $watchable_files -} +} ad_proc -private apm_system_paths {} { @@ -410,7 +410,7 @@ ad_proc -public apm_gzip_cmd {} { @return A valid command name for gzip. - + } { return gzip } @@ -419,7 +419,7 @@ ad_proc -private apm_tar_cmd {} { @return A valid command name for tar. - + } { return tar } @@ -428,7 +428,7 @@ ad_proc -private apm_dev_null {} { @return null device - + } { if {$::tcl_platform(platform) ne "windows"} { return /dev/null @@ -446,20 +446,20 @@ # reliably under windows, for unknown reasons the downloaded file is # truncated. # - # Therefore, we check first for the NaviServer built in ns_http, then + # Therefore, we check first for the NaviServer built in ns_http, then # if the optional xotcl-core components are available... # - + # 5 minutes set timeout 300 - + set httpImpls [util::http::available -url $url -spool] if {$httpImpls ne ""} { ns_log notice "we can use the http::util:: interface using the $httpImpls implementation" set result [util::http::get -url $url -timeout $timeout -spool] file rename [dict get $result file] $output_file_name } elseif {[info commands ::ns_http] ne "" && [apm_version_names_compare [ns_info patchlevel] "4.99.5"] == 1} { - # + # # ... use ns_http when we have a version with the "-file" flag ... # foreach i {1 2 3} { @@ -475,7 +475,7 @@ set url $location } } elseif {[info commands ::xo::HttpRequest] ne ""} { - # + # # ... use xo::HttpRequest... # ns_log notice "Transfer $url to $output_file_name based on ::xo::HttpRequest" @@ -520,15 +520,15 @@ {-url {}} {file_path {}} } { - + Uncompresses and loads an APM file into the filesystem. @param url If specified, will download the APM file first. - @return If successful, a path to the .info file of the package uncompressed + @return If successful, a path to the .info file of the package uncompressed into the apm-workspace directory -} { +} { # First download the apm file if a URL is provided if { $url ne "" } { set file_path [ad_tmpnam].apm @@ -538,7 +538,7 @@ The following error was returned:
[ns_quotehtml $errmsg]
             
" return - } + } if {![file exists $file_path]} { apm_callback_and_log $callback " @@ -561,7 +561,7 @@ ns_log Error "Error loading APM file form url $url: $errmsg\n$::errorInfo" return } - + if { [llength $files] == 0 } { apm_callback_and_log $callback "The archive does not contain any files.\n" ns_log Error "Error loading APM file form url $url: The archive does not contain any files." @@ -575,13 +575,13 @@ set components [split $file "/"] if {[lindex $components 0] ne $package_key } { - apm_callback_and_log $callback "All files in the archive must be contained in the same directory - (corresponding to the package's key). This is not the case, so the archive is not + apm_callback_and_log $callback "All files in the archive must be contained in the same directory + (corresponding to the package's key). This is not the case, so the archive is not a valid APM file.\n" ns_log Error "Error loading APM file form url $url: Invalid APM file. All files in the archive must be contained in the same directory corresponding to the package's key." return } - + if { [llength $components] == 2 && [file extension $file] eq ".info" } { if { [info exists info_file] } { apm_callback_and_log $callback "The archive contains more than one package/*/*.info file, so it is not a valid APM file.\n" @@ -593,7 +593,7 @@ } } if { ![info exists info_file] || [regexp {[^a-zA-Z0-9\-\./_]} $info_file] } { - apm_callback_and_log $callback "The archive does not contain a */*.info file, so it is not + apm_callback_and_log $callback "The archive does not contain a */*.info file, so it is not a valid APM file.\n" ns_log Error "Error loading APM file form url $url: Invalid APM file. No package .info file." return @@ -605,13 +605,13 @@ exec [apm_gzip_cmd] -d -q -c -S .apm $file_path | [apm_tar_cmd] -xf - -C $tmpdir $info_file 2> [apm_dev_null] #exec sh -c "cd $tmpdir ; [apm_gzip_cmd] -d -q -c -S .apm $file_path | [apm_tar_cmd] xf - $info_file" 2> [apm_dev_null] - + if { [catch { array set package [apm_read_package_info_file [file join $tmpdir $info_file]] } errmsg]} { file delete -force -- $tmpdir - apm_callback_and_log $callback "The archive contains an unparseable package specification file: - $info_file. The following error was produced while trying to + apm_callback_and_log $callback "The archive contains an unparseable package specification file: + $info_file. The following error was produced while trying to parse it:
[ns_quotehtml $errmsg]
.

The package cannot be installed. @@ -625,16 +625,16 @@ set version_name $package(name) ns_log Debug "APM: Preparing to load $pretty_name $version_name" # Determine if this package version is already installed. - if {[apm_package_version_installed_p $package_key $version_name]} { + if {[apm_package_version_installed_p $package_key $version_name]} { apm_callback_and_log $callback "

  • $pretty_name $version_name is already installed in your system." ns_log Error "Error loading APM file form url $url: Package $pretty_name $version_name is already installed" } else { - + set install_path [apm_workspace_install_dir] if { ![file isdirectory $install_path] } { file mkdir $install_path } - + apm_callback_and_log $callback "
  • Extracting files into the filesystem." apm_callback_and_log $callback "
  • $pretty_name $version_name ready for installation."