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

v0.4.0 - support for dependency resolving #15

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

VirtCode
Copy link
Owner

@VirtCode VirtCode commented Oct 6, 2024

If you are upgrading from 0.3.x, please read the comments below for relevant heads-ups.

closes #4

This PR basically replaces the package scheduling system to allow for scheduling multiple packages at once, and resolving dependencies between them. Builds can be cancelled if dependencies are not resolved. This will increment the version to v0.4.0.

Additions

  • Dependencies from the AUR are automatically added when adding packages
  • Before builds, dependencies are resolved and packages will be built in the required order. New dependencies will not be automatically added on build, in order not to add packages outside the control of the user.
  • Packages will have a flag whether they are a dependency, so they can be purged if no longer needed.
  • Builds have two new states, pending for when a dependency needs to be built first, and aborted for when a dependency is missing, or dependencies failed to build (can be disabled).

Changes

  • Packages whose cron schedule point to the same point in time (don't have to be the same, just "trigger" at the same moment), will be combined into a "build session", where dependencies between them are resolved.
  • Whether a package is up to date is tracked in a more robust way now. This is not exactly backwards compatible, causing all (enabled) packages to rebuild when updating.

Design Decisions

  • The crate aur-depends from the paru project is used to do the heavy resolving work. While not perfect how it's used here, this is way better than reinventing the wheel. Also reduces complexity greatly.

TODO

  • build lock reimplementation
  • refactor/combine resolving of adding and building into one
  • remove package version attribute, as this is the chance as packages have to be rebuilt anyways
  • refactor image updater to use custom scheduler too, so we can drop the cron-scheduler library (and such that it doesn't block on start)
  • update cli with dep flag and other stuff
  • docs (and readme checkmark), promote OWN_REPOSITORY_URL better
  • cargo fix, and general refactoring
  • bug where the channel in the resolver is closed (cannot reproduce though)
  • some packages have recursive dependencies (e.g. material-symbols-git, but also happens now if I try to re-migrate?)
  • migration heuristics
  • limit concurrent builds
  • update libraries et. al
  • a ton of testing (also migration testing, the dates might be off) in-progress
  • tag new release (cli is incompatible)

@VirtCode VirtCode marked this pull request as ready for review December 17, 2024 19:11
@VirtCode
Copy link
Owner Author

VirtCode commented Dec 17, 2024

I've now upgraded my personal server to this version and things didn't exactly go smoothly. The problem is that we need to rebuild all packages (the version tracking system before was really unstable so it is replaced with this PR). As I have a rather large repository (about ~130 packages), running all the builds at the same time did overload my server and lead to timeouts in the docker communication and drove sqlite to its knees.

Unless you have a small package repository, make sure you do the following:

  • Make a backup of serene.db beforehand (just in case).
  • Make sure you have the newer version of the cli installed before you update the server.
  • After upgrading the server image, rebuild all your packages manually, ideally in small groups:
    • You can pass multiple packages to resolve between them, e.g. serene build --gentle --resolve package-a package-b package-c.
    • Once you only have a few leftovers, you can also try building all outdated packages with serene build --all.

I will now test this build for 1-2 days and see how it goes.

@VirtCode VirtCode changed the title support for dependency resolving v0.4.0 - support for dependency resolving Dec 21, 2024
@dumbasPL
Copy link
Contributor

@VirtCode if you merge #14 and rebase this I wouldn't mind testing this on a decently sized repo.

$ serene list | wc -l                                                                                                                                                                        
222

@VirtCode
Copy link
Owner Author

VirtCode commented Dec 22, 2024

okay, sounds great!
Will merge the agent stuff either this evening or tomorrow, and do a rebase then.

I think I will also have a look at implementing some basic heuristics regarding the migration to the new version tracking, such that you can use them to upgrade your repo. Upgrading my repo of 133 packages was already quite a pain (to rebuild everything without overloading my server), so I don't want to imagine how it is with 222.

@dumbasPL
Copy link
Contributor

How about a queue system? Basically only allow a limited amount of packages to build at a time. On my previous server with HDDs I was running into frequent timeouts even while building 2 or 3 at a time (#3). This should solve almost all issues assuming the queue schedules the dependencies in the right order.

Or maybe we can use the docker resource restrictions and allow for multiple slower builds in parallel without overwhelming the host (since many packages build quite quickly). But that will definitely require some tweaking on the user side based on their hardware.

@VirtCode
Copy link
Owner Author

True, that's actually a great idea. With the current rewrite of the scheduler it is also pretty easy to add that I think.

Will have a look at that, but will probably be some time after christmas, am pretty busy atm.

@VirtCode VirtCode force-pushed the dependencies-rebased branch from 7f6e286 to f630b8a Compare December 27, 2024 13:42
@dumbasPL
Copy link
Contributor

dumbasPL commented Jan 1, 2025

With CONCURRENT_BUILDS the update process went quite smoothly but I have a few comments.

  1. --all implies --gentle but that isn't documented or obvious from --help. Also, no way to turn it off outside of just manually listing all the packages as arguments.
  2. Packages that were removed from the aur result in a cryptic could not resolve dependencies: <pkgname> as opposed to the expected aur package '<pkgname>' does not exist (404) that you get when adding a package
  3. (unrelated to PR) non-devel packages (badly named) that behave like devel packages will always fail to build. Would be nice if we could manually set the devel flag to avoid the dreaded version mismatch issue. I've seen this in your to-do lists already so just pointing it out as a real issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support for building packages that depend on other aur packages
2 participants