alpm: Rename a variable for future clarity

We will be adding event structs in the following patches.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
dload: allow curl to response to any auth challenge

Previously, we only allowed the default of responding to basic auth
challenges. Mirrors requiring authorization are far and away the edge
case, but there's no sense in preventing access to them.

Implements FS#38184.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
trans_prepare: always sort trans->remove by deps

Packages can be removed during a sync transaction either directly or
due to conflicts and need to be sorted.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: fix check for distcc

Signed-off-by: Allan McRae <allan@archlinux.org>
Use the 'configure'd PYTHON to run pactest.

Use the 'configure'd PYTHON to run pactest instead of the one
hard-coded (with '#!') in pactest.py. Also remove useless '#!' from
non-main .py files.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Fix build warnings with --disable-nls

The gettext functions return a "char *", so do the same for the defines
in the case where gettext is unavailable.  This prevents a number of
warnings about const being dropped.

Signed-off-by: Allan McRae <allan@archlinux.org>
conf.c: add missing newline to warning

Fixes tests that use pacman's output when built without libcurl.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
deps.c: remove filtered_depend functions

filtered_dep was duplicating an alpm_depend_t solely for the purpose of
overriding its depmod and would effectively cause alpm_checkdeps to
ignore ALPM_TRANS_FLAG_NODEPVERSION if the duplication failed.  Manually
overriding/restoring the depmod for the original depend removes the
duplication as a point of failure and fixes a memory leak where the
duplicated depend was not being properly freed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Add the unit tests for -Qk and -Qkk that are possible now.

The -Qk test (001) validates the existence of the package files (which
were installed to the filesystem by the framework because the package
was added to the "local" db).

The -Qkk test (002) does not validate any file's properties - it can
only check that the pacman run produces the expected warning message
saying that the package lacks an mtree.

Further tests will require modifications to the testing framework to
allow intentional damage to the filesystem and generating an mtree.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>

[Allan] Make warning message detection more specific
Signed-off-by: Allan McRae <allan@archlinux.org>
Update comment for local db entry creation

Mention mtree files do not need creation in addtion to install files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Copy validation field in _alpm_pkg_dup

Signed-off-by: Allan McRae <allan@archlinux.org>
Update copyright years for 2014

Signed-off-by: Allan McRae <allan@archlinux.org>
Clear up definition of INFRQ_ALL

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Push down testing .gitignore entries

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Remove -fgnu89-inline from compile options

This was a hack done by me in commit d8e88aa0175fd back in 2007 that is
no longer necessary, given a sufficiently smart compiler and one that
supports the inline keyword.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Log more in search debug message

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Use O_CLOEXEC as much as possible when opening files

When calling open(), use O_CLOEXEC as much as possible to ensure the
file descriptor is closed when and if a process using libalpm forks.

For most of these cases, and especially in utility functions, the file
descriptor is opened and closed in the same function, so we don't have
too much to worry about. However, for things like the log file and
database lock file, we should ensure descriptors aren't left hanging
around for children to touch.

This patch is inspired by the problem in FS#36161, where an open file
descriptor to the current working directory prevents chroot() from
working on FreeBSD. We don't need this file descriptor in the child
process, so open it (and now several others) with O_CLOEXEC.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Minor struct member reordering for packing concerns

Noticed using clang and `-Wpadded`.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Reorder and reshape the package struct for better packing

This shrinks down the total size of the package struct by a handful of
bytes, saving us some memory and cache pressure when we are loading up
the entirety of the sync and local databases.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
valgrind.supp: suppress leak in gpgme_get_key

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>