The attached patch cleans up the code and messages when you choose to download a missing dependency.
For example - on a clean drupal site if you issue the following drush commands on a clean d7 site:
$ drush dl views_bulk_operations
$ drush en views_bulk_operations
Without the patch the following questions to resolve the dependency would happen:
Would you like to download the following projects to resolve unmet dependencies: views for views (y/n):
Would you like to download the following projects to resolve unmet dependencies: ctools for ctools (y/n):
With the patch:
Would you like to download the following projects to resolve unmet dependencies: views for views_bulk_operations (y/n):
Would you like to download the following projects to resolve unmet dependencies: ctools for views_bulk_operations (y/n):
it also resets the static system_rebuild_module_data to ensure you are always working with up-to-date information about which modules are available.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | drush-HEAD-dependancy-dl.patch | 3.46 KB | alexpott |
| drush-dl-dependencies.patch | 2.45 KB | alexpott |
Comments
Comment #1
kotnik commentedSeems reasonable.
Comment #2
greg.1.anderson commentedThat is a good improvement to the confirmation message -- although it would be even better, I think, if it could say "ctools for views". However, you made a change that will not work out in the long run. You cannot change the key of this line:
$resolved_projects[$project][] = $unmet;The key must be $project so that pm-download is called but once per project needed to fulfill an unmet dependency. You changed the key as follows:
$resolved_projects[$unmet][] = $module;This isn't good, because you threw away $project. In the current implementation, $project always == $unmet, but in the future it might not. For example:
Project views contains 3 modules: views_export, views_ui, views.
If the unmet dependency is views_export, then $project will be views, and $unmet will be views_export. Maybe it would work if you just put $project back as the key of $resolved_projects.
Comment #3
alexpottHere's a better patch that addresses greg.1.anderson's concerns and (imo) improves the messages.
Another important part of the patch is refreshing the $extenstion_info array after the new modules are downloaded. This prevents the final test (enabling views_bulk_operations on a D7 sites) from asking the user to download views twice.
For the first test I've got a d6 site with spaces and panels_everywhere in sites/all/modules
Current drush-HEAD the cmd $ drush en spaces_og panels_everywhere would output:
With the attached patch the cmd $ drush en spaces_og panels_everywhere would output:
The example I gave for $ drush en views_bulk_operations on a D7 site in the initial issue now looks like this:
Comment #4
greg.1.anderson commentedCode looks good, output looks good; will test.
Comment #5
jonhattanreviewed and commited. thanks.
Comment #6
jonhattanNot sure if it should be backported. It improves usability of site-upgrade
Comment #7
greg.1.anderson commentedYes, I think it would be great if this went into drush-4.
Comment #8
msonnabaum commentedBackported.