We have a branch of lightning that defines the D.O packager as its packagist like so:

    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],

And all of it's dependencies use the D.O packager syntax for versions. E.g.:

        "drupal/core": "^8.1.0",
        "drupal/embed": "^1.0",
        "drupal/entity_embed": "^1.0",
        "drupal/media_entity": "^1.0",
        "drupal/media_entity_instagram": "^1.0",
        "drupal/media_entity_twitter": "^1.0",
        "drupal/media_entity_image": "^1.0",
        "drupal/ctools": "3.0.0-alpha26",
        "drupal/panels": "3.0.0-beta4",

That all seems to work well. Running composer install grabs all the dependencies from the new packager and builds lightning as expected.

Next, I tried pointing lightning-project (Lightning Project, not Lightning) to this new branch of lightning on github like so:

    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "vcs",
            "url": "https://github.com/acquia/lightning"
        }
    ],
...
    "require": {
        ...
        "drupal/lightning": "dev-8.x-drupal-packagist"
    },

That also worked as expected. It pulled in lightning and all of lightning's dependencies (and lightning's dependencies' dependencies for that matter).

Next I tried pushing the branch of lightning that uses D.O's packagist to D.O itself (as the 2.x branch of Lightning)... and then referenced that branch of lightning in lightning-project like so:

    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
...
    "require": {
        ...
        "drupal/lightning": "2.x-dev"
    },

This resulted in lightning being installed correctly, but all of its dependencies were missing. I did a bit more testing and, as far as I can tell, when a project has a dependency pulled from the D.O packager which has a sub-dependency also pulled from the D.O packager, the sub-dependency fails to get installed. The following chart summarizes my findings. I'm unable to test all of the possible combinations, but I've indicated which rows correspond to actual branches of lightning-project and I tested a few more (e.g. P.D.O --> GH) by using drupal-project plus a dependency on the address module.

Files: 
CommentFileSizeAuthor
packagist-combinations.png111.23 KBbalsama

Comments

balsama created an issue. See original summary.

balsama’s picture

balsama’s picture

Just confirming that this is still a problem. @phenaproxima had said that @mixologic thought it might have been a bug that was fixed in HEAD of composer. I confirmed that using the dev version of composer does not fix the problem.

Test branch here: https://github.com/acquia/lightning-project/tree/drupal-packagist-includ...

Mixologic’s picture

Status: Active » Postponed

This is a combination of how it is currently supposed to work, and a bug thats not supposed to be happening. You should not be able to include drupal/lightning from p.d.o, because we currently do not process dependencies for distributions (we do not look at info.yml, and we do not pull in the composer.json - only modules and themes get that).

There is, however a separate issue in that drupal/lightning shouldn't exist on the composer facade *at all* as a consequence. Unfortunately the initial processing was restricted to modules and themes, but subsequent releases *did* process distributions, except it has none of its dependencies, (which you can see here: https://www.drupal.org/files/packages/8/drupal/lightning$1803e8be628b62f76f3186d12bea7f799a722f8e45adacf8a4c572551ff9b724.json). So we need to fix that because you should never see drupal/lightning at packages.drupal.org (currently).

The reason that distributions are not supported, currently, is because dependency calculation for them is a horrible mess, mostly because we have multitudes of examples where distributions would check in entire copies of drupal, which combined with the fact that modules were not namespaced in the past, meant that dependencies would end up all over the place. In this case, since none of lightning's dependencies are namespaced in the info.yml, you might accidentally end up with a dependency on https://drupal.org/project/dcco - the entire website for drupal camp colorado, because it has a "node" module.

So, the plan is to *only* support distributions that are new enough to be built with composer, which is the plan here "https://www.drupal.org/node/2715441#comment-11669389" .. Once that is in place, we can process distros requirements, *only* from their composer.json so as to not confuse project_dependency.

Sorry its taken so long to respond.

balsama’s picture

FWIW, Lightning is working around this for now by submitting the distro to the main php packagist.

Slide deck describing the problem:
https://docs.google.com/presentation/d/1kwUScdWW0nfae2QFVZ94pUPMRVeKgI-N...

Official announcement of the switch:
http://lightning.acquia.com/blog/packagist-switch