162 Commits

Author SHA1 Message Date
Ariadne Conill
4a49b50e3b cli: constify required module version params
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2026-01-18 21:28:47 -08:00
Ariadne Conill
b1dd65e45d cli: core: rewrite query nodes instead of separately checking for --required-module-version
This allows us to let the solver deal with it, removing a duplicate
code path.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2026-01-18 19:55:02 -08:00
Ariadne Conill
b8d8a5c8fd tests: harness: wire up WantEnvPrefix setting
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-29 15:24:22 -08:00
Ariadne Conill
ecbedee413 cli: core: do not assume argv list is NULL terminated
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-29 15:03:25 -08:00
Ariadne Conill
521bb4e6e8 cli: core: use pkgconf_buffer_str_or_empty when setting builtin variables
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-27 15:13:08 -08:00
Ariadne Conill
a0933c8b1b cli: core: use pkgconf_output_puts for stderr messages
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 21:06:04 -08:00
Ariadne Conill
dfd20e49fc cli: core: move dump_personality back
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 20:51:22 -08:00
Ariadne Conill
ff07f6b7eb cli: core: refactor dependency query parsing 2025-12-24 20:48:05 -08:00
Ariadne Conill
98784f1d42 libpkgconf: add cross personality pointer to client struct
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 16:05:17 -08:00
Ariadne Conill
fd604729c4 cli: core: use pkgconf_client_getenv wrapper for mocking
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 15:48:06 -08:00
Ariadne Conill
eab5f5da93 cli: chase pkgconf_client_init changes
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 15:35:09 -08:00
Ariadne Conill
a592567215 cli: core: only zero out the end of the package name if actually necessary
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 15:22:12 -08:00
Ariadne Conill
1cbe6de04f cli: core: use last_argc everywhere instead of pkg_optind
This way the test runner does not use getopt_long.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-24 15:18:54 -08:00
Ariadne Conill
8459b05bbf cli: refactor main for testing purposes
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-23 16:46:39 -08:00
Ariadne Conill
c7069a080b cli: {bomtool,spdxtool}: chase pkgconf_client_init change 2025-12-23 16:35:11 -08:00
Ariadne Conill
41d320f679 cli: cleanups from output refactoring
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-23 15:01:32 -08:00
Ariadne Conill
6682bcb78d cli: use pkgconf_output_putbuf for printing CFLAGS
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-23 14:58:05 -08:00
Ariadne Conill
53db712972 cli: use pkgconf_output_fmt in most places
This way the C testsuite will be able to capture output as appropriate.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-23 14:51:56 -08:00
Ariadne Conill
be9f756e3d cli: include synthesized virtuals (from provides) in --list-all and --list-package-names output
Closes: https://github.com/pkgconf/pkgconf/issues/435
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-23 10:29:13 -08:00
Ariadne Conill
0ed38cec79 libpkgconf: introduce PKGCONF_PKG_PKGF_REQUIRE_INTERNAL flag
Ref: https://github.com/pkgconf/pkgconf/issues/434
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-21 13:06:07 -08:00
Ariadne Conill
a32da62aa7 spdxtool: util: clean up strftime buffer usage
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 23:46:04 -08:00
Ariadne Conill
36ac187ad5 spdxtool: util: manually specify ISO8601 format string elements instead of %F and %Z
These do not work on the Microsoft C runtime library.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 23:40:53 -08:00
Ariadne Conill
0fc3ba9d95 spdxtool: drop spdxtool_util_spdx_id_add
Not needed or used by anything.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 16:03:21 -08:00
Ariadne Conill
c863ef3f82 libpkgconf: clean up _WIN32 include mess quite a bit
Ref: https://github.com/pkgconf/pkgconf/issues/406
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 15:25:17 -08:00
Ariadne Conill
9590e052bb spdxtool: use SIZE_FMT_SPECIFIER in numeric URI generator
This resolves a compiler warning when building on Windows.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 13:44:38 -08:00
Ariadne Conill
b689fedcd9 spdxtool: fix isspace usage
ISO C expects parameters to ctype.h macros to be unsigned.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 13:32:42 -08:00
Ariadne Conill
008f963693 spdxtool: util: use a static counter instead of looping over possible IDs
Looping over possible IDs makes generating URIs an O(k) operation,
verses an O(1) operation.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 01:34:02 -08:00
Ariadne Conill
018983a78f spdxtool: serialize: fix docstrings
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 01:20:39 -08:00
Ariadne Conill
4e2fde48f6 spdxtool: serialize: further refactoring
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 01:12:47 -08:00
Ariadne Conill
e2ae592b89 spdxtool: serialize: clean up spdxtool_serialize_add_ch_with_comma
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 00:47:50 -08:00
Ariadne Conill
ecd1a20915 spdxtool: serialize: light refactoring using new pkgconf_buffer_t functions
Also drop spdxtool_serialize_add_string_with_comma because it is no longer
needed.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 00:39:12 -08:00
Ariadne Conill
3a24e69a8f spdxtool: use pkgconf_buffer_t functions to generate URIs
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 00:37:35 -08:00
Ariadne Conill
741ee356b9 cli: declare logging FILE pointers as static
Found using sparse.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-20 00:00:41 -08:00
Ariadne Conill
1d9142c4c7 cli: use pkgconf_fragment_render_buf for rendering fragments
This is an improvement for memory safety as the underlying memory
reference ownership is clearer.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-07 20:59:06 -08:00
Ariadne Conill
8bae84d6a4 libpkgconf: fragment: rework fragment API to use pkgconf_buffer_t
This improves the memory safety of internal pkgconf APIs by
using Pascal-style strings (pkgconf_buffer_t).

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-07 20:41:46 -08:00
Ariadne Conill
90f9186e10 cli: use a single fragment list for all collected CFLAGS and linker flags
This cleans up --cflags and --libs handling a bit, making the code less
repetitive.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 14:01:55 -08:00
Ariadne Conill
467328ec8b cli: fix --newlines with both --cflags and --libs
In the future we should collapse this down to a single fragment list...

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 13:44:51 -08:00
Ariadne Conill
5d6c90faaf cli: add --newlines option
Closes: https://github.com/pkgconf/pkgconf/issues/412
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 13:39:35 -08:00
Ariadne Conill
f3aac2724a cli: properly align --source and --license-file options
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 13:29:21 -08:00
Ariadne Conill
42b6a6a04c libpkgconf: fragment: allow user to specify inter-fragment delimiter
Ref: https://github.com/pkgconf/pkgconf/issues/412
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 13:27:51 -08:00
Ariadne Conill
e0b3ca8330 cli: fix memory leak with --dump-personality
Previously, we would call dump_personality() and immediately exit.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 13:15:56 -08:00
Ariadne Conill
98d0b9342e cli: make --dump-personality output consistent with pkgconf-personality(5)
Previously, --dump-personality used whitespace to separate the path list, while the
specification requires a colon as the separator.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 11:37:38 -08:00
Ariadne Conill
e1e788c8cc cli: rework dump_personality to use pkgconf buffers
We already had a helper function, path_list_to_buffer, which we can re-use to
avoid repeatitive code.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 01:00:17 -08:00
Ariadne Conill
2bfd36beb4 cli: dynamically generate built-in paths from selected pkgconf personality
Previously pkgconf would dump the hardcoded defaults, even if they had been changed
by the use of a pkgconf personality.

