Problem/Motivation
Drupal has an automated testing system which is a major feature in ensuring code quality. However, due to a design flaw automated testing does not and cannot work for all projects. The root of the problem is that we often talk about modules when we mean projects. The two are not the same. In particular, module names are not unique while project names are unique (drupal.org/project/
).
The info file specifies the module name for dependencies. Since the module name is not unique it is impossible to guess the correct project in all cases. The fact is the project maintainers know the correct project for their dependencies but there is no place to specify it so we have to resort to guessing.
Open source projects are built around the idea of being able to fork a project when needed. Due to this design flaw, forking a project can break automated testing. An example is https://www.drupal.org/project/webform and https://www.drupal.org/project/webform_patched. Or various modules are moved into core (simpletest, etc.) or removed from core and spun off in a contributed project (php).
This design flaw also limits the capabilities of Drush.
Proposed resolution
Make it possible (but not required) to specify which project we are talking about. For example,
dependencies
- webform_patched:webform (>= 7.x-3.20)
This change is backward compatible and has no effect on module installation or dependency calculation in Drupal core. It simply adds a project key to the dependency structure.
Remaining tasks
There is code for Project Dependency waiting for this patch to be committed so that the problems with the testbots can be fixed. There are critical issues filed on Project Dependency that are held up due to this design flaw.
Drush will be able to extend the capability for automatically downloading projects.
This change has no affect on Drupal core but it does provide the project name which may be used for future changes.
Projects will be able to update their dependencies. Although this is optional, updating the dependencies will prevent problems with automated testing so it is highly recommended. Note that these problems can suddenly occur in a project even if the project has not changed (e.g. a new project with the same module name appears).
User interface changes
None.
API changes
It becomes possible to depend modules in specific projects.
Original report by @trobey
The current format for the module.info.yml file looks like it has the format
dependencies:
- <module>
Most people would read module as project since there is a tendency to conflate the two. But they are very different. Project names are unique while module names are not. There is an inherent ambiguity in the current way the dependencies are specified. As the number of projects increases there will be increased collisions between module names. This causes problems for Project Dependency because the only recourse is to guess between the projects which will inevitably be wrong in some cases. It also results in a very convoluted process of starting with a module name, searching for releases with that module name and then finally arriving at the project (hopefully the right project) when searching for dependencies.
In addition this dependency format can lead to the problem of a project being created that crashes the testbots. This is not a nice prospect.
At some point this needs to be addressed. The suggested change is to namespace the module name with the project name similar to
dependencies
- <module> (<project>:<version>)
where the project is optional (as is the version restriction). This would allow a unique way to specify module dependencies instead of the current ambiguity. This would require drupal_parse_dependency() to return the project in the structure that is returned (when it is supplied). Since the project name is optional this would maintain backward compatibility and impacts should be limited.
The original issue is #2194683: webform_patched being downloaded instead of webform for course module. I will create a hack to deal with the original issue but we will continue to get additional issues until this ambiguity is fixed.
Beta phase evaluation
| Issue category | Task per Dries (https://www.drupal.org/node/2205271#comment-9013109) |
|---|---|
| Issue priority | Major (although the original issue in the Project Dependency issue queue is critical). |
| Prioritized changes | This is a priority because it is needed to fix a problem with the testbots failing. It also is tagged for backport to Drupal 7. There also is a security impact because a malicious person can cause the testbots to fail. |
| Disruption | The change is backward compatible so there is negligible impact. |
| Comment | File | Size | Author |
|---|---|---|---|
| #159 | project_namespace_for_dependencies-2205271-159.patch | 4.13 KB | trobey |
| #146 | project_namespace_for_dependencies-2205271-146.patch | 5.88 KB | trobey |
Comments
Comment #1
hass commentedAs discussed in #2047557: Support Drupal 8-style *.info.yml files we have the problem today that modules cannot define a dependency on https://www.drupal.org/project/php. Every test run fails completly and makes automated testing impossible. GA depends on php filter module and always fail, see https://qa.drupal.org/pifr/test/480418.
Comment #2
hass commentedAfter more reading the webform case I do not understand how this proposed change could be backwards compatible. There are many modules out that use a version string in dependencies. e.g.
test_dependencies[] = autoload (>7.x-1.5)
dependencies[] = autoload (>7.x-1.5)
Prefixing the version with a project name should fail the same way like prefixing the module name with a project. Untested, but I think this cannot work without changes. Unbelivable... This cannot wait for D9 and needs to be backported to D7, too.
Comment #3
hass commentedAs it may require changing every .info.yml file.
Comment #4
hass commentedWrong tag.
Comment #5
hass commentedAside... We could fix this in a lot cleaner way by adding a new key to info files that only project dependency uses. Like we already done with test_dependency. What do you think about this?
Example:
test_project_dependencies[] = php
This could force project dependency to download these listed projects as preferred projects. If the test_dependencies modules are found in these projects the project dependencies module stops trying to download the dependend modules from random projects. This should be maintainable in project dependency module, too.
@trobey: Does this work for you?
Comment #6
trobey commentedI think there are many ways to specify the necessary information. I would note that the problem is not limited to Project Dependency. The modules page also uses the dependencies although usually only the installed modules are considered instead of all possible modules.
Comment #7
trobey commentedThe attached patch adds a project key to parseDependency($dependency) in Drupal core. This will return the project name in the project key and the module name in the module key. The name key is retained for backward compatibility. To add the project name to the dependency specified in the info.yml file:
The current style
should still work but no project key will be returned from parseDependency(). So this should be backwards compatible but should add additional information about the dependency that should solve problems with ambiguity about which project contains the specified module.
Comment #8
hass commentedThat is a good start. There may be some more changes required. I cannot remember for sure, but I thought update module will download dependend modules automatically... Isn't it? I could be wrong as I'm using drush for such a long time...
Comment #10
trobey commentedUpdated patch. The failed tests do not seem to run when I run local tests so cross my fingers and hope I got it.
Comment #11
tim.plunkettYou shouldn't have to change all of these expectations. The code should assume that the module is the same. You should just add a couple test cases where the module is different, I guess?
Comment #12
trobey commentedI have to make a choice here. It is not the only choice but no one else is stepping up with any suggestions. If I am returning the optional project name with a key of 'project' then does the key 'name' make sense? Is this the project name or the module name? Just 'name' is ambiguous but we need to retain it for backward compatibility. So perhaps it makes sense to add a 'module' key that is clearer? But if I add the 'module' key then the tests break because it is not included in the canned result array. So I can fix that array or I can remove the 'module' key. I do not care which way it is done.
It would probably be a good idea to add a test for the project but I am first trying to get the patch to pass.
Comment #13
hass commentedDo we really need backward compatibility in D8? I do not think so. I would use module and project as keys and may backport a workaround.
Comment #14
trobey commentedIt is okay with me. Anyone else? I will re-roll the patch and now that it is passing I will add a test for the project name.
Comment #15
trobey commentedHere is the updated patch with an added test.
Comment #17
trobey commentedUpdate patch.
Comment #18
hass commentedI'm confused about
views:views_ui. Views UI is in projectdrupal:views_uias I know. We should try adding php module and see how project dependency behaves :-)Comment #19
trobey commentedI forgot that Views had been moved into core. Not that it really matters but here is an updated patch.
Comment #20
hass commentedCode looks good, has green tests and I have no idea what else could I test manually than what the tests have tested. Let's get this in before beta.
Comment #21
chx commented+ * A dependency string, for example 'project:module (>=8.x-4.5-beta5, 3.x)'.
*blinks slowly*
Thanks for working on this but this comment needs a lot of better examples of what "project" and "module" can be. Not to mention that just "module ()" still works and that's not visible from the comment.
Comment #22
trobey commented@chx: After this patch is committed just "module()" will still work. But I do not want to put this in the code comment because I do not want anyone to specify dependencies that way. The reason I do not want to is it will work *until* someone submits a new project with a module name identical to yours and suddenly your module no longer passes tests. And I will again be fielding angry complaints about "why did my module suddenly stop working when I have not touched anything." And I will point out to them that they did not specify the project in their dependency. And they will respond that the code comment said they could specify just the module name. And I will drum my fingers and sigh. Another four or five hours wasted.
When I started working on this issue I could not find any documentation for Drupal 8 about how dependencies are specified. I was confused and I am very familiar with this code in the earlier versions of Drupal. Searching now all I can find is https://www.drupal.org/node/2000204. The reason I have not included any documentation changes in this patch (or along with it) is because I cannot change something that does not exist. If someone can point me to the proper place I can try to write up something about specifying dependencies and add in documentation about this change.
Comment #23
hass commentedThat sounds like we should write a change notice that every module should specify dependency only in the new format and the old module-only format is deprecaded? I'm fine with this change if it is a permanent fix. This makes this patch again RTBC, isn't it?
Comment #24
tim.plunkettSo why did both #17 and #19 both pass? #17 was wrong, it should have failed.
Comment #25
hass commentedNo, they pass as we only define the dependency. The test validates that splitting the dependency string works properly. In project dependency module we can test if downloading the dependency works. We could also add a test module to core that downloads php filter module and this will for sure fail on today test robot. But before we implement this, we need a core patch that has been accepted.
I'm not sure if we want a test in core that depends on a contrib project... Next core version produces a test failure if there is no contrib dev available.
Comment #26
trobey commentedThere are several options in order of increasing impact.
1) Rely on Drupal best practices to encourage people to supply the project name for dependencies.
2) Deprecate using only the module name for Drupal 8 and make the project name required for Drupal 9.
3) Require the project name for dependencies for Drupal 8.
The first two options eliminate the problem with collisions with module names. The last option would allow me to remove a lot of the code in Project Dependency that currently is used to figure out the project from the module name and also have performance impacts for the testbots. But even though option 3 makes my life a lot easier I am okay with any of these as they are all roads to the same place eventually and they all solve the problem with the testbots.
Which option should we choose? Option 3 might require a change to the patch to throw an error if the project name is missing. The other two options do not require a change to the patch and the issue could be changed to RTBC.
I guess you are saying we would need a change notice for the last two options. I guess that would be written once the patch is committed. I could do that.
Comment #27
hass commentedAside... I think we should very hard discourage people from creating colliding namespaces. We could also discuss unpublishing modules doing this. I fear that people start doing this if we force the project name...
Comment #28
chx commentedIf this about requiring Drupal developers to put in drupal: for every version dependency then count me as squarely opposed to this issue. Such a change would require wide buy in from the community and I don't see that here.
Comment #29
trobey commented@tim.plunkett: Is 1 == +1? For all practical situations they are the same. But #7 failed because the test is simplistic and is checking for identical output rather than equivalence. This is why I had to update the tests.
Comment #30
hass commented@chx: version is not required. It may be arguable if we require the "project:", but I would not require this. The problem today is simply that I cannot require php module as dependency. See https://qa.drupal.org/pifr/test/480418 how it fails. We need an optional project name in dependency string to solve the test bot inability. We also have the same troubles in drush that cannot resolve the project name and may download a wrong project, too. This are really heavy problems that may cause a lot of troubles for maintainers.
Comment #31
chx commentedThen write an issue summary that makes the use case understandable because by now I absolutely have no idea what this issue is about. Concrete examples would be welcome. For eg. is project Views? Or what? etc.
Comment #32
hass commentede.g: this fails, because there are core alpha versions that have the php module integrated. The reason is the project dependency module tries to find a good match and finds
drupal:php(project: drupal, module: php)This will not fail (project: php, module: php)
Both projects
drupalhad andphpproject have the modulephp. Than my test downloads the required modules and tries to enable "php" module, but fails as core (DEV) does not have php embedded any longer. Root cause - project dependency think it still has (as there is a php module in an alpha release). The info.yml setting will force the testbot and drush to download php module from php project and not drupal.Does this makes things clearer?
Comment #33
trobey commented@chx: There are many examples. Someone forked the webform project into the webform_patched project with both having a module named webform #2194683: webform_patched being downloaded instead of webform for course module. Project Dependency at that time used a heuristic of using the most recent release so the webform_patched project was chosen and the tests failed. This also showed that anyone could create a new project with a module name that collides with a popular module and crash the testbots. So I modified the heuristic to prioritize projects with the same name as the module. The php module was part of core but was split off into its own separate php project. So hass's tests failed because Project Dependency is choosing a Drupal core release with a php module in it (see comment #63 of #2047557: Support Drupal 8-style *.info.yml files). Damien Touroud on a previous issue suggested using the popularity of the project in the heuristic but this would fail miserably for the php module. There was a problem with Simpletest #1276914: Contrib module may be considered a dependency instead of core module of the same name. rfay suggested core should have preference in the heuristic and again this would fail miserably for the php module. Then there was the google_analytics and googleanalytics projects. The latter project has been deleted but there are releases. You can probably just look at the issue queue for Project Dependency and find several more. The sad thing is the programmer knows which project they want but there is no place to specify it so I have to guess and there is no way that I can create a heuristic that will always be right.
Also consider the case where you have released your project and everything is going fine and then someone creates a new project and suddenly your tests start failing. But you have not touched your code. jthorson will get people screaming about problems with the testbots and then it will get passed to me and I will have to deal with someone that is berating me up and down that this needs to get fixed yesterday and how could we possibly be #$^*%*$* everything up because the code did not even get changed. And you are complaining that the programmers might have to actually tell me which project they really want? That is why this has to be at least a Drupal best practice because it really is unacceptable for something that has been passing tests fine to suddenly stop working when nothing in that project has changed.
Comment #34
chx commentedComment #35
chx commentedComment #36
chx commentedNow we know what are we talking about, if we want to make the project string required then a followup and a (very) wide community buy in is required for that. I recommend not holding the issue with it. However, it is optional at the moment
+ // Split out the optional project name.so we might've misunderstood each other and noone wanted required in the first place?Comment #37
Grayside commentedThis seems like a very drupally way of trying to specify which repository to use for a given library (module) dependency, which sounds like the same problem space as configuring tools like composer to use a different fork. If we followed that model, the directive might be on a separate line.
Comment #38
hass commented@grayside: That looks like my #5 idea. That is really backward compatible I think. I like it, too.
Comment #39
trobey commented@Grayside: I am trying to think how that would work. I am not sure that I completely understand how that approach would be implemented so I am thinking out loud. I take the structure from drupal_parse_dependency() and have to pass it into drupal_check_incompatibility(). These are core functions or ports of core functions. (The core maintainers always assume that Drupal 7 core only has to understand Drupal 7 info files but this is not true. I have to use Drupal 7 core to read Drupal 6 and Drupal 8 info and info.yml files. So I often have to port the code but it is core code nonetheless.) So if we introduce a new line then I no longer can use the core drupal_parse_dependency() and have to write my own and try to create a structure that mimics the drupal_parse_dependency() structure so I can pass it into drupal_check_incompatibility(). There is always the risk that my function produces different results and then there may be problems. We went through a long exercise to port the ability to parse Yaml files to Drupal 7 so I could read the Drupal 8 info.yml files. I tried several Yaml parsers which were rejected because they might produce different results than Drupal 8 until we decided to use the Symfony module which someone had written to allow Symfony stuff to be used in Drupal 8. So I think I am already going to get people complaining if I do not use drupal_parse_dependency().
This problem also applies to other parts of Drupal. The modules page uses the dependencies to decide whether something can be enabled. It is not as big a problem there because the universe of choices is the installed projects while Project Dependency has to work with the universe of all possible projects.
I expect the number of cases of module name collisions to increase as people port their projects to Drupal 8. So this is going to have to be fixed at some point. I might note I tagged it as a feature for core but it is a critical bug for Project Dependency which cannot be fixed until this feature makes into core.
Comment #40
trobey commentedComment #41
chx commentedTo be considered: the "project" line does not exist as far as Drupal is concerned. Look here http://cgit.drupalcode.org/views/tree/views_ui.info
So we need to decide whatever way we add this to dependencies on what do we do if the project value is not available? It won't be from a git checkout.
Side note:
> The core maintainers always assume that Drupal 7 core only has to understand Drupal 7 info files but this is not true. I have to use Drupal 7 core to read Drupal 6 and Drupal 8 info and info.yml files.
That's off topic. If you want, please file a separate meta issue and get the community to agree with that. Until then, D7 code works with D7 modules.
Comment #42
chx commentedAfter a brief discussion on IRC: there's a sister issue to this, this is a followup to it: enact a policy (no code whatsoever) that
project:line in*.info.ymlis mandatory and add it to the core files. That can't be done past beta because if from beta1 to beta2 modules won't even be recognized as such then we sort of failed in "we are not turning the world upside down anymore past beta". If I may, I recommend putting considerable effort in making your case succinctly and precisely. That was not apparent in this issue. I am interested enough to condense the problem into an IS for this issue (which you probably want to reuse for the other one too) but trying to change policy this close to beta is an issue too controversial for my tastes so I can't help with that one. Don't be surprised if this change will need to wait for 8.1.Once we have done such policy, this for D8 becomes an easy issue.
Then we can decide what do with D7. That's an entirely separate thing and I am not sure whether it's solvable *at all*. We can add an optional policy perhaps. That will also be fun to get through.
Comment #43
trobey commentedEnact a policy? I have no idea what you are talking about. Can you explain in English or provide a link?
Have we decided to proceed with project:module() with project mandatory? I submitted a patch where it is optional. Your previous comment suggested you are not in favor of it being mandatory. Did I miss something in the discussion?
Comment #44
chx commentedWell, you post an issue something like https://www.drupal.org/node/2134513 this and then somehow get attention to it and get it accepted. It's very informal. There's no formal process. Wish there was.
So far, I think we agreed on it being optional. It would be quite a blow to enforce for every dependency a project when so often it'd be X:X anyways.
Comment #45
trobey commentedThanks for the help on the write up and the pointer to submitting a policy. I am getting hammered from all sides so it is a struggle for me to spend any time on this. I submitted a policy #2296241: [policy, no patch] Project namespace for dependencies and hopefully it makes some sense despite my lack of sleep.
Comment #46
hass commentedI'm totally confused what this case has to do with project: key in info.yml. Can we set this back to RTBC now?
Comment #47
chx commentedHow do you plan to get the project from the info if it's not in git? Yes, the packaging script puts in there but if it's not in git then git checkouts have no way of gaining it. Not to mention custom modules. Also, we can't because I haven't seen better comments written...?
Comment #48
hass commentedI have not reviewed the project dependency code, but today we find the projects. Project key is not in the scope of this case. This is RTBC. Don't set it back, please. Create followups for other issues, please.
Comment #49
trobey commentedComment #50
chx commentedPostponed on #2296241: [policy, no patch] Project namespace for dependencies
Comment #51
chx commentedAlso why did you RTBC this despite I asked for better comments? You know what the community thinks of you for this behavior, right? Do not re-RTBC this. I am actually trying to help you despite your constant issue queue trolling.
Comment #52
trobey commented@chx: While I appreciate your help you can do better than this. I did not RTBC this. I did update the comments. So if your comment is directed at me you are wrong twice. Sigh.
Comment #53
trobey commented@chx: At this point I think you have completely screwed up this issue. You clearly did not understand the issue when you first responded. That is understandable as it is I am not sure I could jump into a new issue and make meaningful comments. But I do not know what is worse: no one reviewing an issue or someone confusing things with misdirected comments to the point where the issue is dead. I am beyond frustrated. This is a serious issue which is impacting those of us trying to maintain the testing infrastructure.
Comment #54
hass commented@Chx: as trobey said - you have not understand anything in this issue. Sorry. The last ~30 comments are ALL offtopic and have nothing - absolutly nothing to do with the issue here. You only confuse this case. Trobey has rewritten the intro and i have no idea how someone can explain this more detailed. I'm not trolling here, You do not understand the issue at all. The other confusing case has been closed. This patch is RTBC. Try understanding the issue first before you write another 20 nonsensical comments, please.
Comment #55
chx commentedComment #56
alexpottThis issue seems like only half the work or the testing is not complete. I would have expected test modules declaring dependencies on project:module configurations that exist or not not exist. Reading the code I can't see how the dependency graph is fixed for modules of the same name being provided by different projects. Are we only adding this information for https://www.drupal.org/project/project_dependency?
Setting back to "needs work" to get answers.
Comment #57
trobey commented@alexpott: These are good questions and I will try to address them one by one.
This issue seems like only half the work or the testing is not complete.
This patch is only for Drupal core. I have tried very hard to make the change as simple as possible and intuitive. So the patch is very small (excluding the changes for the testing). I have also tried to minimize the impacts on Drupal core and existing projects. There is a lot more work in Project Dependency that is required. I am trying to find time to begin on that but it will assume that Drupal core is not taking a completely different direction from this patch.
I would have expected test modules declaring dependencies on project:module configurations that exist or not not exist.
I added a test for project:module in the patch:
The tests are unit tests and do not check to see if the project or module exists. The added test follows this pattern. If additional testing is required then it should be a separate issue since it applies to more than just this change.
Reading the code I can't see how the dependency graph is fixed for modules of the same name being provided by different projects. Are we only adding this information for https://www.drupal.org/project/project_dependency?
The patch includes a couple of fixes for the dependencies on the module page. But this patch is also just limited to providing the missing information about the required project. How could this missing information be used on the module page? Have you ever gone to enable a module and looked at the dependencies that are listed that are missing? Those modules need to be downloaded and installed. Going back to the webform_patched:webform example, a module that has a dependency on the webform module shows up on the module page. So I need to install the webform module. But we do not install modules; we install projects. I always pause here to go "Oh yeah, that module is actually in this project." It is almost so automatic that we forget that other people not as familiar with Drupal could struggle to figure this out. For example, is it obvious that a missing fe_block module requires installation of the Features Extra project? But even experienced people could run into problems. For example, if the dependency happened to be for webform_patched:webform but I went out and installed the webform project which also contains the webform module then the wrong dependency has been installed. Presently Drupal has no way to know this and the code may fail to work or indicate the problem. If the project information is available, then it would be possible to fix the code so that Drupal can detect that the installed module belongs to the wrong project. Code could also be written so that red "missing" is actually a link to the project page. It happens that there have not been any issues filed to fix the modules page while I have had to deal with several issues related to this for Project Dependency and I currently have a critical issue that requires this fix. If the problem originated on the modules page I may have written a bigger patch to include using the project information on the modules page. But I do not want to hold up Project Dependency while wrestling over how to use the project information on the modules page.
I think I have answered all of your questions and have not come up with anything that has to be changed in the patch. So I am switching this back to "needs review."
Comment #58
alexpottNo it's completely not obvious - but I really can't see how this issue fixes that. Yes it would allow this to be fixed if modules included their dependencies like this. But this patch does not make that required or give any much of a clue that this is even possible. We need more documentation since at the moment it is not there to help module authors do the right thing. Plus this is a change from previous versions of Drupal so we need a change record.
Comment #59
trobey commentedI would be glad to provide more documentation. Where should it go? In my search I could not find anything for Drupal 8 on dependencies in the info.yml file. Should this be done before the patch is accepted?
Can you provide information on how to create a change record?
Comment #60
alexpottThe documentation should be added to the doc block for
InfoParserInterfacesince this line is would be incomplete with this patch applied:And since there are no examples in core you will need to provide a valid one.
change records? Add one: http://drupal.org/node/add/changenotice | Instructions: https://drupal.org/contributor-tasks/draft-change-record | New change record process: https://groups.drupal.org/node/402688 | See also: needs change record? missing change record? for lists of issues. change record improvements?
Comment #61
trobey commentedI updated the patch to include changes to the documentation for InfoParserInterface. I will look at submitting a change record.
Comment #62
trobey commentedI have created change record for this issue #2299747: Project namespaces can now be added for module dependencies so I am changing the status to "needs review."
Comment #63
hass commentedtrobey has written change notice, project dependency integration. Setting back to RTBC as before. No changes to the patch made.
Comment #64
alexpottSo if I have both webform and webform_patched in my /modules directory and I install a module that depends on webform_patched's webform module how does the module installer choose the correct one to install?
To me this solution still seems half baked and we have work to do in core.
Comment #65
trobey commented@alexpott: I think "half-baked" is a poor choice of words since it implies it is not well thought out when the rest of your comment indicates that you believe it to be incomplete. I believe there is a difference between the two. But you are correct that there is additional work to do in core for the situation you have outlined. In addition, there is additional work for Project Dependency which I have already written in a separate patch #2047557: Support Drupal 8-style *.info.yml files. That issue is a critical bug on Project Dependency which is preventing testing from working in some cases. So the Project Dependency part is ready to go but is being held up by this core issue. The additional work for Drupal core is not critical and there are several possible approaches. I do not think the Drupal core part is going to be ready for some time so should Project Dependency and the problems with the testbots be held up?
As an aside I fixed a bug in Project Dependency that was preventing Drupal 7 core from being processed. Without this fix the forum in Drupal core has a dependency on the taxonomy module which ends up as the leftandright project (which also happens to have a taxonomy module). I do not think this is a problem since the dependency chain is stopped with Drupal core but it is again an example of an unintended dependency due to the lack of uniqueness in module names.
Comment #66
alexpottSorry I didn't mean to imply that there has not been thought put into it - I was meaning to say I feel it is incomplete.
What I'm trying to say is that if we introduce this then we need to bake this into module dependency discovery so that the system behaves as the user expects. If a developer adds the project to the dependency info and the system enables the wrong module then this is going to be super confusing.
Whilst I understand that this enables Project Dependency to download the correct module and that this is very important - meeting developer expectations is important too.
Comment #67
alexpottAlso one of the advantages of the current system is that you can replace modules like webform with webform_patched and modules that depend on webform will still think their dependencies are met. If we start specifying projects then we don't get this flexibility. Obviously the current solution does not break this flexibility but if we enforced this type of dependency management in core we would have this issue. And what happens if there is a webform_patchedNG module?
Comment #68
trobey commented@alexpott: So let me translate this.
Well, I was going to try to dive into the system module but I guess I have better things to do.
Comment #69
hass commented@alexpott: as maintainer of a module it is my decission on what module my module depends. I'm testing with php:php and not with random:php_patchedNG or any other. I need to make sure that only compatible dependencies are installed and not any random modules with the same name just for the reason that an idiot created a duplicate project and have not helped me fixing bugs in my module. I have test failures in google analytics that need to be fixed and I cannot workaround. This makes it impossible to share patches in queue as every "needs review" status ends with a testbot failure and a "needs work" status in *every* issue! This makes project issue queue and automated testing useless and failing in 100%. Is this what we want?
This is really a good solution and we do not force anything. Maintainers can also add test_dependency key with "php:php" and dependency key with "php" only to allow these suxxx flexibility described by you in the info files. I cannot and will never support random module integrations like webform_patched and webform_patchedNG if my module is only supported with webform. The others are outside the game. The developers of the random modules may have not understood how we maintain modules in this community and that we *fix* modules and do not create projects like webform_patched. This only suxxx. We are not on wordpress site where you have no idea what google analytics module you should download out of ~10-20 available ones. These theoretical flexibility is a lot less our problem than the issues we really have.
Independed of the issue here I would force a policy. Unpublish and delete such duplicate projects on d.o. But this is all OT here.
Comment #70
dries commentedI'm reclassifying this as a 'task' as it will help address multiple issues for Testbot, Drush, the packaging scripts, the project pages on drupal.org and Drupal's module installation page. I'm also moving this back to 'needs review' because I don't feel like alexpott's questions have been answered appropriately. I certainly appreciate all the work that has gone into this patch, but I also feel it could use a bit more discussion based on alexpott's feedback. Thanks everyone!
Comment #71
greg.1.anderson commentedThis issue, from a Drush perspective.
1. Drush will attempt to automatically download a module "foo" when it sees a module "foo" in the dependency list of some other module "bar" (during `drush pm-enable bar`) if there is no "foo" in any downloaded module in the current Drupal site. This patch will help Drush in instances where "bar" wants the "foo" module from the "foo_patched" project. The current workaround is to just manually download "foo_patched" before enabling "bar".
2. Drush has a larger problem when it needs a module "foo" that only exists in some project that is not named "foo". Some folks like to put the "baz_bob" module into the "bazbob" project, for example; less commonly, someone has a dependency on a submodule of a project without depending on the primary module (which is named after the project).
This proposal could help Drush out quite a bit to the extent that folks use it. From a Drush perspective, I am not concerned that "bar" might require "foo:foo" when the end user might prefer "foo_patched:foo"; Drush could simply treat the project name as advisory, and print a warning to the user if it decided to use "foo_patched:foo" ("foo_patched" module already downloaded) instead of the "foo:foo" that was requested (foo module not downloaded).
I don't think Drush will correctly handle downloading two differently-named projects that contain the same module name(s), but that is a Drush issue that does not affect this task. Drush could also really benefit from a modulename-to-projectname mapping service, for existing modules without the project info in the dependency list, but that is also a Drush issue that is perhaps orthogonal to this request (since knowing the project names does not help the testbot select which one should be used).
In conclusion, then, I think that this enhancement is a net win for Drush, and I for one would be interested in seeing it adopted if it meets the needs of other interested parties.
Comment #72
trobey commentedI think @greg.1.anderson's comment makes sense. The current patch parses the dependency and returns the project name but does not require it to be used. On the modules page it would allow the red "missing" to be a link to the proper project page. This would be helpful when the module name is different than the project name. For automated processes it would allow the requested project to be downloaded or whatever.
If a module of the same name is already installed but not from the requested project then the behavior is undetermined. It is not just a simple matter of downloading the requested project because I do not think it is possible to install two modules with the same name without encountering problems. Removing the existing module and installing the new project probably is not a good idea. So there has to be some manual intervention.
For Drupal core we only allow projects that are of a compatible version to be installed which is desirable for robustness. As a contributed project maintainer I worry about someone installing a project different from the one that I specified. It is likely that I have not tested with that project so problems are more likely (and those problems will of course be directed at me). But since there will be some manual intervention required there is a range of possible approaches from an emphasis on robustness to an emphasis on flexibility.
Project Dependency does have a table that could be used to map modules to projects. There is no way to currently access that information but it might be possible. But that is another topic.
Comment #73
trobey commentedAttached is an expanded patch to show how the project namespace for dependencies could be used in Drupal core. Since the project name is optional there should be no change when the patch is applied. Some instructions for testing are to download a contrib project such as the Devel project. You should download it instead of using Git to install it so that you get the packaging information in the .info.yml files. If you go to the modules page (admin/modules) the four Devel modules should appear under Development. Enable the first module, Devel. Then open the requirements for Devel node access. It should look like:
Now go to the devel_node_access.info.yml file. The dependencies should look like:
Note that the project should show up in the information added by the packaging script on drupal.org. Change this to explicitly specify the project as follows:
Now the requirements on the modules listing should look like:
Note that when a project name is available the requirements show up as a project:module pair. Also, the project is a link which takes you to the drupal.org page for that project. This greatly simplifies finding projects when the module name is not the same as the project name. Now to demonstrate a mismatch go back to the devel_node_access.info.yml file and change the project in the dependencies to specify the devel module in the Devil project:
Checking the modules listing the requirements now look like:
The modules listing has detected that the installed module has the file devel.info.yml which the packaging information shows as belonging to the Devel project while the Devil project was requested. The link to the project should not work as there is no such project. The mismatch will not be detected if the packaging information is missing or the optional project namespace is missing.
This should demonstrate how the optional project namespace could be used by Drupal core. The demonstration tries to follow the suggestions so far. Since this is demonstration there is no attempt to make sure it does not break something in the tests.
Comment #74
hass commented@alexpott: What exactly is not already answered here?
Comment #75
alexpottWe should be adding a test module with a missing project dependency so that we can test the new behaviour. Much happier now that module page is reporting the missing dependency - but this needs testing. Also since the UI has new behaviour it'd be nice to have a screenshot of this working.
Comment #76
trobey commentedI have updated the code and added tests of the functionality. The new tests are under Module in Drupal\system\Tests\Module\DependencyTest. The tests use a test project system_project_namespace_test. The test project contains two modules with system_project_namespace_test dependent on system_project_namespace_dependency_test. system_project_namespace_test.info.yml
where the name of the project is incorrectly specified. This creates a mismatch which is shown in the screenshot.
The screenshot shows the project name containing the required module and the project name is linked to drupal.org/project/
. This allows a user to easily find a required module even when the name of the module does not match the project.
Note in the screenshot that just the required module is enabled. Then the other module detects that a module with the same name as required module is installed but the projects do not match (there is no mismatch if there are two uninstalled modules that match the name of the required module). This functions as a warning but does not prevent the module with the requirement from installation later in the test. Also note that the .info.yml files for this test contains the project line that is generated by the packaging in order to detect the mismatch. If either the optional project name in the dependency or the project name in the packaging information is missing then the mismatch is not detected. So the mismatch warning is only helpful in some situations.
Comment #77
claudiu.cristeaMaybe we should suggest a more complex pattern having also comma, telling that the version requirement can be more complex?
This an unusual way to wrap lines. Better leave them on a single line.
In the unlikely case of having
$dependencyequal to:views_uitheif (...) {...}block will not be executed becausestrpos()will be 0, leaving the$dependencydirty, with a colon in the first place.Use
$this->l()insteadl()— I think is available in the class.Maybe www. on d.o URL?
Comment #78
hass commented#2. yeah, should be one line.
#3: I do not think we need to handle this as this is not supported and in this case it should break intentionally.
Comment #79
trobey commented#3: A colon in the first position is not supported but I updated this anyway since it is a better programming practice.
#4: $this->l() failed tests so I did not make that change. I added the www to d.o.
The updated patch incorporates the suggested changes except for $this->l().
Comment #80
hass commentedThis suxxx every day more. #2061157: Test stuck in queue. Please commit!!!
Comment #81
jhedstromThis replaces
l()with$this->l().Comment #84
trobey commentedPatch 81 does not work. I said in #79 that I did not include the suggestion for $this->l() because tests failed. So patch 81 added that change and ... tests failed. So patch #79 is still the one that I would suggest using.
Comment #87
trobey commentedComment #89
trobey commentedI guess if we wait long enough the code changes enough so the patch will no longer work. I will update the patch and resubmit it.
Comment #90
trobey commentedI updated the patch. $this->l() has a change to the arguments from l() so I found the change record and made that correction to the patch.
Comment #91
hass commentedCan we get this committed now, please? RTBC this again.
Comment #92
joachim commentedThis comment doesn't agree with the issue summary: is the project: part optional or not?
Also, AFAIK, current policy is that an unpublished change record must be written before the patch can be committed.
Comment #93
alexpottThis issue was a major task now critical. To evaluate this and whether we should make this change during the beta, we need to update the issue summary according to https://www.drupal.org/core/beta-changes to explain what improvements it makes and what the disruption of the change would be. Can someone add Drupal 8 beta phase evaluation template to the issue summary.
Comment #94
alexpottAlso considering #91 contains no justification for the criticality according to https://www.drupal.org/core/issue-priority demoting back to major.
Comment #95
hass commented@Joachim: please read the case first. As noted several times "project:" is optional. A change notice for optional stuff seems not required from my point of view.
Comment #96
joachim commentedIf it's optional, then the documentation in the patch is wrong.
Comment #97
hass commentedWhat does the words "Recommended for uniqueness" in the patch tell You?
For me this means it is recommended, but not required and therefore optional.
Comment #98
joachim commentedThis bit says it has to be of that form. (And while we're at it, the format should be quoted.)
Comment #99
hass commentedThis is more than clear. Can you read the details and tests, please?
Comment #100
trobey commentedComment #101
trobey commentedComment #102
joachim commented> + * - dependencies: An array of strings of the form project:module (>x.y).
That is untrue, because you can have a string of the form just 'module', which is not the given form. I feel I'm banging my head on a brick wall here.
Comment #103
hass commentedCan you read the other 3 lines, please? These explain what you are looking for. If you ignore them you cannot understand the full picture. The full documentation of how the info strings may look like are on a d.o documentation page. We cannot cover all these complexity and examples in 80 chars inline documentation.
If I only read the first line and ignore the 3 other lines than maybe.
Comment #104
hass commentedhttps://www.drupal.org/node/542202#dependencies is where the documentation goes after this has been committed. All previous syntax will be supported plus the new syntax with project name.
Comment #105
joachim commentedYes, I can read them.
Ok, so a developer who doesn't know Drupal will see that the 'project' part is optional, and therefore write ':module' with the colon...
Look, all that's going to happen is that someone is going to file a documentation bug on this at some point in the future, and we'll shake our heads and sigh at patches that get in without clearly-written documentation :/
Comment #106
trobey commented@joachim: With all due respect I do not think the change to the documentation you are suggesting is advisable. The project name is optional but that is so that the impact on existing projects is negligible. All new code should have the project name supplied. Essentially the use of only the module name for specifying dependencies would be deprecated and discouraged. And why would anyone refuse to provide the project name? They know the project name so it is not a burden. And without the project name they risk having their automated tests broken or their users spending time trying to find the correct project. Can you supply any case where someone would not want to supply the project name?
I would also ask that you consider those of us maintaining the infrastructure for drupal.org including the testbots and the testing infrastructure. I spend a lot of time tracking down problems associated with the testbots and there are others that contribute even more of their time. Once this is committed I do not want to spend an entire day tracking down a problem with the testbots only to have to tell them they should supply the project name in their dependencies. It is a waste of my time and their time.
Comment #107
joachim commented> All new code should have the project name supplied.
What about custom modules that are in a site's codebase and have dependencies on other custom modules? Those are not on d.org and therefore don't have projects.
> Once this is committed I do not want to spend an entire day tracking down a problem with the testbots only to have to tell them they should supply the project name in their dependencies. It is a waste of my time and their time.
That's a very good point. How about we word it to say that modules hosted on d.org must include the project: prefix?
Comment #108
trobey commentedYou are correct that custom modules do not have a project name. There are three places where I know these dependencies are used. The first is automated testing on drupal.org. This does not apply to custom modules. The second case is on the Modules page for ensuring that dependent modules are enabled. If the project name is supplied then a link is supplied back to the project on drupal.org to help download required modules. The third case is drush which would like to automate downloading projects but currently can only do so in limited cases (how cool would it be to do a drush dl
and have drush ask if you want to download any missing dependencies?). Again, this applies only to projects hosted on drupal.org. But your point is still valid. I suppose if we ever required the project name we could use "custom" in these cases. I updated the patch by hand.
Comment #110
alexpottThis change is a shame because then the dependency information has nothing that matches the Extension::getName() method. And it makes the current dependency code more difficult to share with themes in future. I'm not sure that this change is really necessary.
No need for the span also the use of colour here should be UX tested. Warnings elsewhere have a different colour.
I don't think we should be assuming the project is stored on drupal.org. Removing this will reduce the amount of change on the ModulesListForm since all the change to use Xss::filter can be removed.
How is the user going to know what mismatch means?
Re #108 afaik drush will already download missing dependencies when you try enable a module with missing dependencies.
Comment #111
hass commented#4. That is true.
project status url = "http://example.com/release-history"could be set in .info files and than the download is not on d.o. This is possible. As I know the project URL is available in update status module and can be for sure outside of d.o.I do not think that this will work any longer for the
phpproject as it was moved outside of core.Comment #112
trobey commentedComment #113
trobey commentedI uploaded a new patch.
1. I added a beta evaluation to the issue summary.
2. Near the beginning of this issue it was requested that I change "name" to module." I have changed it back in the new patch.
3. I am not an UX expert. I removed the span and changed the color to match the warning.svg (#e29700).
4. I removed all the links to drupal.org. I removed the Xss:filter.
5. I changed it from "mismatch" to "project mismatch."
As concerns drush, how exactly do you expect drush will automatically download a project that does not match the module name? It is the exact same problem we face with the testbots trying to guess the project. I was wrong about the drush command (drush pm-enable instead of drush dl) but there is a more complete discussion of this by greg.1.anderson (https://www.drupal.org/node/2205271#comment-9013487). I know it is a long issue so it is a bit much to expect anyone to remember or read everything.
Comment #114
hass commentedComment #116
alexpottI wonder if this patch is just trying to do too much. The problem space especially for the UI is extremely complex and this patch only adds a warning that probably will only serve to confuse the user since it does not prevent them from installing the module.
Given that potentially a module could be provided by any number of projects and those individual projects be depended on in conflicting ways, what we are really after is to know where to get the dependency from if it is not the expected place. For example, if a module depends on the webform module in webform_patched we need to know to download http://www.drupal.org/project/webform_patched. But it is possible for another variant to exist as well ie. http://www.drupal.org/project/webform_patched_better and other modules depend on that :(
Another issue is that the project information is only added by the packaging script so if you use git or drush with git deploy your module's info.yml files will not contain the project key. So whether or not the UI works will depend on how someone gets their modules. And even if the project is downloaded through a tarball only the top level .info.yml file has the project information added.
The original problem is that testbot (and drush) can not always determine where to get a dependency of a project. We should focus on that and leave the UI issues behind. The test should just ensure that if the project information is present in the dependency information it is ignored by Drupal's module installer when checking dependencies.
I think the use of the * here is weird. Just put everything together. Also a bit more text on the subject of uniqueness could be helpful using the examples in this issue.
Comment #117
joachim commentedTBH, if you create a webform module in a new project webform_patched, or use it, then you're asking for trouble. Project names on d.org are unique and modules within projects should be namespaced: if people stuck to that we'd be fine.
The webform_patched project shouldn't exist -- its maintainers should have become branch maintainers for the older branches of webform that they wanted to update.
Comment #118
hass commentedThat is not correct. We are talking about dependency key and not what the packaging does. Packaging does not interfere here at all.
A few if not You only asked for the UI... :-)
Comment #119
alexpottRe #118:
It is used here
Comment #120
trobey commentedIt is a sad fact that while a project has a project name on drupal.org the project name only appears in the info files in the lines provided by the packaging script. As I stated way back in comment #65 the critical issue here is fixing the automated testing and providing the same help to drush in locating modules. There are many approaches to using the project information on the modules page but this is not critical and should not hold up fixing the problems with the testbots. I have updated the patch to remove all the UI changes. This leaves six lines of code changes and one line changed in testing and the rest of the lines are documentation changes.
Comment #121
hass commentedComment #123
trobey commentedComment #124
alexpottThis should be
'name' => 'views_ui'Also I think we should still include test modules to ensure that having project in dependency information does not break anything.
Comment #125
trobey commentedI added a test module that uses a project namespace dependency.
Comment #126
alexpottThe method should have a
publicscope. Also the docblock indentation of the first line is incorrect.Let's make this dependent on filter so the test does not have to install so many modules.
This would have the advantage of making dependency information more extensible in the future.
Comment #127
trobey commented1) I copied the format of all the other functions in this file. If they are wrong then it should be corrected in a separate issue. I fixed the indentation.
2) I changed the dependency to filter.
3) This is expanding the scope of this patch. I think it would be better handled as a separate issue.
Comment #128
alexpottIt would be great if the test can explain what it is testing - ie. that project namespaces in dependencies are ignored. To that end...
Let's change
drupalto something that should obviously be ignored and and more information to the test.Regarding #127.1 - two wrongs don't make a right.
How is #127.3 expanding the scope? We're adding more information to the dependencies stored in .info.yml - this is just another way. That said this problem does not just affect Drupal 8 so going with a backportable solution probably makes sense.
Also the suggested structure is not easy to port to .info...
... would be something like...
So possible but hard coding numeric keys is ugly.
Comment #129
hass commentedIt may be a lot easier to implement the more flexible structure for D8 now and backport the feature itself to D7 with a single string variant. I'm not sure how many discussions we will run into about this if we have it different between D8 and D7, but I also think the suggested structure looks cleaner. For future we can make it therefore better, but for the current D6/D7 state of the art we have at least a workaround with the string. Not every maintainer will add the project name to D7, but for D8 we can do better from day one. Should we go this direction now? Will we really get this in?
Comment #130
alexpott@hass I've looked at this a bit more. It's just not worth it. We should refactor this in 9.0.x there is too much madness in ModuleHandler::parseDependency()... for instance rebuilding the original version information...
... a sticking a space on the front. Why would we want that? :(
Comment #131
alexpottGot to love Drupal... a later we remove it and the brackets
Comment #132
trobey commentedWe changed the comment for the test for the project namespace. It is not a good idea to change "drupal" to something else. At some point Drupal will use this information and as the code changes this test will then fail. Sure, it can always be changed at that time but why make things harder?
Every time we have been asked in this issue to expand the scope it has only slowed down progress and confused the issue. And eventually gets rolled back. We have learned the hard way to say no to scope expansion. There currently are contrib projects where automated tests do not work. This is a big impact on their development. How would you feel if the automated testing for Drupal core was broken? We would have people screaming for us to get it fixed. These contrib projects have not had automated testing working for almost a year. It may not be a critical issue for Drupal core but you can bet it is critical for those projects and for Project Dependency. That is not good for their development, software quality and Drupal's image.
We are very familiar with the code in parseDependency. We keep having to port it. Drupal.org uses Drupal 7 but Project Dependency has to read info files from Drupal 6, 7 and 8. Drupal core keeps removing the code to read past versions of info files. Thus Drupal 8 only reads Drupal 8 info files. But when drupal.org gets ported to Drupal 8 we will need to add code so we can read Drupal 7 (and 6) info files. If parseDependency changes and the new format is used then it will break Project Dependency. We will have to port the changes back to Project Dependency. Right now we have code that is ready to commit to Project Dependency to use the project namespace format. We have not looked at it in almost a year. The longer this goes on the more likely there are going to be problems with automated testing while we figure out the code again and get it committed. Already we worry it is no longer going to be a smooth process. On top of that, waiting until there are a rush of projects updating to Drupal 8 is not a good idea.
Comment #133
hass commentedComment #134
jhodgdonI was asked in IRC to see if I could help with the documentation in this patch... several patches ago.
There are two chunks of documentation, and I think both of them are at best misleading, and in addition, they both have some formatting and punctuation/grammar problems.
a) InfoParserInterface - in patch:
The two Example lines are not indented right, and there are grammar/punctuation problems... how about:
b) ModuleHandler - from the patch:
My suggestion for this would be (this needs to be wrapped at 80 character lines):
A dependency string, which specifies a module dependency, and optionally the project it comes from and versions that are supported. Supported formats: 'module', 'project:module', 'project:module (>=8.x-4.5-beta5, 8.x-3.x)'.
Comment #135
trobey commentedI updated the documentation.
Comment #136
jhodgdonThank you!
So in the second piece:
The list of examples should either use list format (see https://drupal.org/node/1354#lists) or the formats should just be in-line separated by commas.
Comment #137
trobey commentedIn-line with commas looks horrible since there are strings that should not be broken. I added the dashes for the list.
Comment #138
trobey commentedComment #139
alexpottEither a missing comma or a misplaced comma. I think the comma is unnecessary.
Also this list looks exhaustive, because of the words
Supported formats:. I suggest changing this toSupported formats include:. Or includingmodule (versions). Also mixingproject:modulewith(>=8.x-4.5-beta5, 8.x-3.x)is weird since we're mixing placeholders with real values.Comment #140
alexpott@trobey re #132 there's far too much I in that comment. You seem to be forgetting that Drupal is about we.
Comment #141
alexpottThe issue summary needs to be updated (and probably the CR) to reflect the fact the including the project dependency information has 0 impact on module installation and dependency calculation within Drupal core code. Since it is totally reasonable to expect the information to have some effect. Also the code documentation should be updated to reflect this too.
Comment #142
trobey commentedComment #143
trobey commentedComment #144
trobey commentedWe updated the issue summary to add that this patch has no effect on module installation and dependency calculation in Drupal core. We also updated the change record. We also changed everything to "we" in comment #132. We also updated the patch to remove the comma and change "Supported formats" to "Supported formats include." We changed the specific versions to the word version in the example templates. We also updated the code documentation to mention this change is currently ignored in Drupal core but is used for automated testing.
We also have a new related issue that is reporting a problem with the Twitter project due to this design flaw.
Comment #145
jhodgdonThe docs formatting in ModuleHandler is still not quite right:
The - should line up with the previous line. See https://www.drupal.org/node/1354#lists
Comment #146
trobey commentedWe fixed it and uploaded a new patch.
Comment #147
jhodgdonThanks! Docs look good to me now. I will leave the rest of the review to others.
Comment #148
damienmckennaJust reviewing this, will see if I can do a reroll of this for D7.
Comment #149
hass commentedCan we get this patch committed now, please?
Comment #150
hass commentedAll green
Comment #151
alexpottCommitted 305ed67 and pushed to 8.0.x. Thanks!
Thank you for adding the beta evaluation to the issue summary.
Comment #153
xanoI just tried to add this to Payment 8.x-2.x. The testbot handles it fine, but core seems to have problems with the new format.
Comment #154
hass commentedThe testbot is not yet able to use the new format. The project dependency patch has not been deployed to d.o yet. I guess this is #2047557: Support Drupal 8-style *.info.yml files
Comment #155
alexpottNice - #153 found an existing bug :) see #2410151: _system_rebuild_module_data_ensure_required does not parse dependencies
Comment #156
hass commented@trobey: Do you plan to backport this to D7? You know we cannot RTBC our own patches... *hint*
Comment #157
trobey commented@Hass: @DamienMcKenna was supposed to be looking into backporting to Drupal 7. I was going to wait a bit and catch my breathe and see if he comes up with anything. If not I should be able to put a patch together very quickly.
Comment #158
damienmckenna@trobey: I haven't gotten to it yet, feel free to give it a try.
Comment #159
trobey commentedHere is a first try at a patch for Drupal 7.
Comment #160
hass commentedComment #161
attiks commentedPatch looks good, thanks for the backport
Comment #162
David_Rothstein commentedCommitted to 7.x - thanks! This looks like a nice improvement.
I fixed the following on commit (the first because it was in the Drupal 8 commit but seemed to just be flat-out missing from the backport, the second I reverted because it wasn't in the Drupal 8 commit and in fact looks inaccurate in a couple ways... we should have a followup issue to add that documentation though):
Comment #164
David_Rothstein commentedI created a followup issue for the above-mentioned documentation change, and also updated the change notice for this issue so it applies to Drupal 7 also. Please review: https://www.drupal.org/node/2299747/revisions/view/8461810/8979767
Comment #166
cweagansComing here from #2660992: Due incorrect dependency information, the module can not installed via composer and #2551703: Store composer.json if present.
I know it's a bit late to do this, so my apologies - but I think this should be reverted entirely unless I'm missing something. The entire premise of this change is based on the idea that I should be able to choose the project namespace that the "webform" module comes from, and I don't think that's a valid claim. We encourage people to collaborate on things for a reason: we don't want a zillion different webform projects that do the same thing, except for tiny variances. That's just setting people up for pain. hass had the problem that specifying a dependency on the "php" module was not actually downloading the contrib php module. That sounds like an issue with either the testbot or project_dependency, and really isn't something that core should have to work around. "If there's no PHP module available, then google_analytics can't be installed" is about as far as core should go. With this patch, though, if there is a valid reason to use webform_patched instead of just webform, I can't do that anymore if someone specifies the project namespace.
I'd suggest that a very simple fix here would involve leaving the dependencies key alone, and adding a new key that was something like "testbot_project_dependencies" or something, which would simply be a list of project namespaces (and not module names) to download as part of a test run.
If nothing else, does anyone have an objection to softening the language in the change notice? I don't think all new code needs to specify " - pathauto:pathauto (>=8.1.x)" when a simple " - pathauto" will do. I don't see any reason for encouraging people to do this unless they specifically need a module from another project namespace, or if the project namespace isn't clear (i.e. Features Extra submodules).
There was not a lot of support for doing this other than from trobey and maybe hass, and there was explicit disagreement on that point from chx and maybe others (I read the issue very quickly, so may have missed someone). This needs wider discussion before we say that the more verbose way is the "recommended" way of doing things.
EDIT: Removed some words that didn't make sense after I reordered the points in my comment.
Comment #167
David_Rothstein commentedI thought the main reason for this was to support automatically downloading modules that don't have the same name as the project they live in (and not just by the testbot, but also Drush).
For example if you have
dependencies[] = date_apiin an info file, Drush has no way to know that https://www.drupal.org/project/date is the project it needs to download to resolve that dependency. But if you usedependencies[] = date:date_apithen it can.Following the link from the change notice to https://github.com/drush-ops/drush/issues/1731 it seems like Drush might support that now (since the patch here was committed) but I haven't tested it myself.
I agree with you about the change notice though:
Comment #168
hass commentedThere is
test_dependenciesfor testing only. I only use this in ga. However I think this is a valid aproach and must not rolled back.If module should not support webform_patched than it is not allowed to use it. It may be hard, but it's also a way to tell people to collaborate and not fork. It also helps not ending in the wordpress mess. Hard, but maybe intentionally. I personally do not use this (and see it as last resort decission), but I see the reasons for doing this and like it.
Comment #169
quicksketchThe Date/Date API example is the primary reason for this functionality, and I think it's a great improvement as well. The webform_patched example might be an alternative use of this, but not the main reason it was added.
I updated the documentation for writing .info files at https://www.drupal.org/node/542202#dependencies.
Comment #170
dave reidI think my major problem is that the change record and documentation seem to indicate that this is the only way to specify dependencies, and that in most cases, like, if you depend on ctools or token modules, this results in additional confusion over 'ctools:ctools' and 'token:token', in addition to modules possibly breaking people using Drupal < 7.40 when attempting to run database updates.
I would assume the new syntax should be used in the cases of date:date_api where project name <> module name, but that is not very clear.
Comment #171
dave reidFor example, #2753203: Incorrect dependencies format in amp.info
Comment #172
dave reidThis change in the documentation made sense to me, because it's clearly about ambiguous dependencies, and indicates that it requires Drupal 7.40: https://www.drupal.org/node/542202/revisions/view/9119944/9541547
The change in the above general section about dependencies is what confused me and I think should be reverted: https://www.drupal.org/node/542202/revisions/view/9541547/9556989
Comment #173
dave reidI made the following edit to the section on .info files in D7, leaving most of the explanation about project dependencies in the project dependency section, and noting that in most cases, just the simple non-project dependency information is needed. https://www.drupal.org/node/542202/revisions/view/9557153/9800823
Comment #174
trobey commentedIt is true that project namespaces are not required but the results without them are unpredictable. I added code to Project Dependency to prefer a project of the same name as the module name but this is not guaranteed. In view of the complexity of the code for calculating dependencies I think relying on this is putting more faith in my fix than I would have myself. So if you omit the project namespace it is done at your own risk. Unlike D8, this change was introduced late in the D7 life cycle so adding project namespaces is a concern if using old versions of D7 core. If maintainers are worried about old versions of D7 core and they have not had a problem with getting the wrong dependencies then I do not see anything wrong with waiting until there is a problem before adding a project namespace. At least project maintainers have an option now to fix problems with dependencies. Project namespaces are recommended for D8.
I might note that the number of issues filed on Project Dependency has slowed to a trickle since this change was implemented. This has greatly reduced the time that several of us were spending chasing down issues that could not be solved. There are some obscure issues for Project Dependency that I probably will not be able to tackle until project namespaces are required but they are not urgent (yet).
Comment #175
MixologicBad news. This patch did not address all of the places in core that introspect the .info files.
Apparently installation profiles *also* check to validate their required dependencies and assume that any module listed in an install profiles .info file becomes a required module, and it parses each listed modules info files, and makes the assumption that the name is the module that needs to be listed.
Please refer to #2855026: Installation profiles do not support project:module format for dependencies .
Comment #176
mikran commentedRe #2983584: Comprehensive solution for potx config project:module format dependencies
also some config translatables are missing now due to this.