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

refactor!: streamline package manager initialization #727

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

jake-ciolek
Copy link
Contributor

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran make fmt on your commit series before opening this PR;
  • Updated relevant documentation.

Description of changes

Create a singleton for the umbrella package manager and use it instead of global package-scoped maps. Use more dependency injection.

Move the scattered init() calls to RegisterPackageManager into one place. Create a bootstrap package for handling flag/zip registration.

Use the bootstrapping package in main(). Propagate errors up and report them if initialization fails.

This should make things a bit more testable in the future.

GitHub-Fixes: #425

Create a singleton for the umbrella package manager and use it instead
of global package-scoped maps. Use more dependency injection.

Move the scattered init() calls to RegisterPackageManager into one
place. Create a bootstrap package for handling flag/zip registration.

Use the bootstrapping package in main(). Propagate errors up and report
them if initialization fails.

This should make things a bit more testable in the future.

GitHub-Fixes: unikraft#425

Signed-off-by: Jakub Ciolek <jakub@ciolek.dev>
Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

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

Really wanted to get rid of most init calls, this is really good 🙏

@craciunoiuc
Copy link
Member

you might need to refactor some of the tools too, like the github-action, but not 100% sure.

Be sure to check them out.

@jake-ciolek
Copy link
Contributor Author

you might need to refactor some of the tools too, like the github-action, but not 100% sure.

Be sure to check them out.

Good point. It originally broke the github-action, but thankfully the CI caught it.

Copy link
Member

@nderjung nderjung left a comment

Choose a reason for hiding this comment

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

Thanks! :)

Reviewed-by: Alexander Jung alex@unikraft.io
Approved-by: Alexander Jung alex@unikraft.io

@nderjung nderjung changed the title refactor(packmanager): streamline package manager initialization refactor!: streamline package manager initialization Sep 8, 2023
@nderjung nderjung merged commit 6191557 into unikraft:staging Sep 8, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚀 Done
Development

Successfully merging this pull request may close these issues.

Avoid instantiating things via init()
3 participants