55 Commits

Author SHA1 Message Date
Ariadne Conill
9cd3629f85 libpkgconf: queue: check final solutions for conflicts before returning OK
Otherwise, surfaced conflicts will be detected too late.
Closes: https://github.com/pkgconf/pkgconf/issues/436

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2026-01-18 21:04:22 -08:00
Ariadne Conill
07dfbfffee libpkgconf: pkg: track conflict rule origins
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2026-01-18 20:50:18 -08:00
Ariadne Conill
5e26791ba5 libpkgconf: queue: surface conflicts as part of the solution
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2026-01-18 20:44:48 -08:00
Ariadne Conill
d0823a14fc libpkgconf: queue: add pkgconf_queue_push_dependency
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 20:38:23 -08:00
Ariadne Conill
8b3dd835ae libpkgconf: queue: always evaluate the entire dependency graph when solving
Some types of pkgconf queries may look at subsets of the entire DAG, but
we must consistently solve for the entire DAG so that each query has a
consistent view of the DAG.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-03-06 14:25:23 -08:00
Ariadne Conill
6f1055d00d libpkgconf: queue: stop considering the lack of a pre-loaded match in a dependency node as a fatal error
This is a performance optimization, not an absolute source of truth.
We will evaluate the dependency node lazily in these cases anyway...

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-02-02 03:06:12 -08:00
Ariadne Conill
a79952a084 libpkgconf: queue: always walk requires.private lists internally
This ensures the internal dependency graph solution is always consistent.
We filter out the nodes we don't care about in cases where we need to filter
as of commit 86602bc, so now we can just simplify the solving a little bit.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-02-02 02:30:38 -08:00
Ariadne Conill
a6179c7779 queue: add PKGCONF_PKG_DEPF_QUERY to color solution nodes part of the original query 2024-08-05 13:42:49 -07:00
Ariadne Conill
7a8532f849 queue: remove no longer used root package reference when walking dependency graphs 2024-03-27 18:39:43 +00:00
Kai Pastor
78d53ea012 Revise serials, traversal, flattening
Remove the 'traverse_serial' fields which were added in 2.1.1.
Use the 'serial' field to track the current traversal.
Stop using 'identifier' to sort packages in the flattened solution.
Directly construct the flattened solution by a specific walk which
also preserves the relative order in Requires and Requires.private.
The topological sort is a single list, so don't fill requires_private.
Purely private dependencies are marked in dependency flags.
The ancestor flag is a pkg property, not a client property.
2024-03-27 11:15:04 -07:00
Kai Pastor
4090ba3e0d Clarify tracing messages 2024-03-27 11:15:04 -07:00
Kai Pastor
4e01010d6f Mark user input in error message 2024-03-27 11:09:16 -07:00
Ariadne Conill
5fb09af863 queue: ensure the initial solution is cleaned up when it is no longer needed 2023-11-22 18:43:04 +00:00
Ariadne Conill
f3540de30d queue: clarify the relationship between a flattened dep and its parent
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-11-22 18:13:07 +00:00
Kai Pastor
be1ea7888b Separate input world from output world 2023-11-22 10:11:21 -08:00
Sam James
d454f62c73 libpkgconf: fix -Walloc-size
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
libpkgconf/personality.c:260:11: warning: allocation of insufficient size '1' for type 'pkgconf_cross_personality_t' {aka 'struct pkgconf_cross_personality_'} with size '48' [-Walloc-size]
libpkgconf/queue.c:46:33: warning: allocation of insufficient size '1' for type 'pkgconf_queue_t' {aka'struct pkgconf_queue_'} with size '16' [-Walloc-size]
libpkgconf/client.c:164:33: warning: allocation of insufficient size '1' for type 'pkgconf_client_t' {aka 'struct pkgconf_client_'} with size '120' [-Walloc-size]
libpkgconf/path.c:105:14: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '24' [-Walloc-size]
libpkgconf/path.c:237:22: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '24' [-Walloc-size]
libpkgconf/tuple.c:239:34: warning: allocation of insufficient size '1' for type 'pkgconf_tuple_t' {aka 'struct pkgconf_tuple_'} with size '24' [-Walloc-size]
libpkgconf/dependency.c:133:13: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '44' [-Walloc-size]
libpkgconf/dependency.c:472:17: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '44' [-Walloc-size]
libpkgconf/fragment.c:146:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '24' [-Walloc-size]
libpkgconf/fragment.c:195:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '24' [-Walloc-size]
libpkgconf/fragment.c:356:14: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '24' [-Walloc-size]
libpkgconf/pkg.c:422:13: warning: allocation of insufficient size '1' for type 'pkgconf_pkg_t' {aka 'struct pkgconf_pkg_'} with size '188' [-Walloc-size]
libpkgconf/client.c:164:33: warning: allocation of insufficient size '1' for type 'pkgconf_client_t' {aka 'struct pkgconf_client_'} with size '224' [-Walloc-size]
libpkgconf/personality.c:260:11: warning: allocation of insufficient size '1' for type 'pkgconf_cross_personality_t' {aka 'struct pkgconf_cross_personality_'} with size '96' [-Walloc-size]
libpkgconf/dependency.c:133:13: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '80' [-Walloc-size]
libpkgconf/dependency.c:472:17: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '80' [-Walloc-size]
libpkgconf/path.c:105:14: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '48' [-Walloc-size]
libpkgconf/path.c:237:22: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '48' [-Walloc-size]
libpkgconf/queue.c:46:33: warning: allocation of insufficient size '1' for type 'pkgconf_queue_t' {aka 'struct pkgconf_queue_'} with size '32' [-Walloc-size]
libpkgconf/tuple.c:239:34: warning: allocation of insufficient size '1' for type 'pkgconf_tuple_t' {aka 'struct pkgconf_tuple_'} with size '48' [-Walloc-size]
libpkgconf/fragment.c:146:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '48' [-Walloc-size]
libpkgconf/fragment.c:195:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '48' [-Walloc-size]
libpkgconf/fragment.c:356:14: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '48' [-Walloc-size]
libpkgconf/pkg.c:422:13: warning: allocation of insufficient size '1' for type 'pkgconf_pkg_t' {aka 'struct pkgconf_pkg_'} with size '360' [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
    ```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not
doing anything wrong.

The only exception there is for argv which I fixed while at it.

Signed-off-by: Sam James <sam@gentoo.org>
2023-11-22 10:06:14 -08:00
Ariadne Conill
752a9825dc queue: demote requires to requires.private when processing requires.private parents
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 07:22:59 +00:00
Ariadne Conill
ee702658cd use PRIu64 format specifiers for some uint64 identifiers in trace logging
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-09-02 21:05:03 -07:00
Ariadne Conill
4fb0988a29 libpkgconf: queue: make the pkgconf_queue_t type public
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-08-11 14:16:41 -07:00
Ariadne Conill
a4eb097b39 queue: process packages in the resolution queue in the correct order 2023-08-04 08:23:00 +00:00
Ariadne Conill
5d0e2f5092 Track packages using a lifetime unique identifier
Use that identifier to cancel graph edges rather than the number of hits,
which biases the earliest edge rather than the latest.
2023-08-04 08:19:42 +00:00
Ariadne Conill
99bc93fbe5 use SIZE_FMT_SPECIFIER everywhere 2023-01-21 20:45:29 +00:00
Ariadne Conill
5044491f43 queue: add function to free a compiled solution 2022-08-16 19:27:35 +00:00
Ariadne Conill
74faf8d0e2 queue: do not enqueue unsolved nodes as part of a solution 2022-08-16 18:38:46 +00:00
Ariadne Conill
5b10a85a82 queue: add pkgconf_queue_solve API 2022-08-08 09:08:27 +00:00
Ariadne Conill
79d25f979d queue: ensure private deps get flattened when --static is requested 2022-08-08 00:58:55 +00:00
Dylan Baker
301d8fa0c6 queue: free unused dependencies when flattening 2022-08-04 15:52:10 -07:00
Dylan Baker
a46ce3672f queue: when collecting dependents don't iterate private twice
Currently, the private field is iterated collecting private deps and
normal deps. It should only be iterated when collecting private deps.
2022-08-04 15:52:10 -07:00
Dylan Baker
e4d1c8ffa5 queue: when flattening do nothing if the flattened deps are empty 2022-08-04 15:52:10 -07:00
Dylan Baker
6609001114 queue: unref dependency in all cases 2022-08-04 15:52:10 -07:00
Dylan Baker
e275594ba6 queue: ensure cleanup happens when applying 2022-08-04 15:52:10 -07:00
Ariadne Conill
fdd7d192e0 queue: fix ISO C conformance for fallthrough label 2022-06-26 18:39:00 +00:00
Ariadne Conill
a1a415111f queue: handle pkgconf_pkg_verify_dependency failure while flattening 2022-06-26 18:09:22 +00:00
Ariadne Conill
9bc6d80e61 queue: push new unresolved dependencies to the front of the queue, rather than the tail 2022-06-26 18:06:04 +00:00
Ariadne Conill
fe4db3aad9 queue: skip dependency collection for root node 2022-06-26 18:04:42 +00:00
Ariadne Conill
5a82a259ac queue: use maxdepth after flattening 2022-06-26 15:17:08 +00:00
Ariadne Conill
a416dc1fd6 queue: advance client serial when walking requires.private for flattening 2022-06-26 15:16:36 +00:00
Ariadne Conill
197fcadd4c queue: add flattening code 2022-06-26 15:02:37 +00:00
William Pitcock
ad65bc4a71 libpkgconf: dependency: allow dependency nodes to be colored with traits 2018-03-18 18:03:33 -05:00
William Pitcock
e0bf4009cb libpkgconf: pkg: rename pkgconf_pkg_t.requires to pkgconf_pkg_t.required (closes #154)
C++20 makes requires a keyword, so we need to not use it in headers.
2017-12-12 00:21:21 -06:00
William Pitcock
e9fd43caa7 libpkgconf: clean up header includes (closes #137) 2017-09-17 23:38:25 -05:00
William Pitcock
5554be4986 libpkgconf: queue: chase API change (mark static root virtual packages as static) 2017-01-22 23:28:51 -06:00
William Pitcock
7b39c38408 libpkgconf: pkg: clean up use of flags variable (ref #105) 2017-01-19 18:17:29 -06:00
William Pitcock
0ca6a16ce5 libpkgconf: queue: nuke flags parameters (ref #105) 2017-01-19 17:32:38 -06:00
William Pitcock
4967c85d49 libpkgconf: document queue module 2016-12-10 23:27:21 -06:00
William Pitcock
c05ecdfc9d libpkgconf: migrate cache to pkgconf_client_t which unfortunately requires it to be non-const :( 2016-12-02 00:29:33 -06:00
William Pitcock
8740c5cd55 libpkgconf: begin removing global state from libpkgconf library by introducing a "client" object which holds the state 2016-12-01 15:05:03 -06:00
William Pitcock
f44f83998c queue: namespace the virtual 'world' package as something that could never actually exist 2016-05-20 02:06:46 -05:00
William Pitcock
06a45f1b62 libpkgconf: clean up PKG_ERRF and PKGF_ defines 2015-09-06 11:45:00 -05:00
William Pitcock
ec5cc3f068 libpkgconf: PKG_PROPF namespace becomes PKGCONF_PKG_PROPF. 2015-09-06 11:37:20 -05:00