源码迁移
stages: - build - migrating-applications source-code-migration: stage: migrating-applications tags: - kunpeng_scanner # 对应gitlab-runner注册时的标签,可选择多个 script: - echo '====== 源码迁移 ======' # 示例 devkit porting src-mig -i wtdbg2-2.5 -c make -r html || [ $? -eq 1 ] && echo 'Warning:扫描报告包含建议项' - devkit porting src-mig -i 待扫描源码的文件夹或压缩包路径 -c 源码的构建命令 -r html || [ $? -eq 1 ] && echo 'Warning:扫描报告包含建议项' - mv ./src-mig*.html ./SourceCodeScanningReport.html artifacts: paths: - SourceCodeScanningReport.html name: src-mig
具体参数说明如表1所示。
参数 |
参数选现 |
参数说明 |
---|---|---|
-i/--input-path |
path |
必选参数。待扫描源码的文件夹或压缩包路径,若存在多个扫描路径需使用英文逗号分割。 例如:/home/test1、/home/test2。 |
-c/--cmd |
cmd |
指定源代码的构建命令,例如:make all。如果扫描的源码只包含解释型语言,则为可选参数,否则为必选参数 |
-s/--source-type |
c,c++,asm,fortran,go, interpreted |
可选参数。待扫描源码类型。 |
-t/--target-os |
target-os |
可选参数。迁移的目标操作系统,如果用户不输入则默认为当前操作系统。 例如:bclinux7.7。 |
-p/--compiler |
gcc,clang |
可选参数。编译器版本,默认为选定目标操作系统的默认GCC版本。 例如:gcc7.8.5 |
-f/--fortran-compiler |
flang-ver |
可选参数。fortran代码的编译器版本,默认为flang2.5.0.1。 |
-b/--build-tool |
make,cmake,automake,go |
可选参数。构建工具,默认make,只有在--source-type中没有c/c++/asm/fortran并且包含go时可以选go。 |
-o/--output |
/home/test/report |
可选参数。扫描报告的存放地址和文件名称,默认存放在当前执行路径下,名称默认为功能名_时间戳_uuid(4位)。 |
--set-timeout |
time |
可选参数。命令行的超时时间,默认无超时时间。 |
-l/--log-level |
0,1,2,3 |
可选参数。设置日志等级,日志等级分类有0(DEBUG)、1(INFO)、2(WARNING)、3(ERROR),默认为1(INFO)。 |
-r/--report-type |
all,json,html,csv |
可选参数。扫描报告的格式,默认为all,即默认生成json、html、csv三种报告。 |
--ignore |
/opt/ignore.json |
可选参数。屏蔽扫描规则信息。 |