gazebosim / gz-tools

Command line tools for the Gazebo libraries.
https://gazebosim.org
Apache License 2.0
14 stars 18 forks source link

`ign` command version comparison needs natural sort order #48

Closed peci1 closed 3 years ago

peci1 commented 3 years ago

Environment

Description

Steps to reproduce

  1. install libsdformat8-dev
  2. install libsdformat10-dev
  3. take a SDF 1.7 model and pass it to ign sdf --check.
  4. The check fails saying that SDF 1.7 is too new for this tool to work with. That points at sdformat 8 being used.

I bet the problem lies in

https://github.com/ignitionrobotics/ign-tools/blob/d32853a9b4ebf21c3421f7e903e51a9c45e15849/src/ign.in#L145

which looks like C-order rather than natural order. But as my Ruby knowledge is limited, I don't know how to fix it correctly.

My system reports these version of sdformat:

8.9.1
10.3.0
scpeters commented 3 years ago

we can copy some of the ruby code from homebrew's version.rb file to handle version parsing and sorting

or we could try to add swig bindings for the ignition::math::SemanticVersion class

chapulina commented 3 years ago

add swig bindings for the ignition::math::SemanticVersion class

That's part of https://github.com/ignitionrobotics/ign-math/issues/101

Note that it would add a dependency to ign-math, and this may cause a circular dependency if we ever decide to add ign-tools to ign-math as part of https://github.com/ignitionrobotics/ign-math/issues/198.

caguero commented 3 years ago

See pull request #50 .