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

add support for injecting checksums for cargo crates #4661

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

Even though the crates are recognized as sources for Cargo easyconfigs the checksums are not written, at least when neither 'source_urls', 'sources' nor 'patches' are present.

Handle crates like sources and add test.

Even though the `crates` are recognized as sources for `Cargo`
easyconfigs the checksums are not written, at least when
neither 'source_urls', 'sources' nor 'patches' are present.

Handle `crates` like `sources` and add test-
The added EC and EasyBlock requires changes to the expected output in
some tests.
# grab raw lines for source_urls, sources, patches
keys = ['patches', 'source_urls', 'sources']
# grab raw lines for the following params
keys = ['source_urls', 'sources', 'crates', 'patches']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this approach is a bit weird, as it breaks the boundary between framework and easyblocks, since crates is not a general easyconfig parameter...

Thoughts on this @Micket?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we come up with an approach that would also work for components (in Bundle easyblock)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in the confcall I added a method src_parameter_names to the easyblock class.

In the Cargo easyblock we can override this to also return "crates".

For components I don't think this is useful. For now they look like:

components = [
    (name, version, {
        'source_urls': ['https://poppler.freedesktop.org/'],
        'sources': [SOURCE_TAR_XZ],
        'checksums': ['86b09e5a02de40081a3916ef8711c5128eaf4b1fc59d5f87d0ec66f04f595db4'],
        'configopts': "-DENABLE_BOOST=ON",
    }),
    ('poppler-data', '0.4.10', {
        'source_urls': ['https://poppler.freedesktop.org/'],
        'sources': [SOURCE_TAR_GZ],
        'checksums': ['6e2fcef66ec8c44625f94292ccf8af9f1d918b410d5aa69c274ce67387967b30'],
    }),
]

While the Bundle easyblock seemingly supports specifying checksums for everything at the top-level (outside the components) I don't think it actually does: It creates a full list of sources, patches and checksums during __init__ but the actual checksum check (at least the contrib check) requires them in each component as above.

However with this design it would be possible to add the checksum list after the components but then we'd need to include logic to remove them from each component

The general approach is different here anyway: crates are just another way to specify sources while components are similar to exts_list which yield actual easyblock instances.

@boegel boegel added this to the 4.x milestone Oct 9, 2024
…rs for "sources"

Some easyblocks such as `Cargo` will use a custom EasyConfig parameters
to fill the `sources` list.
To avoid hard-coding them `inject_checksums` introduce a static method
`src_parameter_names` to return a list of parameters that contribute to
the final list of `sources` when parsing the EasyConfig.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants