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.27 -r1.28 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 25 Sep 2003 10:47:56 -0000 1.27 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 4 Oct 2003 03:04:04 -0000 1.28 @@ -504,14 +504,40 @@ } ad_proc -private apm_load_apm_file { - { - -callback apm_dummy_callback - } file_path + {-callback apm_dummy_callback} + {-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 + into the apm-workspace directory + } { + apm_callback_and_log $callback "
  • Downloading $url..." + if { [catch { + # Open a destination file. + set file_path [ns_tmpnam].apm + set fileChan [open $file_path w+ 0600] + # Open the channel to the server. + set httpChan [lindex [ns_httpopen GET $url] 0] + ns_log Debug "APM: Copying data from $url" + # Copy the data + fcopy $httpChan $fileChan + # Clean up. + ns_log Debug "APM: Done copying data." + close $httpChan + close $fileChan + } errmsg] } { + apm_callback_and_log $callback "Unable to download. Please check your URL.. + The following error was returned:
    [ad_quotehtml $errmsg]
    +	
    [ad_footer]" + return + } + if {![file exists $file_path]} { apm_callback_and_log $callback " The file cannot be found. Your URL or your file name is incorrect. Please verify that the file name @@ -597,10 +623,15 @@ apm_callback_and_log $callback "
  • Extracting files into the filesytem." apm_callback_and_log $callback "
  • $pretty_name $version_name ready for installation." + + # LARS: This looks odd -- package_key is not a directory # Remove the directory if it exists. - if {[file exists $package_key]} { - file delete -force $package_key - } + #if {[file exists $package_key]} { + # file delete -force $package_key + #} + exec sh -c "cd $install_path ; [apm_gunzip_cmd] -q -c $file_path | [apm_tar_cmd] xf -" 2>/dev/null + + return "${install_path}/${package_key}/${package_key}.info" } }