Problem/Motivation

Git deploy is not enabled when update.php checks requirements. If you are managing modules in your project as Git submodules, you cannot run update.php if a module contains a version dependency in its .info file such as

dependencies[] = libraries (2.x)

Steps to reproduce

  1. Clone the Drupal repository and add the git_deploy, libraries, and colorbox modules as Git submodules:
    git clone --branch 7.x http://git.drupal.org/project/drupal.git drupal
    cd drupal
    git submodule add --branch 7.x-2.x http://git.drupal.org/project/git_deploy.git sites/all/modules/git_deploy
    git submodule add --branch 7.x-2.x http://git.drupal.org/project/libraries.git sites/all/modules/libraries
    cd sites/all/modules/libraries/
    git checkout 7.x-2.0
    cd ../../../..
    git submodule add --branch 7.x-2.x http://git.drupal.org/project/colorbox.git sites/all/modules/colorbox
    cd sites/all/modules/colorbox/
    git checkout 7.x-2.2
    cd ../../../..
  2. Run the drupal installer to create the default environment.
  3. Enable the git_deploy module and save.
  4. Enable the libraries module and save.
  5. Try running update.php. No problems will be encountered and the script will finish successfully.
  6. Enable the colorbox module and save. (Note: git_deploy properly catches the version dependency on the libraries module and allows colorbox to be enabled.)
  7. Try running update.php. You will get the error "Unresolved dependency: Libraries (Version 2.x required). Colorbox requires this module and version. Currently using Libraries version."
    Error message screen shot.

Proposed resolution

Because boot modules are disabled in update.php, this has to be fixed in Drupal core. Please refer to #2062763: Fix update.php missing version info from Git Deploy.

Original report by adamfranco

It seems that git_deploy does not inject module version when update.php is doing its requirements check. This means that if you are managing modules in your project as git submodules, you cannot run update.php if a module contains a version dependency in its .info file such as

dependencies[] = libraries (2.x)

Steps to reproduce

  1. Clone the Drupal repository and add the git_deploy, libraries, and colorbox modules as git submodules:
    git clone --branch 7.x http://git.drupal.org/project/drupal.git drupal
    cd drupal
    git submodule add --branch 7.x-2.x http://git.drupal.org/project/git_deploy.git sites/all/modules/git_deploy
    git submodule add --branch 7.x-2.x http://git.drupal.org/project/libraries.git sites/all/modules/libraries
    cd sites/all/modules/libraries/
    git checkout 7.x-2.0
    cd ../../../..
    git submodule add --branch 7.x-2.x http://git.drupal.org/project/colorbox.git sites/all/modules/colorbox
    cd sites/all/modules/colorbox/
    git checkout 7.x-2.2
    cd ../../../..
  2. Run the drupal installer to create the default environment.
  3. Enable the git_deploy module and save.
  4. Enable the libraries module and save.
  5. Try running update.php. No problems will be encountered and the script will finish successfully.
  6. Enable the colorbox module and save. (Note: git_deploy properly catches the version dependency on the libraries module and allows colorbox to be enabled.)
  7. Try running update.php -- you will get an "Unresolved dependency" error: "Libraries (Version 2.x required) Colorbox requires this module and version. Currently using Libraries version "
    Error message screen shot.

The issue of versioned dependencies is discussed more broadly in #1013302: Versioned dependencies fail with dev versions and git clones with that issue recommending git_deploy as the solution. Unfortunately the inability to run update.php even when git_deploy is enabled is still an open problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adamfranco’s picture

Issue summary: View changes

Fixed missing list-item close tag.

DanZ’s picture

I am having a similar issue with Ubercart. That has a submodule called "Shipping". I'm trying to make a module that required Shipping 7.x-3.4, and I need to work with the -dev version. However, I can't run update.php.

I've put up #1945592: Version numbers not being used in update.php for this. Is it the same issue? (If so, I'll close it as a duplicate.)

Is this fixable? I'm not afraid to get my hands dirty, but I know nothing about the architecture here.

thijsvdanker’s picture

I'm having the same problems.

Workaround is to use drush updatedb. This will give you the warning, but will update anyway :)

