移植speexdsp到OpenHarmony标准系统⑥

九、准备好上传speexdsp至OpenHarmony仓库。

移植完成后,先将代码上传至sig仓中的contest仓

sig仓库是TPC仓库的孵化仓。代码先上sig仓,到时会直接平移到tpc仓。

上传的内容包括:

  • 原生库代码
    • (除了涉及需要修改原生库代码的部分,其他都不能上传,例如编译途中生成的中间文件)
  • BUILD.gn
  • README.Opensource
  • 库对外导出的所有api接口export_api.txt
  • 测试过的api接口tested_api.txt
  • 功能测试文档: 三方库_test_function.md
    • 内容至少包含罗列出库所有的功能,已测试过的功能,原生库测试逻辑的分析
  • 原生库分析文档: 三方库_analyse.md

文档命名不要用中文,如果涉及到编码问题的话,到时候会出现乱码,一般建议不用中文命名!!!

提供OAT.xml文件

OAT开源扫描

  • OAT(OSS Audit Tool)是OpenHarmony社区的自动化开源审视工具,用于帮助开发人员基于自定义的规则自动扫描开源仓代码,识别不符合预定规则的代码并输出扫描报告。
  • OAT下载地址:https://gitee.com/openharmony-sig/tools_oat

工具使用

编译构建:

  • 在linux上安装好javaMaven后,下载OAT工具源码,执行mvn package完成构建。

  • 编译构建成功

在父目录下添加OAT.xml,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.

    This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.

-->

<configuration>
    <oatconfig>
        <licensefile>COPYING</licensefile>
        <policylist>
            <policy name="projectPolicy" desc="">
                <!--policyitem type="compatibility" name="GPL-2.0+" path="abc/.*" desc="Process that runs independently, invoked by the X process."/-->
                <policyitem type="license" name="*" path=".*" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter" desc=""/>
            </policy>
        </policylist>
        <filefilterlist>
            <filefilter name="defaultFilter" desc="Files not to check">
                <filteritem type="filepath" name=".*" desc="原生库文件"/>
            </filefilter>
            <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
                <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
                <filteritem type="filepath" name=".*" desc="原生库代码"/>
            </filefilter>
            <filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
                <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
                <filteritem type="filepath" name=".*" desc="原生库代码"/>
            </filefilter>
            <filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies">
                <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
            </filefilter>
            <filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies">
                <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->

            </filefilter>
            <filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies">
                <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
            </filefilter>
            <filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
                <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
                <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
            </filefilter>

        </filefilterlist>
        <licensematcherlist>
            <!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped.">
                <licensetext name="
                    uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
				 " desc=""/>
                <licensetext name="
                    uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
				 " desc=""/>
            </licensematcher-->
        </licensematcherlist>
    </oatconfig>
</configuration>

在speexdsp根目录下新建空白的OAT_report.text文件,执行命令:

Java –jar ohos_ossaudittool-1.0.jar –s src_dir –r report_file –n selfcheck
  • ohos_ossaudittool-1.0.jar 工具包名,需要带实际路径

  • -s 指定需要检查的代码目录,src_dir 改成要检查的项目路径

  • -r 指定报告输出文件的路径,检查完成后可查看此文件中列出的问题,按指导文档修复

  • report_file

  • -n 检查任务的名称,任意指定,本地检查使用不上。

例如笔者执行的语句为:

sudo java -Dfile.encoding=UTF-8 -jar /home/jiajiahao/Desktop/tools_oat-master/target/ohos_ossaudittool-1.0.jar -s /home/jiajiahao/Desktop/gitee_speexdsp -r /home/jiajiahao/Desktop/gitee_speexdsp/OAT_report.text -n nameOfRepo

扫描结果

执行完上述命令后,OAT_report.text生成内容如下:

同时在speexdsp父目录下生成log文件夹

  • LicenseFile.txt位于OAT工具运行目录的log目录下,此文件记录扫描目录下所有疑似许可证的文件

原生库通过make或者cmake时生成的一些配置文件。如比较通用的config.h配置文件,config.h文件为原生库生成文件,原则上也不做修改,为了避免文件上仓进行代码扫码,可以将文件文件修改后缀名(config.h.in)。相关文档中需要将配置文件使用方法说明。

提供README.OpenSource文件

README.Opensource的格式如下:

[
    {
      "Name": "",				## 库名
      "License": "",			## 开源协议
      "License File": ",		## 开源文件,一般开源项目都会自带该文件
      "Version Number": "",		## 库的版本
      "Owner": "",				## 作者
      "Upstream URL": "",		## 开源库的地址
      "Description": ""			## 库的描述
    }
]

speexdsp的README.OpenSource文件如下:

[
    {
        "Name": "speexdsp",
        "License": "BSD-3-Clause",
        "License File": "COPYING",
        "Version Number": "1.2.1",
        "Owner": "2692032597@qq.com",
        "Upstream URL": "https://speex.org/",
        "Description": "Speexdsp is a speech processing library that goes along with the Speex codec"
    }
]

提供库的分析文档

三方库分析文档如下:

一、确定库实现方式
例如:C/C++/JS/JAVA

二.依赖分析
例如:当前库依赖其他三方库,如下

