5 * make-update command implementation.
9 * Command callback for make-update.
11 function drush_make_update($makefile = NULL) {
12 // Process makefile and get projects array.
13 $info = _make_parse_info_file($makefile);
15 make_prepare_projects(FALSE, $info);
16 $make_projects = drush_get_option('DRUSH_MAKE_PROJECTS', FALSE);
18 // Pick projects coming from drupal.org and adjust its structure
19 // to feed update_status engine.
20 // We provide here some heuristics to determine if a git clone comes
21 // from drupal.org and also guess its version.
22 // #TODO# move git checks to make_prepare_projects() and use it to leverage
23 // git_drupalorg engine.
25 foreach ($make_projects as $project_name => $project) {
26 if (($project['download']['type'] == 'git') && !empty($project['download']['url'])) {
27 // TODO check that tag or branch are valid version strings (with pm_parse_version()).
28 if (!empty($project['download']['tag'])) {
29 $version = $project['download']['tag'];
31 elseif (!empty($project['download']['branch'])) {
32 $version = $project['download']['branch'] . '-dev';
35 elseif (!empty($project['download']['refspec'])) {
40 // If no tag or branch, we can't match a d.o version.
43 $projects[$project_name] = $project + array(
45 'label' => $project_name,
46 'version' => $version,
49 elseif ($project['download']['type'] == 'pm') {
50 $projects[$project_name] = $project + array(
52 'label' => $project_name,
58 $update_status = drush_get_engine('update_status');
59 $update_info = $update_status->getStatus($projects, TRUE);
61 $security_only = drush_get_option('security-only', FALSE);
62 foreach ($update_info as $project_name => $project_update_info) {
63 if (!$security_only || ($security_only && $project_update_info['status'] == DRUSH_UPDATESTATUS_NOT_SECURE)) {
64 $make_projects[$project_name]['download']['full_version'] = $project_update_info['recommended'];
68 // Inject back make projects and generate the updated makefile.
69 drush_set_option('DRUSH_MAKE_PROJECTS', $make_projects);
70 make_generate_from_makefile(drush_get_option('result-file'), $makefile);