Frogging-Family / wine-tkg-git

The wine-tkg build systems, to create custom Wine and Proton builds
883 stars 159 forks source link

[IMPROVE] Better deps resolver #1138

Closed loopyd closed 5 months ago

loopyd commented 6 months ago

PR Tier: Feature

Issue

_ci_build is intended to offer unattended build functionality for ci pipelines. It currently doesn't as the package manager stops and prompts the user for confirmation.

The dependency resolver is just spaghetti in deps and lacking distro-agnostic functionality. It really should handle a lot more edge cases, especially with priviledge escalation and package management options. Because we have a lot of users on different system configurations. We live in a nix world where everyone has preferences so our code has to react dynamically to that. It did not before this PR.

What's changed?

Goals of this PR

I just want working clean code for autoresolution of build dependencies that will not destroy system state and do things cleanly on every distro the project supports.

I want to make it easier for other developers to contribute support for building wine in other distros by making the code more modular and maintainable.

My lillypad

I plan to also support Nala for debuntu based distros where that functionality forks from choosing between apt and Nala. Because Nala is just better at dependency resolution and has rollback options where apt doesn't. That however is a bit out of scope so I am leaving that out of this PR

Ribbit

If you like this PR, don't like it or have feedback on room for improvement leave that for me. I wanna hear those croaks.

loopyd commented 6 months ago

PR Updates | 03/15/24

Stability improvements

This part of the PR helps address stability issues with package installation during dependency autoresolution, such as 404 errors and down endpoints.

Auto-Retry functionality

_install_pkg and _remove_pkg now retry up to 3 times, triggering some additional functionality on the repeat attempts to attempt to resolve the problem.

This can help if your internet happens to have a hiccup, or on the repo maintainer's side, someone trips a cable. ;)

Mirror Autoresolution

Inclusion of mirror autoresolution with apt-smart on debuntu systems with language code autodetection for the closest mirror using LANGUAGE, LANG and LC_ALL. The code contains forks for the other OS's to perform automatic update of the mirrors, but no functionality is implemented for those distros yet. Mirror update is triggered during the second and third retry installation of a dependency to try to attempt to find a working mirror that contains the package that was missing or not found.

This stability improvement actually got the build working again in ubuntu:jammy when canonical broke some things in jammy's main repo this morning (missing packages in security when going for docbook-utils), and can help with that in the future by using mirrors to download packages when they 404 out.

Critical exits done right

The build now aborts from build.sh and from nonmakepkg_build.sh when if specified, properly when _nonmakepkg_dependency_autoresolver="true", the operation fails and prompts the user to check the output.

My lillypad

Getting happy with the stability of the results, I stop for the day when I have a build success. Suggestion to add conditional dependency installation as done in PKGBUILD for arch to populate the arrays by checking the user's provided config. (for example, include libwayland-dev when _wayland_driver="true". This will introduce additional complexity so is up to the project maintainers.

Tk-Glitch commented 5 months ago

Let's go! Thanks loopyd ! :frog: :heart: