This tool, among other things, need to translate the desc file format (these files are located in a local pacman database) to the .PKGINFO file format (these files are located in a .tar package files).
So, if you want to regenerate the .PKGINFO file from pacman's local database, do be aware its going to be lossy, some information simply isn't preserved from installation (see below). And quickly, just in case it you're duplicating effort, are you aware of the "bacman" utility that ships with pacman?
As you may saw, I wasn't able to correlate it all and I need some help. I know nothing about '%REASON%', 'checkdepend', 'makepkgopt' and why there's no 'makedepend' in desc files (or is there?).
Something important to note is that there are two kinds of repositories, the local repositories which you seem to be familiar with enough, and the sync repositories, which are downloaded from the internet (or can generate yourself with repo-add). %REASON% and %VALIDATION% are two fields pacman keeps track of for its own book keeping. %REASON% is responsible for marking if a package was installed explicitly or was pulled in as a dependency of another package. %VALIDATION% tracks how a package was validated before installed. This should pretty much always be "pgp" because official packages are signed. Without a signature it should report "none". makedepend is there as %MAKEDEPENDS%, but only shows up in the sync database. checkdepend maps to %CHECKDEPENDS%, also only in the sync database, and it records the dependencies that where needed for the PKGBUILD's check() step, should it have one. makepkgopt records the OPTIONS array as it was set for a given PKGBUILD. See makepkg.conf for more details. Its useful for determining if a particular package, for example, contains debug symbols (you should see both "debug" and "!strip" set). This is not recorded in any database.