.info.yml files now have another way to specify a project’s dependency on Drupal core, core_version_requirement, see #2313917: Core version key in module's .info.yml doesn't respect core semantic versioning

To support #3054433: Support multiple core branch functionality for contributed projects on drupal.org and related issues, a record of this in Drupal.org’s DB along with other core dependency information is needed.

Comments

drumm created an issue. See original summary.

trobey’s picture

There are two tables. One is for the component (module) and the other is for the dependency. Currently the core key is in the table for the dependency but not in the table for the component. Technically the release is tagged so the core key can be determined so this has not been needed. I am thinking with this change that in addition to the core_version_requirement we also should be saving the core key in the component table. Thoughts?

trobey’s picture

trobey’s picture

Status: Active » Needs review

Are there any releases to test this code? This stores both the core and core_version_requirement keys. The core key is currently obtained by other means but I am not sure that will work with this change and both keys are needed.

trobey’s picture

The diff for the patch file was reversed. This fixes it.

Mixologic’s picture

Status: Needs review » Needs work

Re #2, yes, I do believe that the right place to store these is on the component table. Releases will someday soon no longer have a core_api as part of the tag, as we're adding support for semver tags, so adding a field for the core key, if it is set, is a good idea. We might even consider backfilling the data, either by reprocessing everything, or by a one-off database update query.

Re: #4 I found a couple issues on drupal.org where a maintainer has started using this: https://www.drupal.org/project/adsense/issues/3079247

https://git.drupalcode.org/project/adsense/raw/8.x-1.x/adsense.info.yml

So It looks like we could use the 8.x-1.x-dev version of adsense to test with.

I only found a couple of minor things:

  1. +++ b/project_dependency.package.inc
    @@ -48,6 +48,7 @@ function project_dependency_info_package_list_store($release_nid, array $info) {
         $composer = (isset($component_info['composer'])) ? $component_info['composer'] : '';
         $package = (isset($component_info['package'])) ? $component_info['package'] : '';
    +    $core_version_requirement = (isset($component_info['core_version_requirement'])) ? $component_info['core_version_requirement'] : NULL;
    

    We should probably store empty strings to be consistent with the other table values.

  2. +++ b/project_dependency.package.inc
    @@ -57,6 +58,8 @@ function project_dependency_info_package_list_store($release_nid, array $info) {
    +      'core_api' => $component_info['core'],
    

    I believe that this could potentially also be empty, if not now, at least in the future.

trobey’s picture

Status: Needs work » Needs review
StatusFileSize
new3.06 KB

I also had to update the two new database columns to not allow NULLs and use the empty string as the default. The database update is pretty slow now with these changes. I tested this with the Adsense project latest release which is node ID 2456675:

core_version_requirement: ^8 || ^9
core_api: 8.x
Mixologic’s picture

Status: Needs review » Reviewed & tested by the community

Nice. This looks great.

With hindsight it would have been better if we used NULL's instead of empty strings, but it'll be easier to expect only one or the other when writing queries etc.

Thanks for showing up to manage this.

  • trobey authored 052d3ff on 7.x-2.x
    Issue #3084046 by trobey: Parse core_version_requirement out of info.yml...
  • 8a8eaa3 committed on 7.x-2.x
    Issue #3084046: Parse core_version_requirement out of info.yml files
    
  • trobey authored ea6b2b8 on 7.x-2.x
    Issue #3084046 by trobey: Parse core_version_requirement out of info.yml...
trobey’s picture

Status: Reviewed & tested by the community » Fixed
Mixologic’s picture

Thanks. We deployed this this morning.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.