pkgng/pkgng — pull request #264 by DragonSA (2012-06-18 09:34:42+00:00)
Title: Separate the package creation and package query stages.

Before, after each package query the package would be created however the pkgdb
holds (in the current implementation) a SHARED lock. Since package creation
could take a long time it resulted in the SHARED lock being help for an extended
amount of time blocking any attempts to alter the database (such as a package
install or package deletion).

By separating the package query and package creation the SHARED lock is only
held for the shortest possible time allowing other operations to continue.

WARNING: this can result in some spurious errors where a package is deleted
before it is created however this results in an error in package creation (vs
the current error of either delayed package deletion or database access timeout)
NOTE: this change cannot introduce inconsistencies into the database.