When reviewing the logs for #2400705-22: Outdated version of dependencies are installed on the test-infrastructure, I noticed that distributions and core never have dependencies that can be calculated.

I think dependencies should only be attempted for releases with a project node type in 'project_module', 'project_theme', 'project_theme_engine'.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drumm created an issue. See original summary.

trobey’s picture

project_core is needed. For instance, Views has been moved into core and if a dependency is specified without the project namespace then releases of Drupal core will not be found and an old release of Views will be found instead.

Theme and profiles (distributions) are excluded. But the existing code is a bit shaky:

  $function_pattern = '[a-zA-Z][a-zA-Z0-9_]*';
  $profile_info_files = file_scan_directory(PROJECT_DEPENDENCY_SOURCECODE_DIRECTORY . '/' . $directory, '/^' . $function_pattern . '\.(theme|profile)$/');
  // Date module has a date.theme file.
  $exceptions = variable_get('project_dependency_filename_type_exceptions',
    array('date.theme'));
  foreach ($profile_info_files as $filepath => $file) {
    if (in_array($file->filename, $exceptions)) {
      unset($profile_info_files[$filepath]);
    }
  }
  // If any profile or theme files are found, skip this release entirely.
  if (!empty($profile_info_files)) {
    return FALSE;
  }

It scans for files with a theme or profile extension. But there are projects such as the Date project that have a date.theme file. It might be cleaner to check the project type as you suggest. In that case it would only process projects with project_core or project_module. I would need to check older projects to see if this works for older versions of Drupal. Should I pursue this change?

drumm’s picture

What I'm seeing is the “Dependency update failed.” message on core release pages, which happens when a project has no components stored, correct? Should core have components stored in the DB, or some other way of noting that dependencies have been looked at and don't need to be tried again?

trobey’s picture

Core should have it's components stored in the database. If you look at Drupal 7.41 the components are listed. It looks like Drupal 8 releases ae all missing the components. I am not sure whether this is a problem in Project Dependency or that Project Dependency is not getting called.

trobey’s picture

Here is the relevant code from Project Dependency

        // We don't need to study the dependencies of the drupal project.
        $project_wrapper = entity_metadata_wrapper('node', $project);
        $machine_name = $project_wrapper->field_project_machine_name->value();
        if ($machine_name != 'drupal') {
drumm’s picture

Looks like that code is decently deep in the process. I can confirm there isn't a problem with the Git clone of core, when running drush pdpp via Jenkins. Seem like there is a bug with the 8.x core component discovery.

I can't see a downside to replacing the code from #2. The project's node type will work the same for any version of Drupal.

drumm’s picture

And replacing the logic in #2 could unstick core too. Core has added some files that have not made it into project_dependency_filename_type_exceptions

[drumm@jenkins1 ~]$ sudo -u bender -H drush6 -r /var/www/drupal.org/htdocs vget project_dependency_filename_type_exceptions
project_dependency_filename_type_exceptions: array (
  0 => 'date.theme',
  1 => 'uc_credit.theme',
  2 => 'bartik.theme',
  3 => 'seven.theme',
  4 => 'chameleon.theme',
  5 => 'test_theme_phptemplate.theme',
  6 => 'test_theme.theme',
  7 => 'standard.profile',
  8 => 'minimal.profile',
  9 => 'testing.profile',
  10 => 'default.profile',
)

drumm@Neils-MacBook-Pro:~/drupal/git/drupal$ find * -name '*.theme' | sed -e 's/.*\///'
access_test.theme
test_basetheme.theme
test_subsubtheme.theme
test_subtheme.theme
test_theme.theme
test_theme_nyan_cat_engine.theme
bartik.theme
seven.theme
trobey’s picture

Yes, that is what my investigation is showing. I just need to do some testing to make sure I am not breaking anything. I have never liked this code because it is failure prone. So if I can replace it with something that is simpler and works all the time that would be a big step forward.

trobey’s picture

I am checking the Drupal 8.0.1 release. It looks like it is now working but there is something interesting that shows up. There is the Link project with a link module that is getting picked up. This is because Project Dependency gives preference to projects of the same name as the module. I do not think this actually hurts anything (processing of dependencies with Drupal core is suppressed) but I think a patch to Drupal core to add the project namespace (drupal:link) will clear this up and probably should be done throughout core to avoid similar problems in the future.

trobey’s picture

I am attaching a patch for review. I have checked it against Drupal core 6, 7, and 8 and similarly for a contributed project. Drupal core has a bunch of modules that are only used for testing so I tried to strip them out. I also remove any contributed modules that are under a "tests" or Tests" directory. I think this is safe and gets rid of most of the cruft.

drumm’s picture

Looks good to me from reading the code.

  • trobey committed da7c48b on 7.x-1.x
    Issue #2651854 by trobey, drumm: Check project types instead of files.
    
trobey’s picture

Change committed and included in release 7.x-1.0-beta10.

trobey’s picture

Category: Task » Bug report
Status: Active » Closed (fixed)