Skip to content

Commit

Permalink
fixes problem where drush_make fails with recursive make files
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Rundlett committed Jan 17, 2011
1 parent e31ef11 commit edbf211
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions drush_make.download.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
// $Id$

function drush_make_download_factory($name, $download, $download_location) {
// create a check for multiple downloads of the same type
static $seen;
$seen[$name][] = $download['type'];
if (count($seen[$name]) > 1 {
drush_log(dt('Attempt to download project %name more than once (%types) prevented',
array('%name' => $name, '%types' => join(", ", $seen[$name]))), 'warning');
return FALSE;
}

$function = 'drush_make_download_' . $download['type'];
if (function_exists($function)) {
return $function($name, $download, $download_location);
Expand Down
9 changes: 6 additions & 3 deletions drush_make.project.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@ class DrushMakeProject {
}

function findDownloadLocation() {
// setup a way to track where we've already been
static $seen;
$this->path = $this->generatePath();
$this->project_directory = !empty($this->directory_name) ? $this->directory_name : $this->name;
$this->download_location = $this->path . '/' . $this->project_directory;
// This directory shouldn't exist yet -- if it does, stop.
// This directory shouldn't exist yet -- unless a recursively called makefile
// re-defines or duplicates a dependency -- in which case we continue and log a warning.
if (is_dir($this->download_location)) {
drush_set_error(dt('Directory not empty: %directory', array('%directory' => $this->download_location)));
return FALSE;
drush_log(dt('Directory not empty: %directory', array('%directory' => $this->download_location)), "warning");
}
else {
drush_make_mkdir($this->download_location);
$seen[$this->download_location] = TRUE;
}
return $this->download_location;
}
Expand Down

0 comments on commit edbf211

Please sign in to comment.