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

include 'sources' key to entries in list returned by collect_exts_file_info #4054

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

The returned dict per extension has a 'patches' key but no 'sources'.
Add this incoorporating source_tmpl or the default value.

Add test for that and also for nosource: True.

@casparvl
Copy link
Contributor

casparvl commented Aug 9, 2022

@Flamefire Can you provide a bit of context for this PR? Is there a related issue, and if not, can you shortly describe what was the previous behavior, why that was unwanted, and what the (intended) behavior of your fix is?

I saw your thread with @boegel on this in Slack, but it wasn't fully clear to me what 'inconsistency' you were referring to there. Plus, to make it easier to find the reason for this change (also in the future), it's probably good to log it here together with the PR :)

@Flamefire
Copy link
Contributor Author

This came up during development of a fix for a bug in the CI checks, see: easybuilders/easybuild-easyconfigs#15973

Basically the function collect_exts_file_info returns a dict where the patches are included but not sources which is confusing at least and makes one wonder whether to use ['options']['patches'] or ['patches'] or ['options']['sources]` etc respectively.

Especially as this functions is intended to handle the correct resolution of templates in the extension sources and patches and there is even a special case (nosource) which needs to be handled this should be done completely in that function.

So the intended behavior is that the returned dict for each extensions contains a sources key with a list of sources if-and-only-if nosource is not set. The sources should have correctly resolved templates (i.e. using name and versions of the extension not the parent EC)

So actually this is a 2 part fix:

  • Return the (correct) sources at all (i.e. especially using the default value when missing or derive from source_tmpl)
  • Return sources and patches consistently in the main dict and not in the sub-dict options

@@ -594,6 +594,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
if 'source_urls' not in source:
source['source_urls'] = source_urls

ext_src['sources'] = sources
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, shouldn't this be [source] (to always have a dict value here)?

Otherwise we'll sometimes have a dict value, sometimes a string value, which is annoying to deal with wherever this is used...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is that similar to 'patches' this is always a list of filenames. See the test(s). This is especially important for the nosource option.

@@ -616,6 +617,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
error_msg = "source_tmpl value must be a string! (found value of type '%s'): %s"
raise EasyBuildError(error_msg, type(src_fn).__name__, src_fn)

ext_src['sources'] = [src_fn]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be [{'filename': src_fn}]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be a list of strings, see https://github.com/easybuilders/easybuild-framework/pull/4054/files#r952807882. However I found a case where it might not be and fixed that

@boegel boegel added this to the 4.x milestone Aug 23, 2022
@boegel boegel changed the title collect_exts_file_info: Add 'sources' key to extensions include 'sources' key to entries in list returned by collect_exts_file_info Aug 23, 2022
@Flamefire Flamefire force-pushed the ext_sources branch 4 times, most recently from e7dba90 to 12ff5bb Compare May 11, 2023 16:48
@Flamefire
Copy link
Contributor Author

CI failure is unrelated:

Unexpected error occurred when trying to download https://ftpmirror.gnu.org/gnu/binutils/binutils-2.37.tar.gz to /scratch/sources/b/binutils/binutils-2.37.tar.gz: 'Failed to write to /scratch/sources/b/binutils/binutils-2.37.tar.gz: The read operation timed out' (took 17 secs)

@boegel
Copy link
Member

boegel commented May 23, 2023

@Flamefire Please sync again with develop after merge of #4255

The returned dict per extension has a 'patches' key but no 'sources'.
Add this incoorporating `source_tmpl` or the default value.
Add test for that and also for `nosource: True` and `sources` being a list.
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.

3 participants