Do not refer to FlySpray numbers

These references to bug numbers assume we will forever be using that bug
tracker. It is better to properly comment the code instead (which was
done in almost all cases anyway).

Signed-off-by: Allan McRae <allan@archlinux.org>
Create local database directory if it is missing

This means that a missing local database becomes an error (as it
should be immediately created).  Note this only creates the "local"
directory and not its parent, which is check for during locking.

Signed-off-by: Allan McRae <allan@archlinux.org>
Add version file when creating local database directory

The version of the local pacman database is stored in its root in the file
.alpm_db_version.  The version is starting at 9, corresponding to the
next libalpm library version.

Signed-off-by: Allan McRae <allan@archlinux.org>
Add version file to empty local database

If a user manually creates the local database directory, or has an empty
local database for some other reason, we silently add a version file

Signed-off-by: Allan McRae <allan@archlinux.org>
Check the version of the local database during validation

Signed-off-by: Allan McRae <allan@archlinux.org>
Extend database upgrade script to handle alpm db version 9

Signed-off-by: Allan McRae <allan@archlinux.org>
Only note backup file changes with -Qkk

Backup files are expected to be changed and should not be flagged by -Qkk.
Note changed back-up files in -Qkk but do not count them as altered. Do
not report backup files in -Qqkk.

Signed-off-by: Allan McRae <allan@archlinux.org>
Warn when directory ownership differs between filesystem and package

We currently only warn if a directory's permissions differ, but using -Qkk
on my system shows that directory permissions tend to change in packages
reasonably frequently without notice.  Provide a warning in such cases
so that it can be altered.  Example output:

(1/1) reinstalling nginx
warning: directory ownership differs on /var/lib/nginx/proxy/
filesystem: 33:0  package: 0:0

Signed-off-by: Allan McRae <allan@archlinux.org>
Remove setlocale usage from the backend

Using setlocale in the backend is bound to lead to frontend issues
and we have have been using epoch in our databases since April 2007
(commit 47622eef).  Remove support for old style times.

Signed-off-by: Allan McRae <allan@archlinux.org>
Report missing directory if we can not initialise alpm library

When pacman failed to initialise the alpm library due to the database
directory being missing (either via the root not existing or the database
directory itself not existing), it just printed the non-informative
message "could not find or read directory".  Add the directory
information the the error output.  E.g.:

error: failed to initialize alpm library
(could not find or read directory: /this/does/not/exist/var/lib/pacman/)

Signed-off-by: Allan McRae <allan@archlinux.org>
Provide a mechanism to skip validation of sync repos

We often know when we initially register a sync database that it is scheduled
to be updated.  In particular, if the current copy of the sync database is
invalid but we are refreshing it, there is no need to output error messages
before updating.

Signed-off-by: Allan McRae <allan@archlinux.org>
Provide more information for database signature failures

Distinguish between database that failed to verify and that are missing.

Signed-off-by: Allan McRae <allan@archlinux.org>
Report which package is missing a signature

If any package in a sync transaction is missing a required signature,
we give an uninformative error message (which may or may not state that
the missing signature is the issue).  Always output the package with
the missing signature.

Signed-off-by: Allan McRae <allan@archlinux.org>
pacdiff: Search and give warnings for older pacsave.[0-9] files

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>