Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-generator does not support lockfiles generated by yarn v3 #361

Open
vemonet opened this issue Jun 28, 2023 · 0 comments
Open

node-generator does not support lockfiles generated by yarn v3 #361

vemonet opened this issue Jun 28, 2023 · 0 comments

Comments

@vemonet
Copy link

vemonet commented Jun 28, 2023

flatpak-builder version

1.3.3

Linux distribution and version

Fedora 38

Affected flatpak-builder tool

node/flatpak-node-generator.py

flatpak-builder tool cli args

No response

Source repository URL

https://github.com/vemonet/EmojiMart/tree/19df11b324e74a9e3d32f25d65e7595b08c59c8c

Flatpak-builder manifest URL

https://github.com/vemonet/flathub/tree/io.github.vemonet.EmojiMart

Description

When trying to build the sources for a yarn.lock generated by yarn v3 (which is the version officially recommended by yarn today), it fails with the error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/vemonet/develop/tmp/flatpak-builder-tools/node/flatpak_node_generator/main.py", line 277, in main
    asyncio.run(_async_main())
  File "/opt/conda/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/conda/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/vemonet/develop/tmp/flatpak-builder-tools/node/flatpak_node_generator/main.py", line 198, in _async_main
    packages.update(lockfile_provider.process_lockfile(lockfile))
  File "/home/vemonet/develop/tmp/flatpak-builder-tools/node/flatpak_node_generator/providers/yarn.py", line 107, in process_lockfile
    for name_line, package in self.parse_lockfile(lockfile).items():
  File "/home/vemonet/develop/tmp/flatpak-builder-tools/node/flatpak_node_generator/providers/yarn.py", line 69, in parse_lockfile
    key, value = shlex.split(line)
ValueError: too many values to unpack (expected 2)

Which is triggered by the line conditions: os=android & cpu=arm64 (your parser expect only 1 blank space per line, to split it in 2 variables)

Note that I shared my repo URL with the commit where I was still using yarn v3 to help reproduce the error, but the main is now using yarn v1

There are a few changes of lockfile format between yarn v1 and v3, so I would expect there will be many other things to fix, so not sure if someone will have the time to look into it

In the meantime would it be possible to print a clearer error message when a user try to compile sources for a yarn v3 lockfile please? e.g. Lockfiles generated by yarn v3+ are not supported, please use yarn v1, cf. https://classic.yarnpkg.com/lang/en/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants