pkg-{delete,autoremove}: Use a readonly lock in dry run

PR:		175843
pkg-convert: Add locking. EXCLUSIVE by default, READONLY with -n
pkg-convert -r: Only a readonly lock is required for converting from the db
pkg-convert: Check for proper db permissions for both real and dry_run mode
pkg-convert -r: Add common db access checks
pkg convert -r: Don't crash if unable to create the package dir

This entire function needs error handling improvement.