makepkg: allow less than the full fingerprint in validpgpkeys

I found this feature confusing, and the documentation wasn't any help.
It was pointed out to me on IRC that validpgpkeys expects full
fingerprints, and won't accept shorter forms. This makes the
documentation insufficient, and the variable name itself misleading.

This patch bolsters the documentation to explain more about what the
contents should be, and implements suffix matching to allow matching on
shorters fingerprint suffices. Now, when makepkg tells you that a key
ID isn't valid, it's sufficient to manually check the key ID against
the known good ID, and add it as is to validpgpkeys.

Signed-off-by: Allan McRae <allan@archlinux.org>
avoid line wrapping if not in a tty or COLUMNS=0

Scripts that parse pacman's output (like pacsearch) generally do not
want wrapped lines.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
table_display: only check width when non-zero

A width of 0 indicates that either pacman is not attached
to a tty or the user does not want line wrapping.  Either
way pacman should not fall back to the basic display.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
deps.c: split _alpm_depcmp into _alpm_depcmp_provides

This allows to reuse the provision checker for a simple list of
provisions without a package.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_free

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Add --assume-installed option

This allows to ignore specific dependencies.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
remove retry check from signature validation

The retry path was removed by
4ccf16dff589ce9f369d377bb5d3f490bd27c624

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
check_keyring: skip keys known to be missing

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
_alpm_key_in_keychain: cache known keys

Implements FS#38042

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
makepkg: do not strip bzr+ from bzr+ssh urls

bzr does not recognize bare ssh:// urls.

Fixes FS#41811

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
makepkg: only strip vcs prefixes from front of url

Referenced by FS#41811

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
extract_single_file: consolidate needbackup checks

We need to know if a file needs to be backed up for all extracted files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
extract_single_file: reduce indentation

Puts all of the conflict cases at the same level.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
extract_single_file: factor out db file extraction

alpm's database files (.INSTALL, .MTREE, etc.) should be extracted no
matter what; skip mtree/needbackup/noextract/noupgrade checks for them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
extract_single_file: use full path in messages

If an error occurs the actual path being extracted is more useful than
the original path from the package file list.  The original path is
still used for checks that use it directly.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
remove support for .pacorig files

Leave user files in place and save new config files with a .pacnew
extension.  This reduces the complexity of file extraction and respects
the principle that pacman shouldn't modify files it didn't create.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
extract_single_file: use .pacnew for check files

Prevents the need to rename the file if we end up keeping it and ensures
that pacnew files always reflect the most recent version by overwriting
stale copies.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
extract_single_file: consolidate extraction logic

Also adds checks that the filename does not exceed PATH_MAX.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>