Commit Graph

74 Commits (master)

Author SHA1 Message Date
Kai Pastor e2a8080cbf Reuse static solution for general solution 2024-03-27 11:15:04 -07:00
Kai Pastor 883b57df47 Cache packages from explicit file requests 2024-03-27 11:15:04 -07: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 6219af9a0a Color private-reachable nodes gray 2024-03-27 11:06:30 -07:00
Kai Pastor eaf1a2d804 Resolve user request for digraph 2024-03-27 11:06:30 -07:00
Kai Pastor f95e8d4428 Print digraph for user request perspective 2024-03-27 11:06:30 -07:00
Kai Pastor db63c8ee0b Show edges for flattened order 2024-03-27 11:06:30 -07:00
Kai Pastor 5825e2c6d6 Fix crash on two-word expressions
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-12-05 10:50:18 -07:00
Kai Pastor b2f8386c32 Fix --modversion output 2023-12-05 10:50:18 -07:00
Ariadne Conill 5f6c5320e5 cli: add simple --solution applet for dumping the solver solution
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-11-22 18:13:18 +00:00
Ariadne Conill 86c43b4e3d cli: --digraph: use directed relationships as part of the visualization
ci/woodpecker/push/woodpecker Pipeline failed Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 07:10:47 +00:00
Ariadne Conill 4db8031402 cli: --digraph: properly visualize requires.private edges
ci/woodpecker/push/woodpecker Pipeline failed Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 07:06:29 +00:00
Colin Gillespie dd6a8e3fc7 cli: trim trailing whitespace from package arguments
ci/woodpecker/push/woodpecker Pipeline was successful Details
Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
2023-10-09 06:36:47 +00:00
Ariadne Conill 97d907ba93 cli: remove strncmp() from modversion comparison
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 06:35:26 +00:00
Xi Ruoyao 962a5e96b7 cli: fix --modversion not showing version with versioned query
ci/woodpecker/push/woodpecker Pipeline failed Details
Fixes #317.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2023-10-08 22:47:51 +00:00
Ariadne Conill 652aff9790 path: add pkgconf_path_prepend API for --with-path
ci/woodpecker/push/woodpecker Pipeline was successful Details
Otherwise, PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR elements would be processed backwards.

Fixes: 384ade5 (path: prepend paths rather than append paths when processing --with-path arguments)
Closes: #250
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-08 22:27:56 +00:00
Colin Gillespie 66994f1533 cli: fix --modversion not showing version in various cases
ci/woodpecker/push/woodpecker Pipeline was successful Details
There are numerous edge cases where version is wrong or missing when
matching the dependency queue to resolved packages. This adds the
dependency name as it appears in the dependency queue to each package as
it is resolved, allowing for a simple and correct comparison when
printing.

Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
2023-09-02 20:57:46 -07:00
Ariadne Conill f49029c681 cli: ensure --modversion is output is printed in dependency queue order
ci/woodpecker/push/woodpecker Pipeline was successful Details
Previously, --modversion operated on the calculated solution and printed versions in
order of the calculated dependency graph.  Change this to use the dependency queue
instead, looking up nodes in the dependency graph as needed, to ensure that the
--modversion output behaves as intended.

Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-08-11 14:19:26 -07:00
Ariadne Conill 5ef2ab8c7c cli: add --verbose parameter
ci/woodpecker/push/woodpecker Pipeline was successful Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-08-11 14:09:01 -07:00
Ariadne Conill 95086643fa cli: remove package count restriction from --modversion
ci/woodpecker/push/woodpecker Pipeline was successful Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-08-11 13:48:02 -07:00
Ariadne Conill fe69ccc6b9 Revert "main: explicitly error with --modversion and more than 1 package being queried"
This reverts commit a97b75ab2c.
2023-08-11 13:41:20 -07:00
Ariadne Conill a97b75ab2c main: explicitly error with --modversion and more than 1 package being queried 2023-08-04 08:38:48 +00:00
Ariadne Conill 1e179963d4 Enforce maximum package count correctly for --modversion
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-05-02 11:58:39 -07:00
Taylor R Campbell 212c85863a Avoid undefined behaviour with the ctype(3) functions.
ci/woodpecker/push/woodpecker Pipeline was successful Details
fix https://github.com/pkgconf/pkgconf/issues/291

As defined in the C standard:

        In all cases the argument is an int, the value of which shall
        be representable as an unsigned char or shall equal the value
        of the macro EOF.  If the argument has any other value, the
        behavior is undefined.

This is because they're designed to work with the int values returned
by getc or fgetc; they need extra work to handle a char value.

If EOF is -1 (as it almost always is), with 8-bit bytes, the allowed
inputs to the ctype(3) functions are:

        {-1, 0, 1, 2, 3, ..., 255}.

However, on platforms where char is signed, such as x86 with the
usual ABI, code like

        char *ptr = ...;
        ... isspace(*ptr) ...

may pass in values in the range:

        {-128, -127, -126, ..., -2, -1, 0, 1, ..., 127}.

This has two problems:

