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

fix(lifecycle): return correct base when using devel for build-base #4523

Merged
merged 6 commits into from
Jan 24, 2024

Conversation

syu-w
Copy link
Contributor

@syu-w syu-w commented Jan 15, 2024

get_effective_base() should not return "devel" and pass it to the PartsLifecycle(), which make the parts think the coreXX is "devel". Thus checking the wrong path for dynamic linking.

LD_LIBRARY_PATH=...:/snap/core24/current/lib:/snap/core24/current/usr/lib:...
become
LD_LIBRARY_PATH=...:/snap/devel/current/lib:/snap/devel/current/usr/lib:...
which not exists.

Fix: #4508

@syu-w syu-w requested review from cmatsuoka and mr-cal January 15, 2024 23:49
@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (ffbdabf) 89.20% compared to head (191ea36) 89.19%.
Report is 18 commits behind head on main.

Files Patch % Lines
snapcraft/remote/git.py 22.22% 7 Missing ⚠️
snapcraft/projects.py 83.33% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4523      +/-   ##
==========================================
- Coverage   89.20%   89.19%   -0.01%     
==========================================
  Files         321      322       +1     
  Lines       21759    21826      +67     
==========================================
+ Hits        19410    19468      +58     
- Misses       2349     2358       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@syu-w syu-w force-pushed the work/CRAFT-2376-fix-build-base branch 2 times, most recently from 02fb2ce to 50c4176 Compare January 16, 2024 00:57
Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

Nice work finding the problem. Just a question about craft-parts.

@syu-w syu-w requested a review from mr-cal January 17, 2024 16:54
Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@sergiusens sergiusens left a comment

Choose a reason for hiding this comment

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

I don't understand why we are loosing the abstraction, it seems like the but is in get_effective_base

@sergiusens
Copy link
Collaborator

Can you also target the hotfix/8.0 branch?

@syu-w syu-w force-pushed the work/CRAFT-2376-fix-build-base branch from d1fc926 to c65d700 Compare January 19, 2024 19:51
get_effective_base() should not return "devel" and pass it to the
PartsLifecycle(), which make the parts think the coreXX is "devel".
Thus checking the wrong path for dynamic linking.
@syu-w syu-w force-pushed the work/CRAFT-2376-fix-build-base branch from c65d700 to 6fd97ec Compare January 19, 2024 20:31
@syu-w syu-w requested review from sergiusens and tigarmo January 19, 2024 20:46
Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

So if I understand the failing spread test correctly, for a project with the following definition,

base: core24
build-base: devel

we want to pass the base of core24 to craft-parts and the base of devel to craft-providers. The problem is that get_effective_base() is not a one-size-fits-all solution for this scenario.

What do you think of adding "core24": bases.BuilddBaseAlias.DEVEL to this mapping? This would require us add more validation logic here so that

base: core24

still does not work. (and would give us an opportunity to raise a better error than the current KeyError that gets raised)

@mr-cal
Copy link
Collaborator

mr-cal commented Jan 23, 2024

Ack, I'm sorry I linked to the wrong validator and misled you.

What I meant is that we need a validator that ensures this is still not allowed:

base: core24

I think you can add a new validator along the lines of if base == "core24" and not "build-base"?

Once the core24 snap is available on beta channel, we can remove this validator.

@syu-w syu-w force-pushed the work/CRAFT-2376-fix-build-base branch from d85f950 to a9ee505 Compare January 23, 2024 22:06
Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

👍

@mr-cal mr-cal merged commit d75fdaf into main Jan 24, 2024
9 of 10 checks passed
syu-w added a commit that referenced this pull request Jan 26, 2024
…-hotfix

fix(lifecycle): return correct base when using devel for build-base (#4523)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants