-
Notifications
You must be signed in to change notification settings - Fork 203
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
Flamefire
wants to merge
4
commits into
easybuilders:develop
Choose a base branch
from
Flamefire:cargo-checksums
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
test/framework/easyconfigs/test_ecs/t/toy/toy-0.0-cargo.eb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name = 'toy' | ||
version = '0.0' | ||
versionsuffix = '-cargo' | ||
|
||
easyblock = 'Cargo' | ||
|
||
homepage = 'https://easybuilders.github.io/easybuild' | ||
description = "Toy C program, 100% toy." | ||
|
||
toolchain = SYSTEM | ||
|
||
crates = [ | ||
('toy', 'extra.txt'), | ||
('toy', '0.0_gzip.patch.gz'), | ||
] | ||
|
||
moduleclass = 'tools' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
test/framework/sandbox/easybuild/easyblocks/generic/cargo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
## | ||
# Copyright 2009-2024 Ghent University | ||
# | ||
# This file is part of EasyBuild, | ||
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
# with support of Ghent University (http://ugent.be/hpc), | ||
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
# Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
# | ||
# https://github.com/easybuilders/easybuild | ||
# | ||
# EasyBuild is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation v2. | ||
# | ||
# EasyBuild is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
from easybuild.framework.easyblock import EasyBlock | ||
from easybuild.framework.easyconfig import CUSTOM | ||
|
||
|
||
class Cargo(EasyBlock): | ||
"""Generic support for building/installing cargo crates.""" | ||
|
||
@staticmethod | ||
def extra_options(): | ||
"""Custom easyconfig parameters for bar.""" | ||
extra_vars = { | ||
'crates': [[], "List of (crate, version, [repo, rev]) tuples to use", CUSTOM], | ||
} | ||
return EasyBlock.extra_options(extra_vars) | ||
|
||
def __init__(self, *args, **kwargs): | ||
"""Constructor for Cargo easyblock.""" | ||
super(Cargo, self).__init__(*args, **kwargs) | ||
|
||
# Populate sources from "crates" list of tuples | ||
# For simplicity just assume (name,version.ext) tuples | ||
sources = ['%s-%s' % crate_info for crate_info in self.cfg['crates']] | ||
|
||
# copy EasyConfig instance before we make changes to it | ||
self.cfg = self.cfg.copy() | ||
|
||
self.cfg.update('sources', sources) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
(inBundle
easyblock)?There was a problem hiding this comment.
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:While the
Bundle
easyblock seemingly supports specifyingchecksums
for everything at the top-level (outside thecomponents
) 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 specifysources
whilecomponents
are similar toexts_list
which yield actual easyblock instances.