alibuild icon indicating copy to clipboard operation
alibuild copied to clipboard

A build results in formatting error

Open mborisyak opened this issue 1 year ago • 3 comments

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.

mborisyak avatar Nov 19 '24 16:11 mborisyak

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 avatar Nov 19 '24 16:11 singiamtel

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!

singiamtel avatar Nov 19 '24 23:11 singiamtel

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.

mborisyak avatar Nov 20 '24 07:11 mborisyak