Do not increment lock count if we couldn't lock db

If we could not lock db it is not wise to increment lock count.
At the same time for unlocking db we decrement lock count in any
case as it is unlikely pattern that we could lock db, but could
not unlock and it is nevertheless means that db was unlocked
somehow.
Pkg delete now returns valid exit code.

When started in dry-run mode (-n flag) pkg-delete always returned
EX_SOFTWARE even if it actually succeeded. This patch fixes this
issue.
Validate package loaded from manifest.

Repository should contain only valid manifests, hence check
packages loaded from repo before adding them to db.