Working again on multi-versions of the same library.
We start to have more and more libraries available in multiple versions.
In a consumer package:
If composer.json states foo: "~1 | ~2"
As v1 and v2 are different major version, we are going to have 2
different packages installed in different tree.
php-foo1, with autoloader in /usr/share/php/foo1/autoload.php
php-foo2, with autoloader in /usr/share/php/foo2/autoload.php
So you MUST allow both version ONLY if your autoloader is aware of each
BuildRequires: php-composer(foo) < 3
BuildRequires: php-composer(foo) >= 1
Requires: php-composer(foo) < 3
Requires: php-composer(foo) >= 1
And in autoloader
Do not allow multi major versions if your composer if not aware.
Do not add Conflicts on composer virtual name.
Conflicts: php-composer(foo) >= 3
This is bad, as if php-foo3 exists, it will be installed in another
tree, so won't be used, and no conflicts needed.
Comment (before I try to add something in the packaging tips page) ?
(in my repo)
- twig 1 and 2 are allowed, as autoloader is aware of both versions
- symfony 3 is not allowed (despite supported by upstream) as the
autoloader is only aware of v2