Curl method of download always fails (particularly on mac)

lucidus_neil - November 4, 2009 - 03:10
Project:Drush Make
Version:6.x-2.0-beta1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

On my mac, I do not have wget installed so in drupal_make.download.inc, it defaults to using curl. However, it always fails with "Unable to download" because the file is downloaded to the current directory rather than the temp directory. The curl command is not called properly to download the file to the appropriate directory. Following is the code I used to fix this problem (which basically just modifies the curl arguments. I've attached a patch that should resolve the issue.

protected function downloadFile() {
    list($filename) = array_reverse(explode('/', $this->project->download['url']));
    $filename = $this->project->tmp_path . '/' . $filename;
    // Download the project.
    if (!drush_make_shell_exec('wget %s -O %s', $this->project->download['url'], $filename)) {
      drush_make_shell_exec('curl -o %s %s', $filename, $this->project->download['url']);
    }
    if (file_exists($filename) || drush_get_context('DRUSH_SIMULATE')) {
      drush_log($this->project->name . ' downloaded from ' . $this->project->download['url'] . '.', 'ok');
      return $filename;
    }
    drush_set_error('Unable to download ' . $filename . ' from ' . $this->project->download['url'] . '.');
    return FALSE;
  }

AttachmentSize
drush_make_curl.patch748 bytes

#1

tim.cosgrove - November 5, 2009 - 20:03

I had exactly this problem and this patch fixed it.

#2

sirkitree - November 5, 2009 - 20:07
Status:needs review» reviewed & tested by the community

Awesomeness!

I was having the same problem and this fixed it right up for me. Tested it out with instructions from http://www.mig5.net/content/five-second-feature-server-drushmake-my-inst...

Before patch i got a buncha errors trying to download.

After patch:
$ drush make builds/feature_server.build featureserver
Project information for drupal retrieved. [ok]
drupal downloaded from http://ftp.drupal.org/files/projects/drupal-6.14.tar.gz. [ok]
feature_server cloned from git://git.mig5.net/drupal/profiles/feature_server. [ok]
Project information for cck retrieved. [ok]
Project information for context retrieved. [ok]
Project information for features retrieved. [ok]
Project information for filefield retrieved. [ok]
Project information for install_profile_api retrieved. [ok]
Project information for views retrieved. [ok]
Project information for fserver retrieved. [ok]
Project information for singular retrieved. [ok]
Project information for tao retrieved. [ok]
cck downloaded from http://ftp.drupal.org/files/projects/cck-6.x-2.5.tar.gz. [ok]
context downloaded from http://ftp.drupal.org/files/projects/context-6.x-2.0-beta7.tar.gz. [ok]
features downloaded from http://ftp.drupal.org/files/projects/features-6.x-1.0-beta3.tar.gz. [ok]
filefield downloaded from http://ftp.drupal.org/files/projects/filefield-6.x-3.2.tar.gz. [ok]
install_profile_api downloaded from http://ftp.drupal.org/files/projects/install_profile_api-6.x-2.1.tar.gz. [ok]
views downloaded from http://ftp.drupal.org/files/projects/views-6.x-2.7.tar.gz. [ok]
fserver downloaded from http://code.developmentseed.org/sites/code.developmentseed.org/files/fse.... [ok]
singular downloaded from http://code.developmentseed.org/sites/code.developmentseed.org/files/fse.... [ok]
tao downloaded from http://code.developmentseed.org/sites/code.developmentseed.org/files/fse....

#3

dmitrig01 - November 6, 2009 - 21:06
Status:reviewed & tested by the community» fixed

Fixed, thanks!

#4

System Message - November 20, 2009 - 21:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.