Revert "Remove log_cb, add ALPM_EVENT_LOG instead"

Moving logging to the event callback caused warnings
under clang due to non-literal format strings and
silenced all log messages when --print was used.

This reverts commit cd793c5ab7689cc8cbc18277375b368060e5acfe.

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

Conflicts:
	lib/libalpm/alpm.h
	src/pacman/callback.c
Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: break out check_checksums to reasonably sized functions
makepkg: break out checksum generation to its own function

This also fixes a "bug" in which a PKGBUILD without any source array
would generate "md5sums=()". While not technically wrong, we can easily
do better and emit nothing at all.
PKGBUILD: add support for arch-specific sources

This implements support for declarations such as:

  arch=('i686' 'x86_64')
  ...

  source=("somescript.sh")
  source_i686=("http://evilmonster.com/i686/ponies-9001-1.i686.bin")
  source_x86_64=("http://evilmonster.com/i686/ponies-9001-1.x86_64.bin")

  md5sums=('d41d8cd98f00b204e9800998ecf8427e')
  md5sums_i686=('e4ca381035a34b7a852184cc0dd89baa')
  md5sums_x86_64=('4019740e6998f30a3c534bac6a83f582')

Just the same as the "untagged" sources, multiple integrity algorithms
are supported. The manpage is updated to reflect support for these
suffices.

This commit also refactors download_sources slightly:

1) to use the otherwise preferred convention of lowercase local variable
names, and to make the handling of $1 more clear.
2) rename the "fast" parameter to "novcs", to make it more clear what
this token does.
3) add a new possible token "allarch" to ensure that download_sources
will fetch all sources, for all architectures.
updpkgsums: update to recognize arch-specific sources

This change reveals a bootstrapping bug -- since we call the bare
"makepkg" and rely on PATH lookup, we might not have a makepkg which
can generate architecture-specific checksums.
makepkg: abort if we can't add install/changelog to package
paccache: parse_filename bug fix

Filenames got parsed wrongly, causing whitelist- and blacklist-checks to
always return false. Caused by 8122fae51a when full path names to pkgs
were introduced.

Signed-off-by: Maxim Andersson <thesilentboatman@gmail.com>
makepkg: move negation in inequality comparisons

This commit changes the few remaining instances of:

  [[ ! $foo = "$bar" ]]

to the more common:

  [[ $foo != "$bar" ]]

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>
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>
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>
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>