Fix pkg-fetch output.

Issue:	#792
Reported by:	az
Fix sqlite error output.
Fix lock race condition.

Issue:	#791
Reported by:	@infracaninophile
Fix finalization in pkg-clean.
Simplify sat solver internal API.
Be more conservative during pkg-install.
Merge install and upgrade solving logic.
Do not upgrade not installed packages.
Allow upgrade of individual packages.
Update manual pages.
Merge branch 'upgrade-rework'
Forgot to commit.
Reducing checksum overhead.

Full description:
When downloading a package, pkg first checks whether the file exists
in the cache directory. The cached file may be old or corrupted,
therefore pkg computes an sha256 checksum of the cached file and
compares it to the known checksum of the repository before using the
cached file.
Computing the checksum is expensive and can take several seconds for
large packages. During a pkg-upgrade on a system with several
packages, checksums for hundreds or even thousands of megabytes will
be calculated.
This commit adds a simple check of the size of the cached file before
calculating it's checksum. Files of differenz size should not produce
the same hash from a collision resistant hash function, so it is safe
to assume that the checksums will be different if the size differs.
Fix repo upgrades structure.

Reported by:	zotrix via irc
Fix coredump in pkg-delete if a package has no deps installed.
Fix uninitialized variable usage.
Release savepoint if we could not upgrade db.
More fixes to transactions logic.
Increase buffer length for repo upgrade.
Avoid double free of database object.