db-functions: Ensure we quit on invalid lock

All top-level calls to "repo_lock" has an exit condition. This was never
added when the function was refactored to include debug packages. Thus
we never really did `exit 1` on invalid locks.

This reimplements some form of return code we can be sure we at least
exit if we don't have a valid lock.

Signed-off-by: Morten Linderud <morten@linderud.pw>
5 jobs for morten/debug-fixups in 8 minutes and 36 seconds (queued for 8 seconds)