1. Inputs in the set {-128, -127, -126, ..., -2} are forbidden.

2. The non-EOF byte 0xff is conflated with the value EOF = -1, so
   even though the input is not forbidden, it may give the wrong
   answer.

Casting char to unsigned int first before passing the result to
ctype(3) doesn't help: inputs like -128 are unchanged by this cast,
because (on a two's-complement machine with 32-bit int and unsigned
int), converting the signed char with integer value -128 to unsigned
int gives integer value 2^32 - 128 = 0xffffff80, which is out of
range, and which is converted in int back to -128, which is also out
of range.

It is necessary to cast char inputs to unsigned char first; you can
then cast to unsigned int if you like but there's no need because the
functions will always convert the argument to int by definition.  So
the above fragment needs to be:

        char *ptr = ...;
        ... isspace((unsigned char)*ptr) ...

This patch changes unsigned int casts to unsigned char casts, and
adds unsigned char casts where they are missing.
2023-05-02 11:43:56 -07:00
Ariadne Conill 98b33b48cd cli: use flattened solution for almost all user-facing queries 2023-01-21 21:43:08 +00:00
Ariadne Conill 90b65c866b main: use flattened solution for cflags/libs only 2023-01-21 21:31:16 +00:00
Ariadne Conill e2a12fd4c2 main: reset solver when solving for library groups
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-01-21 20:39:53 +00:00
Ariadne Conill b106de0c7a cli: add whitespace between cflags and libs fragments 2023-01-21 20:21:26 +00:00
Ariadne Conill 5044491f43 queue: add function to free a compiled solution
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-08-16 19:27:35 +00:00
Ariadne Conill 68b5cab72d cli: remove redundant SEARCH_PRIVATE block
ci/woodpecker/push/woodpecker Pipeline was successful Details
It turns out there was already a check for PKG_CFLAGS being requested,
but the check was busted because PKG_CFLAGS is a combined-or of all of
the various --cflags flags.

Check that PKG_CFLAGS bits are set at all on want_flags instead.
2022-08-11 15:06:08 +00:00
psykose 746005582f
cli: use Requires.private when cflags are requested
ci/woodpecker/pr/woodpecker Pipeline was successful Details
2022-08-11 15:47:32 +02:00
Ariadne Conill 4e449bd45f cli: do not search requires.private for --libs unless --static 2022-08-08 09:42:01 +00:00
Ariadne Conill 760d1eea10 cli: use pkgconf_queue_solve instead of pkgconf_queue_apply 2022-08-08 09:27:39 +00:00
Ariadne Conill b29f9d8713 cli: do not flatten or traverse the graph when asking for module-specific values
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-08-08 00:40:52 +00:00
Ariadne Conill d5f9bdae57 cli: add support for dumping SPDX expressions from modules 2022-08-07 04:40:19 +00:00
Ariadne Conill 56881f64f0 cli: resolve uninitialized pointer warnings reported by GCC 12
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-08-07 00:38:38 +00:00
Dylan Baker 4493a322f6 main: do cleanup when checking required version 2022-08-04 15:52:10 -07:00
Dylan Baker 38103134a5 main: goto cleanup in validate case too
This fixes leaks in two tests
2022-08-04 15:52:10 -07:00
Ariadne Conill 6c70781aad introduce PKG_CONFIG_PKGCONF1_SYSROOT_RULES for legacy pkgconf behavior 2022-07-26 18:00:22 +00:00
Ariadne Conill 11164376f7 main: handle --personality load failure
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-06-26 18:34:22 +00:00
Ariadne Conill 04a6dda79f main: refactor apply_variable 2022-06-26 18:17:30 +00:00
Dylan Baker f5d6bb71f8 libpkgconf: remove const modifier from error_handler data pointer
Currently, the data pointer is `const void *`, which means that the
handler can't modify the data without casting away the constness.
2022-02-07 09:34:09 -08:00
Ariadne Conill 41bff10998 cli: ensure the client and cross-personality are cleaned up in all cases 2021-08-17 14:54:36 -06:00
Ariadne Conill f411e7e55b cli: free package resolution queue unconditionally 2021-08-17 14:47:10 -06:00
Ariadne Conill ce82e36c14 cli: fix memory leak when packages are not provided on the command line 2021-08-17 14:39:44 -06:00
Stone Tickle fa859bb045 close error_msgout if opened 2021-07-24 06:08:25 -05:00
Stone Tickle dba2600014 deinit personality in cli 2021-07-24 06:08:25 -05:00
Ariadne Conill 599dfcb264 main: extend copyright notice to 2021 2021-03-18 06:42:57 -06:00
Ariadne Conill fd1b8ccca6 main: if PKG_CONFIG_FDO_SYSROOT_RULES is set, or DESTDIR matches PKG_CONFIG_SYSROOT_DIRS, disable the automatic sysroot rewriting
Closes #205.
2021-03-18 06:22:11 -06:00
Ariadne Conill f9531ce9fe add support for pkgconf_cross_personality_t.want_default_pure 2021-03-18 06:02:00 -06:00