function _make_parse_info_file

8.0.x make.utilities.inc _make_parse_info_file($makefile)
7.x make.utilities.inc _make_parse_info_file($makefile)
master make.utilities.inc _make_parse_info_file($makefile, $element = 'includes')

Parse makefile recursively.

3 calls to _make_parse_info_file()
drush_make_update in commands/make/update.make.inc
Command callback for make-update.
make_parse_info_file in commands/make/make.utilities.inc
Helper function to parse a makefile and prune projects.
_make_merge_includes_recursively in commands/make/make.utilities.inc
Helper function to merge includes recursively.

File

commands/make/make.utilities.inc, line 34
General utility functions for Drush Make.

Code

function _make_parse_info_file($makefile, $element = 'includes') {
  if (!($data = make_get_data($makefile))) {
    return drush_set_error('MAKE_INVALID_MAKE_FILE', dt('Invalid or empty make file: !makefile', array('!makefile' => $makefile)));
  }

  // $info['format'] will specify the determined format.
  $info = _make_determine_format($data);

  // Set any allowed options.
  if (!empty($info['options'])) {
    foreach ($info['options'] as $key => $value) {
      if (_make_is_override_allowed($key)) {
        // n.b. 'custom' context has lower priority than 'cli', so
        // options entered on the command line will "mask" makefile options.
        drush_set_option($key, $value, 'custom');
      }
    }
  }

  // Include any makefiles specified on the command line.
  if ($include_makefiles = drush_get_option_list('includes', FALSE)) {
    drush_unset_option('includes'); // Avoid infinite loop.
    $info['includes'] = is_array($info['includes']) ? $info['includes'] : array();
    foreach ($include_makefiles as $include_make) {
      if (!array_search($include_make, $info['includes'])) {
        $info['includes'][] = $include_make;
      }
    }
  }

  // Override elements with values from makefiles specified on the command line.
  if ($overrides = drush_get_option_list('overrides', FALSE)) {
    drush_unset_option('overrides'); // Avoid infinite loop.
    $info['overrides'] = is_array($info['overrides']) ? $info['overrides'] : array();
    foreach ($overrides as $override) {
      if (!array_search($override, $info['overrides'])) {
        $info['overrides'][] = $override;
      }
    }
  }

  $info = _make_merge_includes_recursively($info, $makefile);
  $info = _make_merge_includes_recursively($info, $makefile, 'overrides');

  return $info;
}