harmony 鸿蒙README.OpenSource Design Specification Document and Usage Guide
README.OpenSource Design Specification Document and Usage Guide
Introduction
In order to better trace the original upstream information of third-party open-source software, the OpenHarmony community requires in the “Third-Party Open Source Software Introduction Guidelines”:
Newly introduced open-source software must provide a
README.OpenSourcefile in its root directory. This file should accurately describe the following: software name, license type, location of the license file, software version, the upstream community address corresponding to this version, software maintainer (Owner), functional description, and dependencies.
However, when actually writing the README.OpenSource file, community developers often face issues due to insufficiently clear specifications and filling requirements. This is especially true when dealing with complex scenarios like multiple licenses and multiple open-source software. As a result, the file contents may not conform to standards. Therefore, this document aims to provide a clearer and more understandable set of design specifications and usage guidelines for the README.OpenSource file in the OpenHarmony project. While maintaining the original metadata field structure, we will address the issue where multiple licenses may share the same license file, to meet the needs of engineering parsing, while ensuring that the current README.OpenSource file remains unaffected.
Scope
This guide applies to all contributors in the OpenHarmony community, particularly when introducing third-party open-source software into the OpenHarmony project.
Overall Configuration Structure
The README.OpenSource file uses JSON format and contains an array where each element represents the metadata object of an open-source software entry. No fields are added or removed from the original structure.
Field Structure
[
{
"Name": "softwarename", // Full name of the upstream open-source software
"License": "SPDX-License-Identifier", // License information; multiple licenses are separated by semicolons
"License File": "path/to/license", // Path to the license file; multiple paths are separated by semicolons
"Version Number": "1.0.0", // Software version number
"Owner": "zhangsan@xyz.com", // Maintainer’s contact (email)
"Upstream URL": "https://example.com",// Upstream software URL
"Description": "Brief function description", // Software description
// "Dependencies": ["dependency1", "dependency2"] // Optional; list if dependencies exist
}
]
Field Definitions and Completion Guidelines
1. Name
- Description: Full name of the upstream open-source software.
- Requirement: Accurately enter the official software name as published by the upstream.
2. License
Description: Open-source software license information.
Requirements
:
Use standardized identifiers from SPDX License Identifier.
For multiple licenses, separate them with a semicolon (
;).";"- Example:
"MIT;BSD-3-Clause"
- Example:
Order of licenses: Corresponds one-to-one with the license file paths in the
License Filefield.
3. License File
Description: Path to the license file.
Requirements
:
Multiple license files: Separate paths with a semicolon (
;), maintaining the same order as in theLicensefield.If multiple licenses refer to the same license file, repeat the path in the field.
- Example:
"LICENSE;LICENSE"
- Example:
For a single license requiring multiple files, separate the paths with a colon.
:- Example:
"COPYING:LICENSE"
- Example:
4. Version Number
- Description: Version number of the included open-source software.
- Requirement: Enter the official release version from the upstream, ensuring it matches the actual version used.
5. Owner
- Description: Maintainer and their email address within the OpenHarmony organization.
- Requirement: Enter the email address of the person responsible for maintaining the software.
6. Upstream URL
- Description: URL of the upstream source code repository or release page.
- Requirement: Provide a valid link to the source code or release page of the upstream software.
7. Description
- Description: Brief function description of the open-source software.
- Requirement: Use concise language to describe the software’s main functionality and purpose.
8. Dependencies (Optional)
- Description: List of other open-source software directly required by this software.
- Requirements:
- Only include if the software has dependencies.
- List dependencies as an array, aligning each with the
Namefield of the dependent software. - Example:
"Dependencies": ["dependency1", "dependency2"]
Usage Guide
1. Introducing New Open-Source Software
- Steps:
- Create a separate code repository for the new software.
- Create a
README.OpenSourcefile in the root directory of the repository. - Complete the
README.OpenSourcefile using the field definitions above. - If the software has dependencies, ensure all dependent software is introduced and has its own
README.OpenSourcefile.
2. Handling Multiple License Situations
Multiple licenses pointing to a single license file:
List all licenses in the
Licensefield, separated by semicolons.Repeat the license file path in the
License Filefield to correspond with each license.Example:
"License": "MIT;BSD-3-Clause", "License File": "LICENSE;LICENSE"Single license pointing to multiple license files:
Enter the license in the
Licensefield.Separate the multiple paths in
License Filewith a colon (:).Example:
"License": "GPL-2.0+", "License File": "COPYING:LICENSE"Multiple licenses with multiple license files:
Use a semicolon (
;) to separate entries in bothLicenseandLicense Filefields, maintaining one-to-one correspondence.Example:
"License": "MIT;Apache-2.0", "License File": "LICENSE-MIT;LICENSE-APACHE"
3. Maintaining Dependency Relationships
- Description: In the main software’s
README.OpenSourcefile, list all directly dependent software underDependencies. - Requirements:
- Only list direct dependencies, omitting indirect dependencies.
- Ensure that each listed dependency is included in OpenHarmony with a corresponding
README.OpenSourcefile.
4. Updating Open-Source Software
- Steps:
- When updating the software version, update the
Version Numberfield to reflect the new version. - Check for any changes in license information and update the
LicenseandLicense Filefields if necessary. - Review and update the
Dependenciesfield if dependencies have changed.
- When updating the software version, update the
5. Handling Special Cases
- Exceptional Cases Reporting: If managing multiple open-source software entries within a single
README.OpenSourcefile, the project within OpenHarmony’s main branch must report to the Community Architecture SIG in advance.
Engineering Parsing Guide
Parser Logic:
- Read the
LicenseandLicense Filefields, splitting entries with the semicolon (;) delimiter. - Establish a one-to-one mapping between licenses and license files based on index order.
- When a path in
License Filecontains multiple files, separate them with a colon (:).
- Read the
Parsing Example:
"License": "MIT;BSD-3-Clause",
"License File": "LICENSE;LICENSE"
- Parsed output:
- License list:
["MIT", "BSD-3-Clause"] - License file list:
["LICENSE", "LICENSE"] - Mappings:
"MIT"maps to"LICENSE""BSD-3-Clause"maps to"LICENSE"
- License list:
Examples
Example 1: Multiple Licenses Sharing a Single License File
[
{
"Name": "examplelib",
"License": "MIT;BSD-3-Clause",
"License File": "LICENSE;LICENSE",
"Version Number": "1.2.3",
"Owner": "developer@openharmony.io",
"Upstream URL": "https://github.com/example/examplelib",
"Description": "An example library with multiple licenses corresponding to a single license file."
}
]
Example 2: Single License with Multiple License Files
[
{
"Name": "complexlib",
"License": "GPL-2.0+",
"License File": "COPYING:LICENSE",
"Version Number": "3.0.0",
"Owner": "maintainer@openharmony.io",
"Upstream URL": "https://github.com/example/complexlib",
"Description": "A complex library with a single license covering multiple license files."
}
]
Example 3: Software with Dependencies
[
{
"Name": "bindgen",
"License": "BSD-3-Clause",
"License File": "LICENSE",
"Version Number": "0.59.1",
"Owner": "lihua@openharmony.io",
"Upstream URL": "https://github.com/rust-lang/rust-bindgen",
"Description": "A tool for generating Rust FFI bindings to C/C++ libraries.",
"Dependencies": ["shlex", "once_cell"]
}
]
``
Example 4: Software with No Dependencies
[
{
"Name": "simplelib",
"License": "Apache-2.0",
"License File": "LICENSE",
"Version Number": "0.1.0",
"Owner": "zhaoliu@openharmony.io",
"Upstream URL": "https://github.com/example/simplelib",
"Description": "A library providing basic functionality."
// No need to fill in the Dependencies field
}
]
Notes
- Field Integrity:
- Retain the original field structure; do not add or remove fields.
- All fields are mandatory unless specifically indicated as optional.
- The
Dependenciesfield is optional and should only be filled in if dependencies exist.
- Correspondence between License and License File:
- The elements in the
LicenseandLicense Filefields must have the same quantity and order. - When multiple licenses correspond to a single license file, repeat the path of the license file.
- When a license file corresponds to multiple files, separate the paths with a colon
":".
- The elements in the
- Consistency of Parsing Rules:
- The parser should follow the agreed-upon delimiters and order to achieve accurate mapping of licenses to license files.
- Ensure that parsing logic aligns with entry guidelines to avoid misunderstandings.
- Minimizing Impact on Existing Files:
- As the original field structure is maintained, existing
README.OpenSourcefiles are compatible with the new parsing rules and do not require modification.
- As the original field structure is maintained, existing
- Field Formatting Requirements:
- The order of licenses in the
Licensefield should match the order of license files in theLicense Filefield. - Use standard SPDX license identifiers and avoid non-standard or abbreviated forms.
- The order of licenses in the
- Compliance Checks:
- Ensure that all entries accurately reflect the actual status of the upstream open-source software.
- Regularly check license and version information to ensure timely updates.
Fulfillment of Open-Source Obligations
- Based on Mapping: Ensure each license obligation is properly fulfilled.
- Process Steps:
- Parse the
LicenseandLicense Filefields to establish the mapping between licenses and license files. - Collect and review each license file to understand its requirements.
- Implement the required compliance measures based on each license, such as copyright notices, source code disclosures, etc.
- Parse the
Document Improvements and Revision Notes
- This document is drafted and maintained by the OpenHarmony Compliance SIG. The latest version of this document is available here.
- Any additions, modifications, or deletions to the rules in this document must be tracked. Please access the tracking system for updates.
- Final rules are reviewed and approved by the PMC after thorough discussion within the community.
你可能感兴趣的鸿蒙文章
harmony 鸿蒙32- and 64-Bit Portability Coding Guide
harmony 鸿蒙TypeScript and JavaScript Coding Style Guide
harmony 鸿蒙ArkTS Coding Style Guide
harmony 鸿蒙Java Secure Coding Guide
harmony 鸿蒙JavaScript Coding Style Guide
harmony 鸿蒙OpenHarmony Build Specifications
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
7、 openharmony
-
9、 golang