/* * pkg - Dependency resolver * Uses Kahn's algorithm for topological sort * https://rawnix.org * * Copyright (c) 2025 zorz@gmx.com * SPDX-License-Identifier: BSD-2-Clause */ #ifndef RESOLVE_H #define RESOLVE_H #include "pkg.h" #include "repo.h" #include "pkgdb.h" #include "locker.h" /* Resolution result */ typedef struct { strarray_t *order; /* Ordered list to install */ strarray_t *missing; /* Missing dependencies */ strarray_t *cycle; /* Packages in cycle */ bool has_cycle; bool has_missing; } resolution_t; /* Create/free result */ resolution_t *resolution_new(void); void resolution_free(resolution_t *res); /* * Resolve dependencies for a package. An installed dependency is * only treated as satisfied when it is current against its port, * locked, or has no port at all; outdated ones enter the order and * get upgraded. Same rule sysup applies. */ resolution_t *resolve(repo_t *repo, const char *pkg, pkgdb_t *pkgdb, locker_t *locker, bool makedeps); /* True if the installed version differs from the port's version-release */ bool version_differs(installed_pkg_t *ip, port_t *p); #endif /* RESOLVE_H */