From 888029c3b697b186db869d2d04ec8ec4978aae02 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ospite@studenti.unina.it>
Date: Mon, 28 Feb 2011 16:12:50 +0100
Subject: [PATCH] Issue 1016968 by ao2: Make drush generate-makefile work with drush 4.
X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM<pyWR#k60!#=#>/Vb;]yA5<GWI5`6u&+
 ;6b'@y|8w"wB;4/e!7wYYrcqdJFY,~%Gk_4]cq$Ei/7<j&N3ah(m`ku?pX.&+~:_/wC~dwn^)MizBG
 !pE^+iDQQ1yC6^,)YDKkxDd!T>\I~93>J<_`<4)A{':UrE

The array returned by drush_get_projects() has changed in drush 4, so
adapt its use in drush_make.generate.inc.

FIXME: drush_get_project() does not seem to export information on the
project 'type', for now this patch just hardcodes the type to
"module":that is not ideal, but better than nothing.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---
 drush_make.generate.inc |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drush_make.generate.inc b/drush_make.generate.inc
index 95f6225..320be44 100644
--- a/drush_make.generate.inc
+++ b/drush_make.generate.inc
@@ -45,25 +45,25 @@ function _drush_make_generate($file) {
   // Re-build theme and module data to be sure we have the most current information.
   $project_info = drush_get_projects();
   $used_projects = array();
-  foreach ($project_info as $item) {
-    $name = $item->info['project'];
-    $type = $item->type;
-    if ($item->info['project'] != 'drupal' && !in_array($item->info['project'], $used_projects)) {
-      if (($item->type == 'module') && (!$item->status)) {
+  foreach ($project_info as $project_name => $project) {
+    $name = $project_name;
+    $type = 'module';
+    if ($name != 'drupal' && !in_array($name, $used_projects)) {
+      if (($type == 'module') && (!$project['status'])) {
         continue;
       }
       $used_projects[] = $name;
-      $updatexml = _drush_generate_makefile_updatexml($name, $type, $item->info);
+      $updatexml = _drush_generate_makefile_updatexml($name, $type);
       $projects[$name] = array('_type' => $type);
       if ($updatexml) {
         $projects[$name]['type'] = $type;
         $projects[$name]['custom_download'] = TRUE;
       }
-      $projects[$name] += _drush_generate_makefile_check_location($item->name, $name, $type);
+      $projects[$name] += _drush_generate_makefile_check_location($name, $name, $type);
       // Add version number if this project's version is to be tracked
       // and if we have the information in its ->info to determine it
-      if (_drush_generate_track_version($name, $version_options) && $item->info["version"]) {
-        $projects[$name]['version'] = preg_replace("/^". DRUPAL_CORE_COMPATIBILITY . "-/", "", $item->info["version"]);
+      if (_drush_generate_track_version($name, $version_options) && $project["version"]) {
+        $projects[$name]['version'] = preg_replace("/^". DRUPAL_CORE_COMPATIBILITY . "-/", "", $project["version"]);
       }
     }
   }
-- 
1.7.4.1

