forked from openkylin/docs
Update license tutorial
This commit is contained in:
parent
4d55befb35
commit
242f0b847a
|
@ -4,41 +4,65 @@ date: 2022-09-16 14:36:45
|
|||
tags:
|
||||
---
|
||||
|
||||
## openKylin软件包版权协议补充指南
|
||||
# openKylin软件包版权协议补充指南
|
||||
|
||||
openKylin 对待软件包版权和许可证信息的态度十分严格。在 openKylin 中的所有软件包必须包含 debian/copyright 文件且在该文件中需要提供相关信息的摘要。
|
||||
openKylin 对待软件包版权和许可证信息的态度十分严格,在 openKylin 中的所有软件包都应包含相应的版权信息,一般包括如下三步:
|
||||
1. 将相应的版权声明文件放入每个源文件的头部注释中;
|
||||
2. 在软件包的一级目录下创建以“LICENSE”或“COPYING”为名的文件,放入整个项目的许可证信息;
|
||||
3. 在debian/copyright 文件中提供项目所有源文件版权信息的摘要;
|
||||
|
||||
该文件通常需要包含软件包版权信息的逐字副本;有关详细信息以及与软件包版权相关的进一步注意事项。
|
||||
|
||||
## 头部注释
|
||||
|
||||
针对项目内的.c/.cpp/.h/.py/.java 文件,在头部注释添加相应版权声明,相应的声明可在许可证文本信息中找到,也可以参考遵循相同许可证的项目:
|
||||
|
||||
以项目ukui-foo,许可证“木兰宽松许可证,第2版”,copyright主体 Zhang Three 为例,需要在每个源文件头部注释中插入:
|
||||
|
||||
```
|
||||
Copyright (c) 2022 Zhang Three
|
||||
ukui-foo is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
```
|
||||
|
||||
以项目ukui-foo,许可证GPL-3.0+,copyright主体 Zhang Three 为例:
|
||||
```
|
||||
Copyright (C) 2022 Zhang Three
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>.
|
||||
```
|
||||
|
||||
## 项目license文件
|
||||
依据项目遵循的许可证情况,需要将相应的许可证完整内容(openKylin可从/usr/share/common-license目录下获取),拷贝到项目的一级目录下,重命名为"LICENSE"或“COPYING”。
|
||||
以项目ukui-foo,许可证GPL-3为例:
|
||||
```
|
||||
cd ukui-foo
|
||||
cp /usr/share/common-license/GPL-3 COPYING
|
||||
```
|
||||
## debian/copyright文件
|
||||
### 文件语法
|
||||
|
||||
debian/copyright 文件必须是机器可理解的,但又是人类可读的,同时需要传达所有规定的上游信息、版权声明和许可细节。
|
||||
|
||||
该文件的语法与其他 Debian 控制文件的语法相同,在 Debian 政策手册中有所规定。
|
||||
|
||||
该文件由两个或更多段落组成。至少,该文件必须包括一个标题段和一个文件段。
|
||||
|
||||
每个字段的值都是下面列出的四种类型之一。本文件中每个字段的定义指出了它的值的类型。
|
||||
|
||||
1. 单行值 Single-line values
|
||||
|
||||
一个字段的一个值必须在同一行上,不可分段。
|
||||
|
||||
2. 空格分隔的列表 Whitespace-separated lists
|
||||
|
||||
定义为空格分隔的列表的字段值可以在一行或多行上。列表中的值由一个或多个空白字符(空格或换行符)分隔。例如,Files 字段包含一个用换行的文件名模式的列表。
|
||||
|
||||
3. 基于行的列表 Line-based lists
|
||||
|
||||
另一种列表值每行有一个值。例如,Copyright 字段可以列出许多版权声明,每行一个。
|
||||
|
||||
4. 文本格式类似于包装的长篇描述
|
||||
|
||||
格式化的文本字段使用与软件包描述字段中的长描述相同的规则,可能还会使用第一行作为概要,就像 control 文件的描述用于短描述那样。例如,Disclaimer字段没有特殊的第一行,而License则有。
|
||||
debian/copyright 文件必需要传达所有规定的上游信息、版权声明和许可细节,该文件由两个或更多段落组成。至少,该文件必须包括一个标题段和一个文件段。
|
||||
|
||||
### 段落
|
||||
|
||||
有三种类型的段落。文件中的第一个段落被称为标题段。其他每一段都是 Files 段或者是独立的 License 段。这与 debian/control 文件中的源代码和二进制包段落类似。
|
||||
有三种类型的段落。文件中的第一个段落被称为标题段。其他每一段都是 Files 段或者是独立的 License 段。
|
||||
|
||||
#### 标题段
|
||||
|
||||
|
@ -196,7 +220,9 @@ License: GPL-2+ or Artistic-2.0, and BSD
|
|||
|
||||
License: GPL-2+ with OpenSSL exception
|
||||
|
||||
### 如何检查 copyright
|
||||
可以参考[示例](https://gitee.com/openkylin/ukui-session-manager/blob/openkylin/yangtze/debian/copyright "示例")
|
||||
|
||||
## 如何检查 copyright
|
||||
|
||||
社区上游已经有程序能够帮助我们检查 copyright 的写法,这些程序目前都遵循 DEP-5 的规则。
|
||||
|
||||
|
@ -208,64 +234,6 @@ License: GPL-2+ with OpenSSL exception
|
|||
|
||||
#### cme
|
||||
|
||||
使用 cme命令根据源码文件头部自动更新 copyright 文件
|
||||
使用 cme命令根据源码文件头部自动更新 debian/copyright 文件
|
||||
|
||||
- $ cme update dpkg-copyright
|
||||
|
||||
## 代码文件如何加 Copyright
|
||||
|
||||
在了解完 debian/copyright 的规则和使用工具后,来了解一下代码文件头部应该如何添加头文件。
|
||||
|
||||
使用多行注释符号 `/*....*/` 来进行版权信息添加。
|
||||
|
||||
### 自研开源应用
|
||||
|
||||
```
|
||||
/*
|
||||
* Peony-Qt
|
||||
*
|
||||
* Copyright (C) 2020, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
```
|
||||
|
||||
### 开源软件包修改
|
||||
|
||||
```
|
||||
/*
|
||||
* dpkg - main program for package management
|
||||
* archives.c - actions that process archive files, mainly unpack
|
||||
*
|
||||
* Copyright © 1994,1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
|
||||
* Copyright © 2000 Wichert Akkerman <wakkerma@debian.org>
|
||||
* Copyright © 2007-2015 Guillem Jover <guillem@debian.org>
|
||||
* Copyright © 2011 Linaro Limited
|
||||
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This 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/>.
|
||||
*/
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue