Given two open source projects, each with different licenses, are there metrics or resources I can use to determine if it is legitimate to copy code from one of the projects to the other?
I always look at the schema drawn by David Wheeler: Essay: FLOSS licenses
The arrows show which license you can use in the context of another license.
For instance: you can use software distributed as ASL 2.0 inside an LGPLv3 project and (a fortiori) inside a GPLv3 or AGPLv3 project. You can't use LGPLv3 software inside an ASL 2.0 project.
Just follow the arrows as a rule of thumb and double-check when in doubt.
"Compatible" in this case means that you can satisfy the terms of both licenses. So the only general approach is to read the licences, understand your obligations under all of them, and then determine if you can satisfy all of them.
For some common licenses, other people have already done that work. For example, the Free Software Foundation maintains a page called “Various Licenses and Comments about Them” where they say if they believe a license is GPL-compatible.
To be absolutely sure of what you're doing, it would be necessary to read through the legalese of the licenses to check what is and isn't allowed.
However, many licenses have human-readable pages, which should be sufficient for this: read through them, determine what the restrictions are on using code. You should check that:
- You're allowed to reuse code snippets from the project you plan to copy from;
- The project you're adding to allows you to use code from other licensed projects.
The second point there won't be a problem most of the time, but it is possible.
Of course, if both projects are yours there's no problem at all: you don't have to follow the terms of either license because you own the copyright. Licenses are simply there to give some rights to others (otherwise, technically, nobody would be able to do anything with your software).