fix improper FREELIST calls

* conflicts need to be freed with alpm_conflict_free
* sync dbs need to be unregistered and are handled by alpm_release

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
pacman-db-upgrade: use pacman-style options

* convert dbpath from argument to option
* add --config and --root options
* read dbpath and root from config file
* if root is set but not dbpath, dbpath is set relative to root

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Extend database upgrade script to handle alpm db version 9

Original-work-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
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 checked 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

When we check the database version directly, there is no longer a
need to scan for depends files.

Signed-off-by: Allan McRae <allan@archlinux.org>
alpm.h: remove outdated pkg_get_backup doxygen

alpm_pkg_get_backup hasn't returned strings since
54ef162a1a9e27e362732d873f0739bc0a2cf1bf in 2011.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
replace --reference on chmod/chown commands

Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: use correct terminology

unix has no "folders".
makepkg: let --source imply --ignorearch

Since source package creation is architecture independent, we should
ignore architecture-dependent behaviors such as the lint check which
will halt execution when the host machine is not a supported arch.

https://github.com/falconindy/pkgbuild-introspection/issues/15
makepkg: disallow values of 'arch' which might be problematic

We rely on values in the arch array to be valid as part of variable
names, so extend the arch lint check to catch this.

This also cleans up lint_arch to restrict the use of "lint" only to the
package-specific architecture checks. It previously had an odd
declaration with a conditional expansion that would never be true.
wrap fgets to retry on EINTR

The read() underlying fgets() can be interrupted by a signal handler
causing fgets() to return NULL.  Before we started handling SIGWINCH,
the odds of interrupting a read were low and typically resulted in
termination anyway.  Replace all fgets calls with a wrapper that retries
in EINTR.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
pacman: set SA_RESTART for signal handler

Calling a signal handler interrupts some functions, most notably read()
and therefore fgets().

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
pacman.c: Add -gg, -ii, and -yy to help summary

The sync help summaries was missing the information about:
* -gg: View all groups and members
* -ii: View extended information
* -yy: Force refresh even if DBs are up to date

Fixes FS#41388.

Original-work-by: Earnestly <zibeon@gmail.com>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>