pkgng/pkgng 34da047 — . NEWS, libpkg/repo/binary update.c

repo: keep the catalogue when an update fails

pkg_repo_binary_update() removed the repository database whenever an
update failed, including when the failure happened before the database
was touched (e.g. the network dropped while fetching the catalogue) or
after the previous database had been restored by
pkg_repo_binary_update_proceed().  Any transient failure therefore threw
away a usable catalogue, and the following commands failed with
"Repository X cannot be opened. 'pkg update' required" until the next
successful update.

Only remove the database when it cannot be opened anymore, so a failed
update keeps the previous catalogue while the next update can still
start fresh from an unusable one.

Fixes:  #2763
DeltaFile
+44-1tests/frontend/update.sh
+13-3libpkg/repo/binary/update.c
+1-0NEWS
+58-43 files

pkgng/pkgng fcbe58e — . NEWS

NEWS: Fix and complete NEWS entries post 2.8.99.1
DeltaFile
+26-10NEWS
+26-101 files

pkgng/pkgng f000d41 — libpkg pkg_jobs_schedule.c, libpkg/private pkg_jobs.h

scheduler: take provides/requires into account when ordering jobs

Shared libraries and named provides are resolved through the provides/requires
tables and are not listed in the regular dependencies, so they were
ignored when ordering jobs.  Order a package providing a shared library
or a named provide before the packages requiring it, so that for example
libc (FreeBSD-clibs) is installed before the programs using it.

The install graph can be cyclic: FreeBSD-runtime provides libraries
required by FreeBSD-libarchive and in turn requires a library provided by
it.  Such a cycle cannot be broken by splitting upgrade jobs, so the
strongly connected components of the install graph are computed with
Tarjan's algorithm and the jobs of a component are scheduled as a single
block, so that jobs depending on only one member of the component are
never interleaved between its members.

Add frontend tests covering both the shared library and the named provide
mechanisms.
DeltaFile
+259-61libpkg/pkg_jobs_schedule.c
+175-0tests/frontend/scheduling.sh
+2-0libpkg/private/pkg_jobs.h
+1-0tests/Makefile.in
+437-614 files

pkgng/pkgng f45e50b — tests/frontend test_environment.sh.in

tests: fix the expected FreeBSD_version of the loongarch64 binary
DeltaFile
+1-1tests/frontend/test_environment.sh.in
+1-11 files

pkgng/pkgng 49101c3 — . NEWS, docs pkg-checksum.8 pkg_checksum.3

checksum: document and test the sha512 types
DeltaFile
+33-0tests/lib/checksum.c
+9-1docs/pkg_checksum.3
+3-2src/checksum.c
+4-0docs/pkg-checksum.8
+1-0NEWS
+50-35 files

pkgng/pkgng 5a82a4b — . NEWS, libpkg pkg_checksum.c

checksum: fix the package digest buffer size

pkg_checksum_generate() prepends a "<version>$<type>$" prefix that
pkg_checksum_type_size() does not account for, so the *_hex types kept
the prefix and lost the digest.  Size the buffer with the new
pkg_checksum_string_size().
DeltaFile
+33-17tests/lib/checksum.c
+19-2libpkg/pkg_checksum.c
+1-0libpkg/private/pkg.h
+1-0NEWS
+54-194 files

pkgng/pkgng f8bc2c0 — docs pkg-checksum.8 pkg_checksum.3, libpkg pkg_checksum.c

checksum: add a standard z-base-32 encoding

The *_base32 types use a pkg-specific bit order, they are not z-base-32.
Keep them for compatibility and add the *_zbase32 types using a
standards-compliant encoder, plus blake2/s_hex variants.

Fixes:  #2759
DeltaFile
+97-0tests/lib/checksum.c
+87-6libpkg/pkg_checksum.c
+35-5docs/pkg_checksum.3
+22-5docs/pkg-checksum.8
+15-0libpkg/pkg/checksum.h
+3-2src/checksum.c
+259-182 files not shown
+261-198 files

pkgng/pkgng c9b03b4 — external/libecc/include/libecc/words words.h, libpkg pkg_abi.c pkg_elf.c

libpkg: recognize loongarch64 as loongarch:64

Add PKG_ARCH_LOONGARCH64 and map EM_LOONGARCH/ELFCLASS64 to it; no
32-bit ABI exists.  Test it in the frontend suite.

external/libecc: add __loongarch__ to words.h.  Upstream, from
https://github.com/libecc/libecc/pull/15/.
DeltaFile
+8-2tests/frontend/abi.sh
+6-0tests/frontend/test_environment.sh.in
+6-0libpkg/pkg_elf.c
+2-1external/libecc/include/libecc/words/words.h
+3-0libpkg/pkg_abi.c
+1-1tests/frontend/create-parsebin.sh
+26-46 files not shown
+31-412 files

