Switching licenses from MIT to GNU GPL

DISCLAIMER: I'm not an expert in software licensing by any means, so please don't take this post as legal advice.

As described in a previous post, I'm doing a fork of Watson, a time tracking command-line tool. You can find in there my motivations for doing a fork instead of other alternatives. The subject of this post is describing why and how I've switched the forked project license from MIT/Expat to GNU GPL1, what's the REUSE project and how to apply it to help in the migration process.

Why ever would anyone want to modify the license?

Both MIT and GPL are OSI approved licenses, meaning both are accepted by the Open Source Initiative as complying with their definition of Open Source Software.

The GNU General Public License (GNU GPL) is a license created by the Free Software Foundation, which defines free software using a four-point definition. You can find arguments in favor and against the OSI and the FSF definitions in their respective sites and all over the Internet.

The GPL, in its third revision (GPLv3), adds some interesting features, though not very relevant for my project. What matters most, is that the GPL is a copyleft license:

Copyleft is a general method for making a program (or other work) free (in the sense of freedom, not “zero price”), and requiring all modified and extended versions of the program to be free as well.

This is not the case of the MIT/Expat license, which allows you to distribute the software (and any modifications) under a non-free license, ie. not complying with any or all of the four free software points. This is why it is said that the MIT license is more permissive than the GPL.

Choosing one license or another is a matter of circumstances, strategy, and convictions. In a small project like this, not distributed as a library, it's a conviction that takes most of the weight.

Switching from MIT to GPL

First of all, it's important to note that I'm not changing the license of the original project. Watson is a different piece of software and is still MIT-licensed. It is the forked software (xtimetracker) license that is being changed. Relicensing a software project with many contributors can be quite challenging and is not the subject of this post.

Second, we can take this upgrade path because the MIT license is GPL-compatible, meaning we can combine code under the MIT and GPL licenses in one larger program and distribute it as GPL.

Finally, the original project only stated the license in a LICENSE file in the project root. However, according to the GPL FAQ, license notices should be included in all relevant files, especially when mixing permissive and GPL-licensed files and, in this case, also for honesty's sake. This means all files should be modified to state copyright and license information.

Enter REUSE

Applying multiple licenses to the same files is not an easy task, legally speaking; that's the reason I found the REUSE initiative so appealing to the problem at hand.

REUSE defines a set of recommendations to apply copyright and licensing information to software projects. It was created by the Free Software Foundation Europe (FSFE) to make licensing clear both to humans and computers. That's the reason there is a tool to automate many tasks involved in applying the REUSE recommendations, including compliance validation according to the latest REUSE specification.

Reality is that other tools are not yet compatible with the REUSE recommendations and that the reuse tool itself is under continuous development to handle the large number of special cases that can arise in software projects. This means you'll probably have to manually handle and verify most of your files (which is recommended anyway).

How to declare multiple licenses

The current situation is such that most project files have already been modified by me. This means that both MIT and GPL licenses should apply to them. Specifically, the parts that I've coded are licensed under the GPL license, and the parts from the original project fall under the MIT license. However, this distinction is difficult to state explicitly.

When multi-licenses apply, each file should list what licenses apply in separate SPDX-License-Identifier tags (wait, what's an SPDX identifier?).

In the project properties (e.g. your setup() function in a Python package), the AND operator should be used because the project is governed by two different licenses:

# setup.py
license="GPL-3.0-or-later AND MIT"

You would use the OR operator when the user can choose between them.

Using the reuse tool to include licensing information

Let's run reuse to change all files with supported comment styles in bulk. Note that we could apply multiple copyrights and licenses at once, but, because the years are different, we have to run two commands:

# OLD COPYRIGHT
$ git ls-files | xargs reuse addheader --skip-unrecognised \
    --copyright="Tailordev" --license=MIT --year=2015-2019

# NEW COPYRIGHT
$ git ls-files | xargs reuse addheader --skip-unrecognised \
    --copyright="David Alfonso" --license=GPL-3.0-or-later --year=2020

Now we can list the files missing licensing information and deal with each of them on a case-by-case basis:

$ reuse lint
### MISSING COPYRIGHT AND LICENSING INFORMATION

The following files have no copyright and licensing information:
* .flake8
* MANIFEST.in
* requirements-dev.txt
* tests/resources/autocompletion/frames
* tests/resources/sample_data/frames
* tt.completion
* tt.zsh-completion

The following files have no licensing information:
* README.rst

If we know the comment style of any of these files, we can force the reuse tool to use it. For example:

$ reuse addheader --copyright="David Alfonso" \
    --license=GLP-3.0-or-later --year=2020 \
    --style=python tt.completion

You can find the style shorthands inspecting the reuse code.

Licensing non-code files

According to the REUSE tutorial, files which can be considered insignificant, like configuration files, might be licensed differently. One alternative is the CC0 license, which is very similar to releasing the file to the public domain. However, because I'm already using the MIT license, and to avoid blocking contributors, I prefer to use the MIT license for this kind of files.

Conclusions

This post has tried to explain the findings and tools I've found along the way of switching the license of a forked FOSS project.

Of special importance was the REUSE website which has proved to be a great resource for solving licensing doubts, together with the GPL FAQ.

Finally, the reuse tool has turned out very effective in automating the process of adding copyright and license information to all files.


  1. When I write GPL, please assume GNU GPLv3 or later. Being forward-compatible is relevant