8

As stated in the tile, I want to know how should one mark code(functions or pieces of code smaller than 50% of the source file) copied from non copyleft sources (e.g Apache) ?

5

I do it this way:

  1. I add a proper Apache notice and copyright at the top of the file
  2. I document in comments where I took the code from and what I took
  3. I document in comments any changes I did
  4. I add a copy of the Apache license to go with the code
  5. if originally present, I copy and carry with the code any NOTICE-like file that was with the original code
  • That would be a good solution if you accept that the rest of the file be covered by the Apache license as well. What if you want to put your own changes under a copyleft license, or keep them proprietary? – Zimm i48 Feb 23 '17 at 13:34
  • 1
    @Zimmi48 If your choice of other licenses is compatible with the Apache license (say proprietary or MIT/BSD or L/GPLv3) then you can use the same approach for your code and these other licenses in the same file. e.g. just document each section with a proper notice and comments.Though it is usually saner to split things in different files IMHO. – Philippe Ombredanne Feb 23 '17 at 17:48
  • 1
    @PhilippeOmbredanne but then wouldn't it be easier to copy the whole source file containing the Apache license and from your proprietary code just to call the functions/methods you need (of course when no change is required)? – ossx Feb 24 '17 at 12:26
  • 1
    @florinx: in many cases it would be, but this is not what you asked as a question ;) – Philippe Ombredanne Feb 24 '17 at 14:51
  • @PhilippeOmbredanne You are technically right, finally it's about good documentation :) – ossx Feb 24 '17 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.