cli/main.c


Log

Author Commit Date CI Message
Ariadne Conill ea0e6458 2025-02-18T16:34:18 cli: main: disable graph recursion with --variable This was just a simple logic error. Fixes: 4697d63 ("cli: main: allow use of multiple package names in solution-based queries") Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> Closes: https://github.com/pkgconf/pkgconf/issues/376 Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
Ariadne Conill f0aa4071 2025-02-03T05:33:53 cli: fix warning in solver state debug function Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
Ariadne Conill b861bcad 2025-02-02T02:58:58 cli: solution: denote private dependency nodes in the solution Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
Ariadne Conill 4697d636 2024-10-07T17:06:52 cli: main: allow use of multiple package names in solution-based queries Query types like --print-requires, --print-requires-private and --print-provides can be used in practice to query information about a calculated solution rather than a single package. Allow this to be done where it makes sense to allow it, while continuing to restrict package-specific queries (like --variable= and --variables) to single packages. Fixes: 541de8bd ("main: handle query selectors that are only usable for single packages correctly") Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> Closes: #366
Ariadne Conill 72082a4d 2024-08-06T23:39:46 cli: add PKG_CONFIG_RELOCATE_PATHS environmental variable This is the inverse of PKG_CONFIG_DONT_RELOCATE_PATHS=1. Closes github issue #253.
Ariadne Conill 0ca4e5d0 2024-08-06T10:42:18 cli: allow --env to work with --variable
Ariadne Conill 2070c00d 2024-08-06T10:41:23 cli: stop processing requests after the --env handler runs
Ariadne Conill ca2a0689 2024-08-06T09:23:10 cli: add integration for --print-variables with --env
Ariadne Conill 22866eca 2024-08-05T16:42:05 cli: document --env in usage text
Ariadne Conill b24f3dfd 2024-08-05T16:39:51 cli: implement --exists-cflags support for --env
Ariadne Conill f635f632 2024-08-05T16:29:52 cli: add module definitions before filter check
Ariadne Conill d76aa357 2024-08-05T14:29:53 cli: implement --exists-cflags feature This feature adds autoconf-style -DHAVE_FOO definitions to the --cflags output when it is requested. This has been requested a few times over the years as it allows for simplifying build system logic in scenarios where a standalone Makefile or similar build process is used without a configuration step.
Ariadne Conill a276c0b4 2024-08-05T13:22:05 main: add --exists-cflags command-line option
Taylor R Campbell 633433b2 2024-05-16T21:28:37 Fix uncasted use of isspace() isspace() is intended to be used with an unsigned 8-bit input. Using isspace() with any other type of input is technically undefined behavior.
Kai Pastor e2a8080c 2024-02-23T15:18:08 Reuse static solution for general solution
Kai Pastor 883b57df 2024-02-23T15:18:08 Cache packages from explicit file requests
Kai Pastor 78d53ea0 2024-02-23T15:18:08 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.
Kai Pastor 6219af9a 2024-03-21T23:07:11 Color private-reachable nodes gray
Kai Pastor eaf1a2d8 2024-03-21T22:44:32 Resolve user request for digraph
Kai Pastor f95e8d44 2024-03-18T08:21:17 Print digraph for user request perspective
Kai Pastor db63c8ee 2024-03-18T07:56:37 Show edges for flattened order
Kai Pastor 5825e2c6 2023-12-01T22:12:20 Fix crash on two-word expressions
Kai Pastor b2f8386c 2023-12-01T21:50:46 Fix --modversion output
Ariadne Conill 5f6c5320 2023-10-09T08:05:18 cli: add simple --solution applet for dumping the solver solution
Ariadne Conill 86c43b4e 2023-10-09T07:10:47 cli: --digraph: use directed relationships as part of the visualization Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
Ariadne Conill 4db80314 2023-10-09T07:06:29 cli: --digraph: properly visualize requires.private edges Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
Colin Gillespie dd6a8e3f 2023-09-05T15:36:23 cli: trim trailing whitespace from package arguments Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
Ariadne Conill 97d907ba 2023-10-09T06:35:04 cli: remove strncmp() from modversion comparison Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
Xi Ruoyao 962a5e96 2023-09-07T19:38:01 cli: fix --modversion not showing version with versioned query Fixes #317. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Ariadne Conill 652aff97 2023-10-08T22:27:56 path: add pkgconf_path_prepend API for --with-path 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>
Colin Gillespie 66994f15 2023-08-19T07:57:48 cli: fix --modversion not showing version in various cases 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>
Ariadne Conill f49029c6 2023-08-11T14:19:26 cli: ensure --modversion is output is printed in dependency queue order 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>
Ariadne Conill 5ef2ab8c 2023-08-11T14:09:01 cli: add --verbose parameter Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
Ariadne Conill 95086643 2023-08-11T13:48:02 cli: remove package count restriction from --modversion Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
Ariadne Conill fe69ccc6 2023-08-11T13:41:20 Revert "main: explicitly error with --modversion and more than 1 package being queried" This reverts commit a97b75ab2c1d031982c35a4886102413e4ec8eee.
Ariadne Conill a97b75ab 2023-08-04T08:38:48 main: explicitly error with --modversion and more than 1 package being queried
Ariadne Conill 1e179963 2023-05-02T11:58:39 Enforce maximum package count correctly for --modversion Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
Taylor R Campbell 212c8586 2023-03-17T19:32:58 Avoid undefined behaviour with the ctype(3) functions. 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.
Ariadne Conill 98b33b48 2023-01-21T21:43:08 cli: use flattened solution for almost all user-facing queries
Ariadne Conill 90b65c86 2023-01-21T21:31:16 main: use flattened solution for cflags/libs only
Ariadne Conill e2a12fd4 2023-01-21T20:39:53 main: reset solver when solving for library groups
Ariadne Conill b106de0c 2023-01-21T20:21:26 cli: add whitespace between cflags and libs fragments
Ariadne Conill 5044491f 2022-08-16T19:27:35 queue: add function to free a compiled solution
Ariadne Conill 68b5cab7 2022-08-11T15:06:08 cli: remove redundant SEARCH_PRIVATE block 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.
psykose 74600558 2022-08-11T13:47:32 cli: use Requires.private when cflags are requested
Ariadne Conill 4e449bd4 2022-08-08T09:42:01 cli: do not search requires.private for --libs unless --static
Ariadne Conill 760d1eea 2022-08-08T09:27:39 cli: use pkgconf_queue_solve instead of pkgconf_queue_apply
Ariadne Conill b29f9d87 2022-08-08T00:40:52 cli: do not flatten or traverse the graph when asking for module-specific values
Ariadne Conill d5f9bdae 2022-08-07T04:36:45 cli: add support for dumping SPDX expressions from modules
Ariadne Conill 56881f64 2022-08-07T00:38:38 cli: resolve uninitialized pointer warnings reported by GCC 12
Dylan Baker 4493a322 2022-08-03T16:37:04 main: do cleanup when checking required version
Dylan Baker 38103134 2022-08-03T16:30:59 main: goto cleanup in validate case too This fixes leaks in two tests
Ariadne Conill 6c70781a 2022-07-26T18:00:22 introduce PKG_CONFIG_PKGCONF1_SYSROOT_RULES for legacy pkgconf behavior
Ariadne Conill 11164376 2022-06-26T18:34:22 main: handle --personality load failure
Ariadne Conill 04a6dda7 2022-06-26T18:17:30 main: refactor apply_variable
Dylan Baker f5d6bb71 2022-02-04T16:06:08 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.
Ariadne Conill 41bff109 2021-08-17T14:54:36 cli: ensure the client and cross-personality are cleaned up in all cases
Ariadne Conill f411e7e5 2021-08-17T14:47:10 cli: free package resolution queue unconditionally
Ariadne Conill ce82e36c 2021-08-17T14:39:44 cli: fix memory leak when packages are not provided on the command line
Stone Tickle fa859bb0 2021-06-11T15:01:10 close error_msgout if opened
Stone Tickle dba26000 2021-06-11T15:00:58 deinit personality in cli
Ariadne Conill 599dfcb2 2021-03-18T06:42:57 main: extend copyright notice to 2021
Ariadne Conill fd1b8ccc 2021-03-18T06:22:11 main: if PKG_CONFIG_FDO_SYSROOT_RULES is set, or DESTDIR matches PKG_CONFIG_SYSROOT_DIRS, disable the automatic sysroot rewriting Closes #205.
Ariadne Conill f9531ce9 2021-03-18T05:59:54 add support for pkgconf_cross_personality_t.want_default_pure
Jeff Moguillansky dcf529b8 2021-02-06T10:57:20 cli: add environment variable PKG_CONFIG_DONT_DEFINE_PREFIX On Windows, pkgconf redefines the prefix by default. This gives the user the option to disable this behavior via an environment variable. The benefit of an environment variable is the user can change this behavior when using a build system such as cmake or meson, which may not expose this parameter to the user.
Ariadne Conill 47466470 2020-05-26T10:57:51 main: extend copyright statement to 2020 in --about
Ariadne Conill fce1199b 2020-05-24T14:34:17 cli: add support for PKG_CONFIG_MSVC_SYNTAX env variable Patch from Dan Kegel.
Ariadne Conill 62bbd3b6 2020-01-21T10:32:36 cli: remove --version to --modversion remapping This has been a source of frequent complaints, so we drop it. Resolves: https://todo.sr.ht/~kaniini/pkgconf/6
Ariadne Conill 48dc665a 2019-10-19T00:56:17 personality: add support for WantDefaultStatic setting
Ariadne Conill 40fe4835 2019-10-19T00:45:49 cli: main: add --shared option
Ariadne Conill 5f3aa3a8 2019-07-12T06:53:25 cli: bump copyright notice to 2019
Alexander Tsoy db9c1e96 2019-06-07T19:19:28 fix the order of header includes config.h should be included before stdinc.h, otherwise large file support is not enabled. Downstream bug: https://bugs.gentoo.org/687548
kaniini 7460d287 2019-05-18T00:52:09 Merge branch 'fix-msvc-build' of seungha.yang/pkgconf into master
Seungha Yang 5436558e 2019-05-11T01:15:24 main: Fix build with MSVC Use pkgconf_strndup() since strndup() might be unavailable
William Pitcock 0ba98da2 2019-05-06T15:22:11 lite: remove --simulate
William Pitcock 2d0c1f5c 2019-05-06T15:15:41 lite: disable debug logging
William Pitcock 43ca536b 2019-05-06T15:13:17 lite: disable some bloat
Emil Renner Berthing d926e75b 2019-03-06T16:03:32 main: fix personalities when argv[0] contains path
William Pitcock 8aa66222 2018-05-10T13:37:40 main: deduce the cross-compilation triplet based on program name
William Pitcock c4686829 2018-05-09T22:53:55 cli: implement --personality
William Pitcock e9324ee4 2018-05-09T22:21:45 cli: implement --dump-personality
William Pitcock 6b0e346c 2018-05-09T17:07:26 libpkgconf: refactor building the dir lists into separate concerns
William Pitcock 854490c5 2018-05-09T16:54:21 libpkgconf: add basic support for cross-compile personality objects
William Pitcock 7e9ed692 2018-03-18T18:04:02 libpkgconf: pkg: skip over -I cflags from Requires.internal nodes when building a cflags list
William Pitcock ad65bc4a 2018-03-18T18:01:59 libpkgconf: dependency: allow dependency nodes to be colored with traits
TingPing 60c05f56 2018-03-08T05:00:22 Improve prefix rewriting on Windows (#177) * cli: Default to rewriting prefix on Windows This matches `pkg-config` behavior * libpkgconf: Rewrite the prefix of all variables
William Pitcock 2156a74a 2018-02-28T13:00:53 cli: implement --fragment-filter (closes #167)
William Pitcock 2902141a 2018-02-12T00:42:27 build: move cli tool to cli folder