das-peter’s picture

Status: Active » Needs review
FileSize
2.07 KB

I've just created this patch for my submodule architecture. Please give it a try to check if it works for you too.
The patch also contains a new variable to configure the path to the git binary...

codycraven’s picture

Status: Needs review » Needs work

In #3 function git_deploy_unisntall() is misspelled and won't execute.

das-peter’s picture

Status: Needs work » Needs review
FileSize
2.07 KB

@codycraven Thanks for spotting this, patch re-rolled.

Lukas von Blarer’s picture

The patch didn't apply, so I re-rolled it.

It works perfectly.

Wim Leers’s picture

Unless I'm mistaken, this is a patch for adding submodule support specifically, but it does not solve the more general problem of git_deploy's version handling not being taken into account by update.php at all?

stackpr’s picture

The attached patch is a core hack. I cannot identify any existing hook technique that allows us to make the necessary modification. The problem is that update.php sets the module_list to only include the system module. As soon as it does that, no custom module will be called for any hooks. The simple hack is to add the git_deploy module to the fixed_list sent to module_list.

A hook or .info configuration could be added in core to support this use case (for this module and for others), but I do not expect to see that given the low usage level reported for this module.

Sweetchuck’s picture

@witti To add the filename of the git_deploy module manually to the $module_list is a good idea. But not necessary to hack the core because the $module_list variable is defined in the global scope. So if you add the following line to the settings.php then the git_deploy module will be loaded.
Other good thing is if the status of git_deploy module is equal to 0 then it won't be loaded.

global $module_list;
$module_list['git_deploy']['filename'] = 'sites/all/modules/contrib/git_deploy/git_deploy.module';
chx’s picture

1. Split the issues, one for submodules (the patch looks good)

2. module_list is not global AFAIK ( ag -i 'global.*module_list' comes back empty) $module_list is used in the global scope of update.php , I see.

Sweetchuck’s picture

Maybe we found a bug which is related to this issue: #2062595: Only the system module is loaded in update.php

chx’s picture

Title: Dependency versions not available in update.php when using git submodules » Support git submodules
stackpr’s picture

Good catch on the global variable workaround. While testing it, it also appears that I might have needed to have the 'bootstrap' value set to 1 in the database for git_deploy. One extra workaround for anyone interested is to simply skip the initial verification by adding a query string to the update.php script: /update.php?op=info

Sweetchuck’s picture

@witti You have true, but only use the the ?op=info if you absolutely sure all dependencies are solved, and only the missing version information causes problem on the first page of the update.php.

If you have a multilingual system then enough to add the git_deploy path to to the $GLOBALS['module_list'], otherwise you have to include () the git_deploy.module in the settings.php.
But use this trick only during on small (minor) updates, and for your own risk.

Sweetchuck’s picture

Issue summary: View changes

Updated repository URL

Liam Morland’s picture

Title: Support git submodules » Version numbers not exposed to update.php
Issue summary: View changes
Darren Oh’s picture

As mentioned in #7, the first three patches do not address the issue at all, and the patch in #8 is not suitable for Drupal core.

Darren Oh’s picture

jmuzz’s picture

FileSize
40.1 KB

I have applied the patches in #1905736-6: Version numbers not exposed to update.php and #1905736-8: Version numbers not exposed to update.php as well as modified my settings.php as recommended, however update.php still does not recognize the version numbers of my git submodules. All of my errors are for >= and > module version number, not =. Not sure if this is related.

omaster’s picture

Sorry to be naive here but why doesn't git deploy just write the version number into the .info file like the package deploy would? Wouldn't this resolve everything?

Liam Morland’s picture

Recent versions of Drush make do exactly as you suggest.

Darren Oh’s picture

Status: Needs work » Closed (won't fix)
Related issues: +#2062763: Fix update.php missing version info from Git Deploy

Git Deploy does not change files. The idea is to base the version number on the commit so the files can be used unchanged from the repository. Enabling boot modules in update.php fixes the problem. A simple patch to do this is already available: #2062763: Fix update.php missing version info from Git Deploy. I don’t think there is a way to fix this in a module.

Darren Oh’s picture

Issue summary: View changes