Licensing/Code

From Apertis
Jump to: navigation, search

Apertis code is licensed under the Mozilla Public License Version 2.0. When you contribute to any Apertis code repository, you are agreeing to license your work under the same license as the rest of the code in the repository.

If you are creating a new Apertis project, the code is expected to be licensed under the MPL 2.0.

Apertis also makes use of other projects which may have other licenses, such as the GPL and LGPL. For example, this includes projects such as the Linux kernel, WebKit and GLib.

Contents

License your code

There are two parts to licensing your project:

  • distribute the license text
  • include license headers in each file

Distribute the license file

The license text is normally distributed in the COPYING.MPL or COPYING file which lives in the top directory in the git repository for the project. This file will contain the full license text, as listed at [1], without any modifications or changes. For example, see the newport COPYING file.

While COPYING is a more common filename to use, COPYING.MPL accounts for the case where there may be files in the project under a different license which would require multiple COPYING.* files to be included. This case is most common with applications which may include content such as logos, images and documentation under different licenses.

For example, if you are creating an application which contains documentation, you are likely to want a COPYING.MPL for the code and a COPYING.CC-BY-SA for the documentation.

Add license headers to each file

A license header is a comment which is added to the top of a code file. It consists of a copyright notice, the SPDX license identifier and a license blurb which is provided with the license. The license header for a specific file must contain only copyright holders of content which is in that file. This means that the license header in each of your project files are likely to list different copyright holders.

The copyright notice will normally contain "Copyright ©" followed by the copyright years and the copyright holder. It is recommended that you also include a contact email address for the copyright holder, although this is optional.

If you are employed to contribute to Apertis, the copyright holder may be either you or your employer. We recommend that you check with your employer before you contribute as it may not be possible to completely remove any mistakes as the code is publicly available and archived.

This is what a typical MPL license header looks like:

/*
 * Copyright © 2015, 2016 Anita Developer <a.developer@example.com>
 *
 * SPDX-License-Identifier: MPL-2.0
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

For additional guidance on how license headers work, please read the GNU license guidance. The theory of using the MPL license headers is the same as for the GPL, but do keep in mind that the GLP/GNU licenses have different content from the MPL license.

Apart from the license header, you should also include the vim modeline at the top of the file to help enforce consistent coding style.

Add a new code file to a project

Each code file in all Apertis repositories must contain the license header. This license header must be added in the commit when the file is first added to the project and will typically contain your copyright notice.

Always double check the project license before adding a license header: not all projects are licensed under the MPL! You can find the project license in the COPYING or COPYING.* files. This is most likely to be the case for repositories which are upstream projects that have Apertis specific customisations applied to them. If unsure, do ask the project maintainer for help. You can find the list of maintainers in the .doap file in the project git repository.

Make changes to an existing code file

When you make a copyrightable change to a file in an existing project, you will need to add your copyright notice to the existing copyright header, but make sure that you do not amend or change the license notice in any way! Add your notice below the existing copyright notices, but above the license notice.

For example, if your copyright notice was "Copyright © 2016 Andrew Contributor <a.contributor@example.com>" then the resulting copyright header would look like:

/*
 * Copyright © 2015, 2016 Anita Developer <a.developer@example.com>
 * Copyright © 2016 Andrew Contributor <a.contributor@example.com>
 *
 * SPDX-License-Identifier: MPL-2.0
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
Personal tools
Namespaces

Variants
Actions
Navigation
Tools