pkgng/pkgng fc7fc8d — libpkg pkg_checksum.c, libpkg/pkg checksum.h

Add sha512 support to pkg_checksum implementation.

This uses the sha512 implementation from the embedded libecc library.
DeltaFile
+82-0libpkg/pkg_checksum.c
+3-0libpkg/pkg/checksum.h
+85-02 files

pkgng/pkgng cd0a561 — libpkg pkg.c

pkg: minor fixes to the vec iterators

Clear the caller"s pointer when the list is empty, as the previous
implementation did, and declare the index before the statements.
DeltaFile
+5-3libpkg/pkg.c
+5-31 files

pkgng/pkgng 9b6034d — libpkg pkg.c, libpkg/private pkg.h

Remove '*_iter' introduced when conversion to vec was made.
This restores behavior that doesn't mutate shared state and allows
concurrent iteration.
DeltaFile
+26-99libpkg/pkg.c
+0-6libpkg/private/pkg.h
+26-1052 files

pkgng/pkgng a0e4424 — libpkg pkg_jobs_universe.c

universe: free the request dropped from the upgrade chains
DeltaFile
+1-0libpkg/pkg_jobs_universe.c
+1-01 files

pkgng/pkgng 884f6e0 — libpkg pkg_jobs_universe.c

universe: free the packages leaked on error paths

Factor that freeing into free_rpkgs() and use it on every exit.
DeltaFile
+18-16libpkg/pkg_jobs_universe.c
+18-161 files

pkgng/pkgng b68d62c — tests/frontend clean.sh

test: give up on macos
DeltaFile
+1-0tests/frontend/clean.sh
+1-01 files

pkgng/pkgng df4d44d — libpkg pkg_jobs_universe.c

universe: plug a leak when a dependency is up to date
DeltaFile
+4-1libpkg/pkg_jobs_universe.c
+4-11 files

pkgng/pkgng 7f276b4 — libpkg pkg_repo_create.c

repo: simplify how the Hashed directory is created

Reuse tmp_name (which already holds the package directory) and append
"/" PKG_HASH_DIR with strlcat() instead of formatting it into a
dedicated buffer.

This is an attempt to fix crash on macos
DeltaFile
+4-10libpkg/pkg_repo_create.c
+4-101 files

pkgng/pkgng fe01d8e — external/picosat picosat.c

picosat: guard NULL starts in fix_impl_lits

Reported by UBSAN on ubuntu
DeltaFile
+1-1external/picosat/picosat.c
+1-11 files

pkgng/pkgng 22c4ef7 — libpkg pkg_solve.c

solve: plug a leak of the solver assumptions
DeltaFile
+4-4libpkg/pkg_solve.c
+4-41 files

pkgng/pkgng 652172b — tests/frontend http.sh

tests: do not fail http cleanup without a server

The http tests start a python http server and kill it from their
cleanup.  When the body is skipped (python3 is missing) no server was
ever started and httpd_cleanup() returned 1, which made atf report the
test as broken instead of skipped.
DeltaFile
+1-1tests/frontend/http.sh
+1-11 files

pkgng/pkgng 002765d — libpkg pkg_repo_create.c

repo: fix a hang with hashed repositories

hash_file() built the Hashed directory with
        snprintf(tmp_name, sizeof(tmp_name), "%s/%s", rel_dir, PKG_HASH_DIR);
where rel_dir points at tmp_name itself: passing the destination of
snprintf(3) as one of its inputs is undefined.  glibc and musl produce
"/Hashed" instead of "<dir>/Hashed", so pkg_mkdirs() creates the wrong
directory and the rename(2) that follows fails with ENOENT.

The failing worker then left pkg_create_repo_thread() without
incrementing ntask nor signalling cond, so the main thread waited
forever in pthread_cond_wait(): "pkg repo" hung on every platform but
FreeBSD, whose libc happened to produce the expected string.

Use a dedicated buffer and signal the main thread before bailing out.
DeltaFile
+27-8libpkg/pkg_repo_create.c
+27-81 files

pkgng/pkgng e03fa7e — tests/frontend clean.sh

clean: make the keep_installed_archive test reliable

A file rebuilt within the same second keeps the same mtime, and the
file:// fetcher then answers EPKG_UPTODATE: the cached catalogue is left
unchanged and pkg clean keeps the archive of the removed package.

Wait a second before rebuilding the repository so that the new catalogue
is newer than the cached one.
DeltaFile
+6-1tests/frontend/clean.sh
+6-11 files

pkgng/pkgng c8910ce — tests/frontend http.sh

fetch: test the nominal 304 up to date path

Add a test where the server honours If-Modified-Since and answers 304,
checking that pkg reports the catalogue as up to date and that the
server really answered 304, next to the test covering servers that
always answer 200.
DeltaFile
+56-2tests/frontend/http.sh
+56-21 files

pkgng/pkgng 95025a5 — libpkg fetch_libfetch.c, tests/frontend http.sh

