When using NO_GENERIC_LICENSE, we're using license files from the source tree, which aren't guaranteed to have unique basenames. We can have 12 different files named LICENSE in different locations, and this is an entirely reasonable thing to do. Not only does the logic hardcode the assumption that the basename is unique in *multiple* places, it doesn't bother to check for the situation. It blindly removes any existing file of that name, even if it was written by a previous copy in this task. Further, some of the code is flawed and racy, though it likely doesn't cause huge issues yet (do *not* check for a file existing and then remove it if so, the file can easily have been removed between the two lines. remove it, and ignore a failure due to the file not existing).
Hmm, this is a bit trickier than I thought at first. The issue is not just about NO_GENERIC_LICENSE but any package that has multiple overlapping "basenames" in LIC_FILES_CHKSUM. All files listed in LIC_FILES_CHKSUM get copied and if there are multiple files with the same basename only the last prevails. That is a problem if the files differ in content, but, it is the right thing to do if all of them are identical (i.e. have the same checksum). Thus, I see two cases that need to be solved: 1. If there are multiple identical (same checksum) license files with the same basename we should only copy one file 2. If there are multiple different license files with the same basename we should rename and copy all of them I'm not that concerned about a possible race, though. My reasoning being that do_populate_lic copies data to a recipe-specific directory and only gets run once with no parallelism.
A patch sent for review: https://patchwork.openembedded.org/patch/128541/
Fix merged in: http://git.openembedded.org/openembedded-core/commit/?id=d5e1375884e509ec745bac43f1f7f7950f62f280