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
- Clone the Drupal repository and add the
git_deploy
,libraries
, andcolorbox
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 ../../../..
- Run the drupal installer to create the default environment.
- Enable the
git_deploy
module and save. - Enable the
libraries
module and save. - Try running
update.php
. No problems will be encountered and the script will finish successfully. - Enable the colorbox module and save. (Note:
git_deploy
properly catches the version dependency on thelibraries
module and allowscolorbox
to be enabled.) - 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."
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
- 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 ../../../..
- Run the drupal installer to create the default environment.
- Enable the git_deploy module and save.
- Enable the libraries module and save.
- Try running update.php. No problems will be encountered and the script will finish successfully.
- Enable the colorbox module and save. (Note: git_deploy properly catches the version dependency on the libraries module and allows colorbox to be enabled.)
- 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 "
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | git_deploy-update_php-dependency-missing-1905736-8.patch | 465 bytes | stackpr |
#6 | git_deploy-support-submodule-architecture-1905736-6.patch | 1.98 KB | Lukas von Blarer |
Comments
Comment #0.0
adamfranco CreditAttribution: adamfranco commentedFixed missing list-item close tag.
Comment #1
DanZ CreditAttribution: DanZ commentedI 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.
Comment #2
thijsvdanker CreditAttribution: thijsvdanker commentedI'm having the same problems.
Workaround is to use drush updatedb. This will give you the warning, but will update anyway :)
Comment #3
das-peter CreditAttribution: das-peter commentedI'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...
Comment #4
codycraven CreditAttribution: codycraven commentedIn #3 function git_deploy_unisntall() is misspelled and won't execute.
Comment #5
das-peter CreditAttribution: das-peter commented@codycraven Thanks for spotting this, patch re-rolled.
Comment #6
Lukas von BlarerThe patch didn't apply, so I re-rolled it.
It works perfectly.
Comment #7
Wim LeersUnless 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?
Comment #8
stackpr CreditAttribution: stackpr commentedThe 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.
Comment #9
Sweetchuck@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 thesettings.php
then thegit_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.Comment #10
chx CreditAttribution: chx commented1. 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.Comment #11
SweetchuckMaybe we found a bug which is related to this issue: #2062595: Only the system module is loaded in update.php
Comment #12
chx CreditAttribution: chx commentedMaybe not but the documentation is necessary nonetheless #2062763: Fix update.php missing version info from Git Deploy . Split the update issue into #2062765: Document settings.php trick to get git_deploy work during minor updates
Comment #13
stackpr CreditAttribution: stackpr commentedGood 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
Comment #14
Sweetchuck@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.
Comment #14.0
SweetchuckUpdated repository URL
Comment #15
Liam MorlandMarking #1945592: Version numbers not being used in update.php as duplicate of this.
Comment #16
Darren OhAs 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.
Comment #17
Darren OhComment #18
jmuzz CreditAttribution: jmuzz commentedI 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.
Comment #19
omaster CreditAttribution: omaster commentedSorry 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?
Comment #20
Liam MorlandRecent versions of Drush make do exactly as you suggest.
Comment #21
Darren OhGit 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.
Comment #22
Darren Oh