Here's a solution for the Linux command line of Retropie. You get to the command line by quitting Emulation Station or by connecting over the network with ssh. After logging in, you will be in the home folder of the user pi with the full directory path /home/pi/ or in short ~.
I've extracted all rom names from the 0.78u5 DAT file. You can get the list here. Save it into a file called lr-lite.list to use it with the following commands.
In the example below, your full romset is in folder romset_full and the custom romset will be in folder romset_lr-lite, both located in your home folder ~. The file lr-lite.list is also in your home folder ~.
You'll then have to execute one these commands:
Either copy the files (needs more space, the full set remains intact)
while read file; do cp "romset_full/$file".zip romset_lr-lite/; done < lr-lite.list
or move the files (same space as before, filtered files are removed from the full set)
while read file; do mv "romset_full/$file".zip romset_lr-lite/; done < lr-lite.list
Now, you have a custom romset matching the 0.78u5 DAT file in the folder romset_lr-lite. Copy the roms into the rom folder of your choice (e.g. mame-libretro) and then scrape them to generate a new gamelist.xml.
You can delete the file lr-lite.list after checking that everything worked as planned.
Bonus for advanced users: I extracted the rom names from the 0.78u5 DAT file by using this command.
xmlstarlet sel -T -t -m /datafile/game/@name -v . -n mame2003-lr-lite.xml >lr-lite.list