1)库名1,库仓库地址

2)库名2,库仓库地址

三、license以及版权
例如:一般在license文件或者COPYING中,Apache License V2.0

四、最新一次版本
xx年xx月xx日,版本号xxx

五、功能点分析
(罗列出该库所支持的功能)

六、代码规模
(统计库代码总行数,包括.h/.hpp/.c/.cpp/.cc 等代码相关文件)

提供功能测试文档

文档中需罗列出

  • 库所有的功能
  • 已测试过的功能
  • 原生库测试逻辑的分析

提供导出的api接口列表

1、 导出库对外暴露的所有api接口的列表
2、导出库对外暴露的已测试api接口的列表

十、上传speexdsp至OpenHarmony仓库

配置个人信息

打开git bash,依次输入以下命令:

git config --global user.name "xxxx"   (配置用户名,xxxx为账号用户名,即个人空间地址)
git config --global user.email "xxxxxx@xxx"  (gitee 账号邮箱与签署DCO 的邮箱保持一致即可) 
git config --list         (查看配置情况)
git config --global credential.helper store (解决每次git pull都要输入账号信息的问题)

克隆仓库内容到本地

到个人账号点击并进入contest仓库, fork该仓库:

进入到clone界面,复制clone的链接地址。

执行如下语句:

git clone https://gitee.com/xxxxx/contest.git --depth=1
  • –depth=1意思是只clone当前仓库最新版本,省去一些历史log,避免仓库历史记录过于庞大花费太多clone时间。

  • clone完毕之后,即可在本地目录下看到这个clone的仓库。本地目录所在位置是根据git bash的位置决定的,比如在桌面启动git bash,则clone的仓库会出现在桌面。

利用git lfs机制添加特殊文件

提交三方库时候,文档中有PDF文件时就需要使用利用git lfs机制

git lfs track xxx/xxx.pdf  // 声明该特殊文件到git lfs机制

git add .gitattributes // 添加配置文件

git add xxx/xxx.pdf // 添加具体特殊文件到暂存区中

git lfs ls-files  // 确认相关test_lfs.a 文件是否已经添加到lfs 机制中。

git  add *   //将变更文件加入到暂存区

git commit -s -m  "add xxxxxxxx"  //将暂存区内容签名并提交到本地
  • -s是签名表明这次提交者签名(signoff)
  • -m是对此次提交行为进行备注.
git commit --amend

推送本地修改到账号仓库

现在需要将本地仓库的修改内容推送到gitee上fork后的个人仓库,使用git push命令来完成这个动作。

git push origin master
  • origin指的是自己的仓库对应的原始远程服务器地址;
  • master标识的是想要提交的分支。
  • 可以使用 git remote -v查看配置的远程服务器;
  • git branch -a查看所有的分支。

为了能让大家更好的学习鸿蒙(HarmonyOS NEXT)开发技术,这边特意整理了《鸿蒙开发学习手册》(共计890页),希望对大家有所帮助:https://qr21.cn/FV7h05

《鸿蒙开发学习手册》:

如何快速入门:https://qr21.cn/FV7h05

  1. 基本概念
  2. 构建第一个ArkTS应用
  3. ……

开发基础知识:https://qr21.cn/FV7h05

  1. 应用基础知识
  2. 配置文件
  3. 应用数据管理
  4. 应用安全管理
  5. 应用隐私保护
  6. 三方应用调用管控机制
  7. 资源分类与访问
  8. 学习ArkTS语言
  9. ……

基于ArkTS 开发:https://qr21.cn/FV7h05

  1. Ability开发
  2. UI开发
  3. 公共事件与通知
  4. 窗口管理
  5. 媒体
  6. 安全
  7. 网络与链接
  8. 电话服务
  9. 数据管理
  10. 后台任务(Background Task)管理
  11. 设备管理
  12. 设备使用信息统计
  13. DFX
  14. 国际化开发
  15. 折叠屏系列
  16. ……

鸿蒙开发面试真题(含参考答案):https://qr18.cn/F781PH

鸿蒙开发面试大盘集篇(共计319页):https://qr18.cn/F781PH

1.项目开发必备面试题
2.性能优化方向
3.架构方向
4.鸿蒙开发系统底层方向
5.鸿蒙音视频开发方向
6.鸿蒙车载开发方向
7.鸿蒙南向开发方向

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-04-20 17:06:05       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-20 17:06:05       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-20 17:06:05       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-20 17:06:05       20 阅读

热门阅读

  1. NLP预训练模型

    2024-04-20 17:06:05       12 阅读
  2. 微服务架构中的业务数据可视化设计

    2024-04-20 17:06:05       18 阅读
  3. Linux学习 - 常用和不太常用的实用awk命令

    2024-04-20 17:06:05       14 阅读
  4. go服务k8s容器化之grpc负载均衡

    2024-04-20 17:06:05       12 阅读
  5. Docker实战十一之Redis部署

    2024-04-20 17:06:05       13 阅读
  6. 关于txt导入Excel

    2024-04-20 17:06:05       14 阅读
  7. Scrapy设置随机User-Agent

    2024-04-20 17:06:05       13 阅读
  8. nvm使用指定镜像安装node和npm包

    2024-04-20 17:06:05       13 阅读