-
Notifications
You must be signed in to change notification settings - Fork 537
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
Replace Pacman()
syscall logic with libalpm
#2786
Closed
Closed
Conversation
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
…absent from the 'packages' configuration. x50+
…enu and complete an installation and check of success
Including a local test runner for qemu
…alls to interact with pacman
Some additional commits came in, will revert those/this PR and clean that up. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Description:
This PR will enable us to move away from running
pacman -XYZ
via system calls, and instead rely on libalpm directly, via pyalpm.This has the added benefit that we can do package search efficiently, meaning we can replace:
archinstall/archinstall/lib/packages/packages.py
Lines 45 to 59 in 26cf046
Allowing us to do local searches, and let pacman deal with databases and searching.
This simplifies custom mirrors and allowing us to search against them too.
Some thoughts
I decided to use a context manager approach, as it allows us to choose between interacting against system-wide pacman data - but during context creation also decide if we want a temporary pacman data structure.
That way we can do:
To not collide with system-wide pacman, and perform searches and syncs independently and irregards if existing pacman is executing.
With this we can remove:
archinstall/archinstall/lib/pacman/__init__.py
Lines 32 to 43 in 26cf046
And if we want to interact with pacman system wide, we simply just do:
I'm sure we could achieve the same thing with using only
__init__
and some if/else.But for some reason this felt like a logical thing to do, especially since all pacman operations are "transaction based", meaning we need to create a lock file while doing operations - and then remove the lock file once we're done.
And if libalpm/pacman crashes during an operation, we need a way to do easy cleanup and remove said lock file.