fetch: detect up to date responses without a 304

The libfetch fetcher returned EPKG_UPTODATE only when the server
answered 304 Not Modified.  A server answering 200 to a conditional
request made pkg download the repository catalogue again on every
update (issue #2742).

Compare the mtime of the response with the one sent in
If-Modified-Since and return EPKG_UPTODATE when it did not change,
like the file:// fetcher already does.
DeltaFile
+70-2tests/frontend/http.sh
+18-1libpkg/fetch_libfetch.c
+88-32 files

pkgng/pkgng 1f5169b — libpkg metalog.c

metalog: give each escaped field its own buffer

metalog_escape_path() returned a single static buffer, so escaping the
path and the link target relied on the argument evaluation order and was
not reentrant.  Let the caller provide the buffer and write the link
entry with a single fprintf.
DeltaFile
+18-13libpkg/metalog.c
+18-131 files

pkgng/pkgng 229213e — . NEWS, docs pkg-upgrade.8

install|upgrade: confirm the removal of explicit packages

Recall how many packages will be removed in the confirmation prompt, and ask
for an extra confirmation when some were installed explicitly.
DeltaFile
+74-2src/utils.c
+44-3tests/frontend/upgrade.sh
+9-0docs/pkg-upgrade.8
+1-2src/upgrade.c
+1-2src/install.c
+1-0NEWS
+130-91 files not shown
+131-97 files

pkgng/pkgng ff20ba5 — libpkg pkg_delete.c pkgdb.c, libpkg/private pkgdb.h

pkgdb: add pkg_attr and keep installed archives

pkg_attr holds extended package attributes.  Unlike pkg_local it is tied
to the installed instance: purged on upgrade and on uninstall.

Record the archive a package is installed from in pkg_attr so that pkg
clean keeps it until the package is uninstalled, without a schema change.
DeltaFile
+150-39libpkg/pkgdb.c
+91-1tests/frontend/clean.sh
+74-16src/clean.c
+53-0tests/lib/pkgdb_local.c
+18-3libpkg/private/pkgdb.h
+8-0libpkg/pkg_delete.c
+394-594 files not shown
+409-5910 files

pkgng/pkgng 3b9ffec — libpkg pkg.h.in pkgdb.c, libpkg/private pkgdb.h

pkgdb: add a local package attributes store

pkg_local holds local (user) attributes of installed packages.  It is
created on demand and kept out of the versioned schema, so that
introducing a new local attribute never requires a migration.  It is
keyed by package name so that local state survives upgrades.
DeltaFile
+113-0libpkg/pkgdb.c
+77-0tests/lib/pkgdb_local.c
+5-0libpkg/pkg.h.in
+3-0tests/Makefile.in
+3-0libpkg/private/pkgdb.h
+201-05 files

pkgng/pkgng 0f9f1bc — . NEWS, libpkg pkg_solve.c

solve: hold upgrades back instead of removing explicit packages

When the solver cannot satisfy the problem, it used to pick the last
failed assumption and negate it, which is both arbitrary (it depends on
the order in which the packages are processed) and often unnecessary: a
package the user installed explicitly ended up removed only because an
upgrade of a dependency had been asked for.

Rank the assumptions instead:
1/ explicit requests
2/ explicit removals
3/ keeping a package that was installed explicitly
4/ then upgrading such a package,
5/ finally upgrades other packages.

When the problem is unsatisfiable, give up the least important assumptions
and try again.
Forcing (-f) remains the escape hatch and the old behaviour is kept when
nothing can be given up.

    [5 lines not shown]
DeltaFile
+353-16libpkg/pkg_solve.c
+94-47tests/frontend/upgrade.sh
+1-1tests/frontend/conflicts.sh
+1-0NEWS
+449-644 files

pkgng/pkgng 2514c9e — docs pkg-upgrade.8 pkg-install.8, libpkg pkg_jobs.c

install|upgrade: add -N/--no-remove and NEVER_REMOVE

install or upgrade sometimes has to remove installed packages that were
not requested for removal. -N/--no-remove, and the NEVER_REMOVE
configuration option, refuse those
removals.
DeltaFile
+116-1tests/frontend/upgrade.sh
+55-0libpkg/pkg_jobs.c
+17-0docs/pkg.conf.5
+13-2docs/pkg-upgrade.8
+13-2docs/pkg-install.8
+6-2src/install.c
+220-75 files not shown
+236-1011 files

pkgng/pkgng ba9f63b — docs pkg-set.8, libpkg pkg_jobs.c pkgdb.c

pkg set: make the vital flag a local user override
DeltaFile
+78-1tests/frontend/vital.sh
+36-0libpkg/pkgdb.c
+9-2src/set.c
+4-4libpkg/pkg_jobs.c
+8-0libpkg/private/pkg.h
+4-1docs/pkg-set.8
+139-85 files not shown
+150-1111 files