kdeldycke / meta-package-manager

🎁 wraps all package managers with a unifying CLI
https://kdeldycke.github.io/meta-package-manager
GNU General Public License v2.0
475 stars 33 forks source link

Fix parsing of non-point releases Homebrew versions #15

Closed kdeldycke closed 7 years ago

kdeldycke commented 7 years ago

See how brew releases tied to a branch, like the default version in Travis CI, has an extended version string:

$ mpm managers
(...)
├───────────────────┼──────┼─────────────────────┼─────────┼──────────────┼────────────────────────────────┤
│ Homebrew          │ brew │ /usr/local/bin/brew │ ✅       │ ✅            │ ❌  1.1.0-136-g34f08a9 >= 1.0.0 │
├───────────────────┼──────┼─────────────────────┼─────────┼──────────────┼────────────────────────────────┤
│ Homebrew Cask     │ cask │ /usr/local/bin/brew │ ✅       │ ✅            │ ❌  1.1.0-136-g34f08a9 >= 1.1.0 │
├───────────────────┼──────┼─────────────────────┼─────────┼──────────────┼────────────────────────────────┤
(...)

Which is not surprising as we brutally reuse Python's packaging module to parse versions:

$ python
>>> from packaging.specifiers import SpecifierSet
>>> from packaging.version import parse
>>> parse('1.1.0-136-g34f08a9')
<LegacyVersion('1.1.0-136-g34f08a9')>
>>> parse('1.1.0-136-g34f08a9') in SpecifierSet('>=1.1')
False

A solution might be to tweak the raw version reported by all package managers:

>>> parse('1.1.0.136-g34f08a9') in SpecifierSet('>=1.1')
False
>>> parse('1.1.0.136.g34f08a9') in SpecifierSet('>=1.1')
False
>>> parse('1.1.0.136') in SpecifierSet('>=1.1')
True
kdeldycke commented 7 years ago

This issue doesn't only concerns the default Travis CI images. Users stumble upon that too. See: https://github.com/matryer/bitbar-plugins/issues/621#issuecomment-267294860 (cc @rkrug).

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.