Current version of drush_make appears to depend on PHP's curl libraries, and if not found, it borks.
per our aegir install script which downloads drush_make and then executes a make of the frontend
==> Creating basic directory structure
==> Drush found in /var/aegir/drush/drush.php, good
==> Drush seems to be functionning properly
==> Drush make already seems to be installed
==> Provision already seems to be installed
==> Deploying hostmaster application
The external command could not be executed due to an application [error]
error.
Drush command could not be completed. [error]
Output from failed command : [error]
Fatal error: Call to undefined function curl_init() in
/var/aegir/.drush/drush_make/drush_make.utilities.inc on line 354
An error occurred at function : drush_provision_hostmaster_make [error]
of course an apt-get install php5-curl fixes this no problem on Debian. We could add this as a dependency but dww/Vertice have pointed out that it should try a number of options first before failing, so some extra conditionals may be required (haven't actually looked at the code for a while).
Comments
Comment #1
mfer commentedIn DrushMakeDownload_Get::downloadFile we are already setting up wget or curl as shell requirements to download files. The attached patch uses wget or curl in place of libcurl in php.
Comment #2
dmitrig01 commentedThis won't work for us ATM.
Comment #3
dmitrig01 commentedComment #4
mfer commentedThe current implementation will fail the test in #2 as well. If you inject curl_error to see the error in the current drush_make_get_remote_file() you would see the error on a local file to be
"<url> malformed".The current setup sets 3 ops we should set as well so I don't think this is ready to be committed. Conceptually, what's wrong with this?
Comment #5
dwwIf PHP supports curl, that's faster and safer than invoking curl or wget via the shell. We should really try all of the below, in order, and only give up if none of them worked:
if (function_exists('curl_init')))But seriously, we should test for #1 and #2 and use one of those before we fall back to fork/exec for #3 and #4.
Comment #6
adrian commentedamen, it should be as dww said.
also, dww.. keep in mind that the makefile parameter can also be a url
ie: drush make mydomain/profiles/drupalprofile.make
Comment #7
mfer commented/me raises hand to code this.
Comment #8
dwwThanks, mfer! ;)
/me goes back to dealing with #649254: version_extra can't just be string sorted -- ugh
Comment #9
mfer commentedUses the order listed in #5 and sets an error if none of them are available.
Comment #10
Anonymous (not verified) commentedIn my testing of the patch in #9, I expected to see the final error 'Unable to download remote file. No download services supported.' thrown but I didn't.
On my system there was no php5-curl, curl, or wget, and I saw this:
However, problematically, it plowed on and checked out the relevant install profile from CVS (ManagingNews) and recursively started executing its make file, of which each dependency failed in the same way. I expected it to immediately die after attempting to fetch core.
With curl or wget installed, the build would complete after one of those tools worked. With only php5-curl installed, somehow it still failed and instead moved on to trying wget or curl - so somehow ignored or didn't pass the check for function_exists('curl_init') (though I verified manually that the function did exist, so not sure why this is failing now where it was the *only* option that used to work)
Comment #11
dwwSounds like this "needs work" then. ;)
Comment #12
Anonymous (not verified) commentedSorry thought I marked it as such :)
Comment #13
dmitrig01 commentedI'd like to be able to specify local sources. However, I can't wget a local file.
Comment #14
anarcat commentedI must say that to its defense, the patch actually works for systems with wget and no php5-curl.
The problem that needs fixing is then twofold:
* make sure we cleanly abort when everything is missing
* fix php5-curl only environment (which should be fairly rare, to be honest, but still need to work if we want to benefit from it)
Thanks for the patch mfer!
Comment #15
anarcat commentedthinking more about this: the other thing is this may be a better situation than *without* the patch so I would suggest going ahead and committing the patch, because the two issues noticed by mig5 above are present in the current code too. It's just that there are still other occurences in the code that do not use the common download stub:
So in a sense, the patch is complete and fixes the problem (that we depend on curl libraries). The reverse problem exists though: we don't use them everywhere (but I consider that a separate issue).
The issue about the remote failures are another thing altogether: failure handling is non-existent in drush_make_get_remote_file(), with or without the patch, and we have a similar situation elsewhere in the code that uses wget and friends.
Finally, I wonder if that function is properly named. get_remote_file() is really get_remote_file_contents() and a new function get_remote_file() should be written to factor out the wget/curl calls used above.
Again, that should be treated separately and the patch should go in, marking RTBC.
Comment #16
grendzy commentedThere's a report of this not working with github, because it doesn't use the content-disposition header: #654798: Curl is stupid
Comment #17
grendzy commentedHm, we already have a pure-php http library: http://api.drupal.org/api/function/drupal_http_request/6
Maybe this should be incorporated into drush core? See also #581348: have drush make use the pm primitives
Comment #18
grendzy commentedack, didn't mean to reset status.
Comment #19
adrian commented@grendzy - the redirect issue is separate from this one.
i agree with anarcat that this patch fixes the existing issue.
committed