Skip to content

Fix start_dir for components of Bundle easyblock#3769

Open
Flamefire wants to merge 1 commit intoeasybuilders:developfrom
Flamefire:20250612111227_new_pr_bundle
Open

Fix start_dir for components of Bundle easyblock#3769
Flamefire wants to merge 1 commit intoeasybuilders:developfrom
Flamefire:20250612111227_new_pr_bundle

Conversation

@Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Jun 12, 2025

(created using eb --new-pr)

I tried using a patch for a bunde component but it failed because the start_dir is wrong. It will always use build_dir (or a path relative to it if set in start_dir EC parameter) because at the point of guess_startdir there are no sources in self.src hence it can't be relative to the unpacked source.

The comment and code don't add up too:

# location of first unpacked source is used to determine where to apply patch(es)
comp.src[-1]['finalpath'] = comp.cfg['start_dir']

Why does it set the last sources final path to the start_dir?

So I'd say the only correct way would be to set comp.src correctly and call guess_start_dir afterwards. Touching a sources finalpath can never be right ever, can it?

Edit: Further investigation shows that finalpath isn't set correctly for multiple sources. What happens for bundles of multiple components with a single source:

  • Start with an empty builddir
  • Extract source of 1st component -> Only folder -> finalpath set to that folder
  • Extract source of 2nd component -> 2 folders -> Parent folder (builddir) is used as finalpath
  • When setting component2.src = src2 and then calling guess_start_dir it will find the source and use its finalpath as the start_dir, hence wrongly using the builddir
  • If start_dir is manually set in the easyconfig it will still find the correct start_dir
  • However apply_patches uses the finalpath of the source at an index given in the patch spec, defaulting to 0
  • Hence it will try to apply the patch in the build dir instead of the component dir

So this requires either easybuilders/easybuild-framework#4922 or comp.src[0]['finalpath'] = comp.start_dir after the comp.guess_start_dir so that patches work correctly.

@Flamefire
Copy link
Contributor Author

The actual issue here is

Turns out the Bundle easyblock has multiple issues and quite a few easyconfigs & easyblocks already rely on the broken behavior.

E.g. Clang-AOMP does a configure-step in the Bundle-level using the directories that would be the correct finalpath for src_dir, e.g. src_dir = 'omp-1.2.3/llvm'.
With this fix this results in starting at omp-1.2.3 where the subfolder omp-1.2.3 does not exist (it tries <builddir>/omp-1.2.3/omp-1.2.3/llvm)

The confusing behavior of the code contradicting the comment is fixed in #3778, the rest needs further discussion.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants