Fix handling when search returns multiple JSON formatted results
Previously this was returning invalid JSON and needed to be inside a
JSON array and on a single line.
query: do not print empty line for purely multiline formats
Commit 5e8bc8c6c introduced a fallback that prints a line even when
there is no multiline data (e.g., no deps, no shlibs). This was needed
for mixed formats like "%n %L" where the non-multiline part (%n) should
still be displayed even when the multiline part has no data.
However, for purely multiline formats like "%do %dn-%dv", this fallback
produced a spurious " -" line for packages without dependencies. This
broke poudriere's incremental builds: its sanity check parses the output
as origin/pkgname pairs, and the malformed line caused packages to be
incorrectly flagged as corrupted and deleted, cascading into a full
rebuild.
Only trigger the fallback when the format string contains at least one
non-multiline specifier.
libpkg: fix --register-only with empty packages
Currently we end up calling archive_read_next_header() in
populate_config_file_contents() even when there are no files in the
package. This results in the following libarchive error:
pkg: archive_read_next_header(): INTERNAL ERROR: Function
'archive_read_next_header' invoked with archive structure in
state 'eof', should be in state 'header/data'
This commit fixes the error and adds a test to prevent regression.
Sponsored by: The FreeBSD Foundation
libpkg: attempt config file merge for force install
Currently `pkg install -f` always overwrite config files.
This commit changes this behavior to attempt to merge them.
Sponsored by: The FreeBSD Foundation
libpkg: fix --register-only to populate config file contents
Currently `pkg install --register-only` does not acutally populate
config file contents in the pkg database. This leads to config files
potentially getting silently overwritten during upgrade/reinstall.
Sponsored by: The FreeBSD Foundation
tests: add failing test that should pass
pkg install --register-only followed by pkg install -f should
merge config files, but it currently does not.
Fixing this behavior will allow pkgbasify to be simpler and more robust.
Sponsored by: The FreeBSD Foundation
solver: avoid spurious reinstall from wrong repo with multi-repo setups
When the same package version exists in multiple repositories,
select_candidate() could fall through all heuristics (same repo,
max version, max priority) and return the first item in the chain,
which depends on repo config ordering. If that candidate has a
different digest than the installed package, a needless reinstall
was proposed from the wrong repository.
Add a digest-matching fallback in select_candidate(): when all
other heuristics fail and a local package exists, prefer the
remote candidate whose digest matches the installed one.
add: resolve shlibs and provides via symlink directory layout
When pkg add installs a package, it now resolves shlibs_required and
abstract requires by looking up provider packages in a pre-built symlink
directory alongside the package archive:
PACKAGEDIR/
All/pkgname-1.0.pkg
shlibs/libfoo.so.1/provider.pkg -> ../../All/provider-1.0.pkg
provides/vi-editor/vim.pkg -> ../../All/vim-9.0.pkg
Provider selection supports:
- Single provider: used directly
- Alphabetically sorted, the first win
System shlibs and already-installed providers are skipped.
Resolution is disabled for stdin and upgrade modes.
Symlink directory creation is a poudriere/ports concern.