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.

2 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.

File

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

Code

function _make_parse_info_file($makefile) {
  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');
      }
    }
  }

  // Merge includes recursively.
  if (!empty($info['includes'])) {
    if (is_array($info['includes'])) {
      $include_path = dirname($makefile);
      $includes = array();
      foreach ($info['includes'] as $key => $include) {
        if (!empty($include)) {
          if (is_array($include) && $include['download']['type'] = 'git') {
            $tmp_dir = make_tmp();
            make_download_git($include['makefile'], $include['download']['type'], $include['download'], $tmp_dir);
            $include_makefile = $tmp_dir . '/' . $include['makefile'];
          }
          elseif (is_string($include)) {
            if (make_valid_url($include, TRUE)) {
              $include_makefile = $include;
            }
            elseif (file_exists($include_path . '/' . $include)) {
              $include_makefile = $include_path . '/' . $include;
            }
            elseif (file_exists($include)) {
              $include_makefile = $include;
            }
            else {
              return make_error('BUILD_ERROR', dt("Include file missing: !include", array('!include' => $include)));
            }
          }
          else {
            return make_error('BUILD_ERROR', dt("Cannot determine include file location: !include", array('!include' => $include)));
          }

          $info = array_replace_recursive(_make_parse_info_file($include_makefile), $info);
          // Move core back to the top of the list, where
          // make_generate_from_makefile() expects it.
          array_reverse($info['projects']);
        }
      }
    }
  }
  // Ensure $info['projects'] is an associative array, so that we can merge
  // includes properly.
  make_normalize_info($info);

  return $info;
}