Ok. This is just a quick review. I did a cursory inspection of the script (well, actually, the commands you're running), and have a couple comments (questions?). Feel free to respond, disagree, justify, etc. as you see fit.

apt-cache pkgnames
According to the man page:
pkgnames prefix
Prints the name of each package in the system. The optional argument is a prefix
match to filter the name list. The output is suitable for use in a shell tab com‐
plete function and the output is generated extremely quickly. This command is
best used with the --generate option.
...and, regarding the
--generate option:
-g, --generate
Perform automatic package cache regeneration, rather than use the cache as it is.
This is the default; to turn it off, use --no-generate.
Configuration Item: APT::Cache::Generate.
Since this is the default, it would seem to make your first command:
apt-cache gencaches
superfluous.
Next, regarding your
apt-get command, which appears to be how your determining the broken packages:
apt-get -s install
The only comment I have here, is that your essentially trying to install the entire repository. Whether this is a failing of PCLOS (I doubt it, more to follow), or apt-get or Synaptic, this is going to be a problem. Due to the order of installation, number of packages, unmet dependencies that are available but pending install, or whatever, I've never seen an operation like this succeed.
As a test (or, just for fun, however you want to look at it), I've tried this with both PCLOS and U****u, and never succeeded. This is why i don't think it is a PCLOS fault. In fact, I wasn't even trying install an entire repo, just trying to re-install an existing system, and even that couldn't be resolved properly. It had to be done in "pieces" (that is to say, I had to run multiple installs for individual groups of packages, until I had replicated the pre-existing install...I couldn't do it all in one fell swoop).
This, I think, is the failing in your testing method.
Not to mention (well, it's been kind of mentioned), that apt provides this functionality already. Why not
apt-cache unmet
or, use Synaptic?
I'm OK if you want to continue this as civil debate. It always a chance to learn (new methods, old paradigms, etc.)
Thanks for listening.