Now the data in the pkgconf personality is used to register the built-in package data.

Fixes: https://github.com/pkgconf/pkgconf/issues/418
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 00:54:03 -08:00
Ariadne Conill
0fb2ce907b spdxtool: remove errant uses of pkgconf_buffer_trim_byte
This was a workaround for a pkgconf_buffer bug which was fixed in
commit 75b57db56291a28eed881a9ad48742713a7c635b.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 00:50:33 -08:00
Ariadne Conill
ef935a6349 cli: register built-in packages for pkg-config and pkgconf
The variable data will eventually be dynamically generated instead of just using
hardcoded data.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-01 23:58:52 -08:00
Ariadne Conill
c598ef7218 spdxtool: use software_sbomType instead of sbomType
sbomType is not in the SPDX 3.0.1 vocabulary.
2025-11-01 23:56:00 -07:00
Ariadne Conill
bbe8ab6593 spdxtool: do not serialize missing license-related document elements
If a .pc file without licensing information was processed, we would get nodes like
pkgconf:(null), which is undesirable.
2025-11-01 15:54:15 -07:00
Tuukka Pasanen
f0826ce2d2 Add SPDX Lite profile 3.0 generator
Add SPDX Lite profile 3.0 generator named
spdxtool to pkdconf. It outputs JSON-LD RDF
tree and does only depend pkgconf and pkgconf
.pc file to generate SBOM.

It superseeds bomtool which is SPDX 2.x generator
name bomtool. But as SPDX version 2.x is still widely
used new tool was created instead of upgrading old one.
2025-11-01 15:31:55 -07:00
Tuukka Pasanen
589d8028c4 cli: Add License.file-tag to cli
Add License.file-tag printing to cli.
2025-11-01 15:21:32 -07:00