# REUSE tutorial

!!!THIS IS A ROUGH DRAFT!!!

# Our goal

By the end of this tutorial, all your files will clearly have their copyright and licensing marked.

For the purpose of this tutorial, we will assume that the directory of your project looks like this:

project/
├── img/
│   ├── cat.png
│   └── dog.png
├── po/
│   ├── de.po
│   ├── en_GB.po
│   ├── eo.po
│   ├── fr.po
│   ├── nl.po
│   └── POTFILES.in
├── src/
│   └── main.c
├── Makefile
└── README.md

# A licence

The first thing you need is a licence. There are many good licences, but we will pick the GNU General Public Licence v3.0 (GPL). More than simply choosing a licence, you need to put the licence in your project directory.

In the SPDX License List, we notice that the SPDX Identifier of the licence is GPL-3.0-or-later. As such, we create a directory LICENSES, and put the licence text from the Free Software Foundation (FSF) in a file called GPL-3.0-or-later.txt.

Now that you have a licence, you need to indicate in the relevant files that these files fall under that licence. We edit src/main.c as such:

/*
*
*
* This program is free software: you can redistribute it and/or modify
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

Only the first three lines are relevant for REUSE compliance—the rest is up to your discretion. In this blurb, we use the text that the GPL proposes.

• The first and second lines begin with Copyright and record the publication years and copyright holders.

• The third line begins with SPDX-License-Identifier: and is followed up by a valid SPDX License Expression, typically just the SPDX Identifier of the licence.

Each file must always record these two bits of information.

We also edit Makefile and README.md using this blurb, though we will need to use the correct comment syntax for each.

For each file, make sure that the recorded copyright holders are accurate.

# Binary files

We also want to license our image files under GPL-3.0-or-later. Unfortunately, images and other binary files do not have comment headers that one can easily edit.

There is a simple trick to circumvent this. Create the files cat.png.license and dog.png.license, each containing the same blurb as above.

# A different licence

You get a phone call from an angry cat owner who says that the photo they took of their cat was not licensed under the GPL at all. They say it was licensed under the Creative Commons Attribution 4.0 International.

You go back to the SPDX License List, and you find that the SPDX Identifier of this licence is CC-BY-4.0. You also find the full text of the licence. As such, you create a file LICENSES/CC-BY-4.0.txt containing the licence text.

You go back to cat.png.license and edit the file to say:

Copyright 2019  Angry Cat Owner

SPDX-License-Identifier: CC-BY-4.0

# Stubborn files

You have kind translators who translate your project into many different languages. However, your translators do not or cannot edit the headers in their files. You could edit the headers of these files yourself, but there are a lot of them, and you do not feel comfortable manually editing the translation files.

You could use .license files like you did for the images, but for some reason you wish to opt against this.

For these files, you can use a configuration file. In your project root, create the file .reuse/dep5. This file uses Debian’s DEP-5 file format.

You edit the file to look like this:

Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Project
Upstream-Contact: Jane Doe <jane@example.com>
Source: https://example.com/jane/project

Files: po/*
License: GPL-3.0-or-later

# Result

Your project tree will now look like this:

project/
├── img/
│   ├── cat.png
│   ├── dog.png
│   ├── CC-BY-4.0.txt
│   └── GPL-3.0-or-later.txt
├── po/
│   ├── de.po
│   ├── en_GB.po
│   ├── eo.po
│   ├── fr.po
│   ├── nl.po
│   └── POTFILES.in
├── .reuse/
│   └── dep5
├── src/
│   └── main.c
├── Makefile
└── README.md