Revert pkg-query %a and %k back to an integer

Scripts such as portmaster and portupgrade expect an integer
here. This is also the advertised result in the manpage.
Fix manpage nits found by igor
Use proper origin in 'no packages matching' warning when missing from remote
update: Fix signing verification with digests/packagesite

This updates repo_archive_extract_file() to always write
the extracted file if 'dest' is set, regardless of dest_fd.

The problem was that digests was extracted directly to a fd
but never extracted to a file for rsa_verify() and sha256_file()
to use.

rsa_verify() and sha256_file() could be improved to read from
a fd instead.
Do not abort if cannot open repository sql db.

Do not pass NULL pointer to sqlite transaction rollback code
if a database has not been successfully opened (due to insufficient
permissions for example).
On Dragonfly sbuf_finish() does not return a int
Dragonfly does not have the O_TTY_INIT flag