alisw / alibuild

A simple build tool for ALICE software
http://alisw.github.io/alibuild/
GNU General Public License v3.0
24 stars 47 forks source link

A build results in formatting error #887

Open mborisyak opened 4 days ago

mborisyak commented 4 days ago

Dear alibuild developers,

I was using aliBuild for compiling FairShip and encountered the following error:

$ aliBuild build FairShip --config-dir shipdist/ --defaults release --always-prefer-system
Traceback (most recent call last):
  File "/home/max/opt/pyenv/versions/py3/bin/aliBuild", line 130, in <module>
    doMain(args, parser)
  File "/home/max/opt/pyenv/versions/py3/bin/aliBuild", line 83, in doMain
    doBuild(args, parser)
  File "/home/max/opt/pyenv/versions/3.10.4/envs/py3/lib/python3.10/site-packages/alibuild_helpers/build.py", line 490, in doBuild
    getPackageList(packages                = packages,
  File "/home/max/opt/pyenv/versions/3.10.4/envs/py3/lib/python3.10/site-packages/alibuild_helpers/utilities.py", line 469, in getPackageList
    requested_version = resolve_version(spec, defaults, "unavailable", "unavailable")
  File "/home/max/opt/pyenv/versions/3.10.4/envs/py3/lib/python3.10/site-packages/alibuild_helpers/utilities.py", line 126, in resolve_version
    return spec["version"] % {
TypeError: unsupported operand type(s) for %: 'float' and 'dict'

The error was provoked by the following dependency:

package: termcap
version: 1.0

It seems like the version was parsed as float.

Forcing str in alibuild_helpers/utilities.py:126 does solve the problem:

return str(spec['version']) % {
  ...
}

however, I'm not sure if it is the right way to fix the issue.

Sincerely, Maxim.

singiamtel commented 4 days ago

Hi Maxim, thanks for the bug report.

Could you share your version of aliBuild aliBuild version and alidist (cd alidist && git log -1)?

I believe this error should've been fixed by https://github.com/alisw/alidist/commit/9d9fb8bc6, which happened a while ago

singiamtel commented 4 days ago

I'm just realizing now that you're using shipdist, not alidist, apologies. I agree that version: 1.0 should be valid recipe syntax and therefore this is a bug.

I'll open a PR with your patch, thanks for your help!

mborisyak commented 3 days ago

Thank you! An alternative would be to raise an error, but you are right --- converting the version into a string is easier and more intuitive.