Produce something that works in all cases
Produce something that works in all cases

I have been testing this escaping all morning on various combinations of file names.  In any single case, the original escaping algorithm works just fine, but in the case you have a file name containing a multitude of glob characters, you can't escape them if the file also contains spaces in the name.  In order to escape the glob characters, the file name can't be quoted (or at least that's the case with the version of rpmbuild I have).  The result is file not found errors.  In the end, the only solution that works consistently with all scenarios I have tested it with, is to replace the spaces with a single glob character match `?`, then escape any other glob characters present in the file name.
djhaskin987/fpm,djhaskin987/fpm,djhaskin987/fpm,djhaskin987/fpm