I've just linked this to the build. It's to respond from head scratching from various people (hi oga@), mostly developers, who do manage to crash their box regurlarly at inconvenient times (yep, a box will tend to panic when you're playing with code that affects the vfs).
So, the box usually comes up with vastly disrupted /var/db/pkg, with rather fun consequences wrt pkg_add/pkg_delete... those don't like it when a package doesn't have a +CONTENTS file, or when the +REQUIRED file is actually garbage blocks. So, this is the problem pkg_fsck is supposed to solve. If you think your /var/db/pkg has been hosed, it will do some basic (and not so basic) sanity checks. Currently, it only checks that stuff more or less looks like packages, and that actual files that should be there are actually there, with the right checksum. It's not 100% precise yet, some details have to be figured out. REPEAT: THIS IS NOT COMPLETE YET. YOU PROBABLY DON'T NEED THIS, AND IF YOU SEND CLUELESS REPORTS, I WILL BLISSFULLY IGNORE YOU/FLAME YOU TO HELL. ;-) I intend to complete the dependencies checks soon (reconstructing +REQUIRED_BY/+REQUIRING), and also to give it some smarts to reconstruct missing package registration and what not (assuming you still have the packages "somewhere", looking at pkglocatedb to locate files, and then grabbing the missing packages off PKG_PATH ought to work. Yep, that's the kind of stuff we ought to be able to do easily these days).
