Use execvp for running programs in chroot

This makes us more robust to utilities changing paths.  There is no
functional change when a full path is specified.

Signed-off-by: Allan McRae <allan@archlinux.org>
Do not use full path for ldconfig

The ldconfig binary is not guaranteed to be in /sbin. Change to calling
just "ldconfig" rather than using the full path.

This removed the check that the ldconfig binary exists. However, it is
a reasonable assumption that it will exist if its configuration file
does.

Signed-off-by: Allan McRae <allan@archlinux.org>
Do not require full path for scriptlet shell

This increases robustness to the shell location changing paths.

Signed-off-by: Allan McRae <allan@archlinux.org>
pmtest: resolve path to scriptlet shell

In order to support a variety of values for the --with-scriptlet-shell
configure flag, pmtest has to be aware of what kind of path was passed,
be it an absolute path or a fragment for a path lookup. For absolute
paths, leave the path alone. For fragments, search the PATH environment
var for the resolved path to the binary. In both cases, join the
resultant path to the root directory defined for the test, not a
pre-determined bin directory.

Fixes FS#31552.

With-contribution-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Fix release dates

Signed-off-by: Allan McRae <allan@archlinux.org>
dload: avoid showing progress bars on some redirects

RFC 2616 doesn't forbid a 301 or 302 repsonse from having a body, and
servers exist in the wild that show this behavior. In order to prevent
pacman from showing a progress bar when we aren't actually downloading a
package (and merely following one of these pain in the butt redirects),
capture the server response code in the response header, rather than
waiting to peel it off the handle after the download has finished.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Reported-by: Alexandre Filgueira <alexfilgueira@cinnarch.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: Formatting consistency in write_pkginfo

The difference between the echo and the printf's in write_pkginfo seemed
to be somewhat sporadic. Also, the INFAKEROOT check was doing the same
exact thing as the SPLITPKG check, but formatted much differently and
consuming two extra lines. I think this makes it more readable than it
was previously, if nothing else.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Skip reading sync db deltas files if UseDelta is unset

Signed-off-by: Allan McRae <allan@archlinux.org>
Add configuration option for Upgrade operation SigLevel

Add LocalFileSigLevel and RemoteFileSigLevel to control the signature
checking for "pacman -U <file>" and "pacman -U <url>" operations
respectively. The starting value for both these options is SigLevel,
if it is specified in the [options] section, or the built-in system
default. The specified values override and/or supplement this initial
value. Note there is no destintion between setting "Required" and
"PackageRequired" as there is not database options for Upgrade
operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
Quieten the build process some more

Signed-off-by: Allan McRae <allan@archlinux.org>
pacman: print version information in debug output

Signed-off-by: Allan McRae <allan@archlinux.org>
Make key_in_keychain available in library

In preparation for checking key presence and downloading needed keys
before conflict checking.

Signed-off-by: Allan McRae <allan@archlinux.org>
Move key importing into separate function

This will be useful for checking the availablity of all keys before
perfoming validation in sync operations and for downloading a needed
key in upgrade operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
Add function to extract key id from signatures

This does not support all possibilities of RFC4880, but it does
cover every key currently used in Arch Linux.

Signed-off-by: Allan McRae <allan@archlinux.org>
Make decode_signature available to the library

Signed-off-by: Allan McRae <allan@archlinux.org>
Check keys are in keyring before package validation

Keys used to create signatures are checked for presence in the keyring
before package validation is performed.

Signed-off-by: Allan McRae <allan@archlinux.org>

Conflicts:
	lib/libalpm/alpm.h
Remove retry path from signature validation

Now that the keyring is checked for all needed keys before the
validation, we can not reach a point of a missing key when doing
validity checks for sync operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
Prompt to delete packages with signature fails

Offer to remove the bad package when a signature fails to validate
as is done for checksum failures.

Signed-off-by: Allan McRae <allan@archlinux.org>
Import key if needed when installing package from file

When installing a package with "pacman -U" that has a detached
signature, check if the needed key is in the keyring and download
if necessary.

Signed-off-by: Allan McRae <allan@archlinux.org>
README: update with 4.0 -> 4.1 API changes

Signed-off-by: Allan McRae <allan@archlinux.org>