drupal-composer / drupal-packagist

:package: Drupal Packagist server to automatically build package information from projects on drupal.org
http://packagist.drupal-composer.org
28 stars 4 forks source link

Drupal Packagist doesn't respect specific version constraints #63

Closed balsama closed 8 years ago

balsama commented 8 years ago

It seems that if a package specifies a specific version of a dependency, packagist will automatically add the tilde operator. For example, drupal/lightning 1.02 specifically requires version 8.1.0 of drupal/views_infinite_scroll. But packagist is adding the tilde operator to it.

In this case, we specifically need 8.1.0 because we apply a patch to views_infinite_scroll (we have a flowchart that dictates how we constrain versions).

The issue is causing downstream projects to fail because their environment fails when patches don't apply.

Any idea of why packagist is adding the tilde? Any chance we could get that changed?

grasmash commented 8 years ago

@webflo If you can point out the relevant area of code that might do this, I'd be happy to submit a PR.

briantully commented 8 years ago

indeed, it seems any entry in composer.json that is pegged at a specific version, e.g., "8.1.0" somehow gets processed as "~8.1.0". The workaround in drupal/lightning for 1.03 seems to be prefixing with a caret "^8.1.0" which gets respected when processed by drupal-packagist. However this is not ideal, as this only matches "non-breaking" versions. I've been digging through the drupal-packagist code and I don't see where it is parsing/processing composer.json files/requests. Any help on where to narrow my search and I too would offer up a PR.

phenaproxima commented 8 years ago

Spoke to @webflo about and he pinpointed it to drupal-composer/drupal-parse-composer@d7a0078. It's not entirely clear why it's imposing a relaxed version constraint, so we'll see if we can't get this fixed over there.

balsama commented 8 years ago

This was fixed in https://github.com/drupal-composer/drupal-parse-composer/issues/56. Confirmed that the original issue (views_infinite_scroll in lightning 1.02 wasn't pinned) is now fixed. Thanks!