修改PCID以及RPCID大写为小写

Signed-off-by: liutuantuan <liutuantuan1@huawei.com>
This commit is contained in:
liutuantuan
2024-03-22 10:29:54 +08:00
parent f5833664bf
commit 6cebf0e5aa
8 changed files with 65 additions and 65 deletions
+6 -6
View File
@@ -137,7 +137,7 @@ group("syscap_tool_bin_linux") {
}
build_ext_component("generate_pcid") {
outputs = [ "$root_out_dir/PCID.sc" ]
outputs = [ "$root_out_dir/pcid.sc" ]
deps = [ ":syscap_tool_bin_linux" ]
exec_path = rebase_path(root_out_dir)
preload_path = rebase_path(preloader_output_dir)
@@ -148,15 +148,15 @@ build_ext_component("generate_pcid") {
}
command = "chmod 777 $cmd"
command +=
" && $cmd -P -e -i ${preload_path}/system/etc/SystemCapability.json"
" && $cmd -p -e -i ${preload_path}/system/etc/SystemCapability.json"
if (defined(ohos_lite)) {
command += " && mkdir -p $exec_path/system/etc && cp $exec_path/PCID.sc $exec_path/system/etc/PCID.sc"
command += " && mkdir -p $exec_path/system/etc && cp $exec_path/pcid.sc $exec_path/system/etc/pcid.sc"
}
}
ohos_prebuilt_etc("PCID.sc") {
ohos_prebuilt_etc("pcid.sc") {
deps = [ ":generate_pcid" ]
source = "$root_out_dir/PCID.sc"
source = "$root_out_dir/pcid.sc"
subsystem_name = "developtools"
part_name = "syscap_codec"
}
@@ -182,7 +182,7 @@ if (syscap_codec_config_extern_path != "") {
}
group("pcid_sc") {
deps = [ ":PCID.sc" ]
deps = [ ":pcid.sc" ]
}
group("syscap_codec") {
+8 -8
View File
@@ -2,17 +2,17 @@
SysCap(SystemCapability) encoder and decoder tools common usage scenarios as follow
APP development: IDE collect APP required SysCap and API verssion as in RPCID encoder input. And IDE will decode PCID to device SysCap list when it imported. This tool is only for use by the IDE, developers will not be used directly.
APP development: IDE collect APP required SysCap and API verssion as in rpcid encoder input. And IDE will decode pcid to device SysCap list when it imported. This tool is only for use by the IDE, developers will not be used directly.
Main function
1. PCID Encode: Encode SysCap list to PCID.
1. pcid Encode: Encode SysCap list to pcid.
2. PCID Decode: Decode PCID to get system SysCap list.
2. pcid Decode: Decode pcid to get system SysCap list.
3. RPCID Encode: Encode APP required SysCap list to RPCID.
3. rpcid Encode: Encode APP required SysCap list to rpcid.
4. RPCID Decode: Decode RPCID to get APP required SysCap list.
4. rpcid Decode: Decode rpcid to get APP required SysCap list.
## File Structure
@@ -65,13 +65,13 @@ SysCap tools usually integrate to IDE, APP store and bundle tools. Follow instru
```
./syscap_tool --help
./syscap_tool -R/P -e/d -i filepath [-o outpath]
./syscap_tool -r/p -e/d -i filepath [-o outpath]
-h, --help : how to use
-R, --RPCID : encode or decode RPCID
-r, --rpcid : encode or decode rpcid
-P, --PCID : encode or decode PCID
-p, --pcid : encode or decode pcid
-e, --encode : to encode
+25 -25
View File
@@ -2,21 +2,21 @@
系统能力(SystemCapability, 本文中使用SysCap缩写)编解码工具应用场景如下:
应用开发时,IDE会根据应用配置的SysCap和API版本生成描述RPCID(Required Product Compatibility ID)的json文件,并调用编解码工具syscap_tool将该json文件编码成RPCID。另一方面,IDE拿到开发者导入PCID(Product Compatibility ID),使用该工具解码出设备的SysCap集合。该工具仅供IDE使用,对用户不可见。
应用开发时,IDE会根据应用配置的SysCap和API版本生成描述rpcid(Required Product Compatibility ID)的json文件,并调用编解码工具syscap_tool将该json文件编码成rpcid。另一方面,IDE拿到开发者导入pcid(Product Compatibility ID),使用该工具解码出设备的SysCap集合。该工具仅供IDE使用,对用户不可见。
提供的主要功能:
1. PCID编码:对描述SysCap集合的文件编码生成PCID
1. pcid编码:对描述SysCap集合的文件编码生成pcid
2. PCID解码:对编码后的PCID文件解码获取SysCap集合。
2. pcid解码:对编码后的pcid文件解码获取SysCap集合。
3. RPCID编码:对描述应用所需的SysCap集合的文件编码生成RPCID
3. rpcid编码:对描述应用所需的SysCap集合的文件编码生成rpcid
4. RPCID解码:对编码后的RPCID文件解码获取应用所需的SysCap集合。
4. rpcid解码:对编码后的rpcid文件解码获取应用所需的SysCap集合。
5. 编码字符串:将sc后缀形式的PCID/RPCID编码为字符串形式。
5. 编码字符串:将sc后缀形式的pcid/rpcid编码为字符串形式。
6. PCID与RPCID比较:查询PCID是否满足RPCID的要求,并输出不满足的地方。
6. pcid与rpcid比较:查询pcid是否满足rpcid的要求,并输出不满足的地方。
## 代码目录
```
@@ -70,10 +70,10 @@ syscap_tool PC端可执行文件编译步骤:
使用./syscap_tool -h或者./syscap_tool --help查看:
```shell
syscap_tool -R/P -e/d -i filepath [-o outpath]
syscap_tool -r/p -e/d -i filepath [-o outpath]
-h, --help : how to use
-R, --RPCID : encode or decode RPCID
-P, --PCID : encode or decode PCID
-r, --rpcid : encode or decode rpcid
-p, --pcid : encode or decode pcid
-C, --compare : compare pcid with rpcid string format.
-s, --string : input string.
-e, --encode : encode to sc format.
@@ -88,32 +88,32 @@ syscap_tool v1.1.1
```
### 使用示例
```shell
# 将 RPCID.json 编码为SC格式,文件名RPCID.sc
syscap_tool -Rei RPCID.json -o path/
# 将 rpcid.json 编码为SC格式,文件名rpcid.sc
syscap_tool -rei rpcid.json -o path/
# 将 RPCID.sc 编码为JSON格式,文件名RPCID.json
syscap_tool -Rdi RPCID.sc -o path/
# 将 pcid.sc 编码为JSON格式,文件名rpcid.json
syscap_tool -rdi pcid.sc -o path/
# 将 PCID.json 编码为SC格式,文件名PCID.sc
syscap_tool -Pei PCID.json -o path/
# 将 pcid.json 编码为SC格式,文件名pcid.sc
syscap_tool -pei pcid.json -o path/
# 将 PCID.sc 编码为JSON格式,文件名PCID.json
syscap_tool -Pdi PCID.sc -o path/
# 将 pcid.sc 编码为JSON格式,文件名pcid.json
syscap_tool -pdi pcid.sc -o path/
# 将 RPCID.sc 编码为字符串格式,文件名RPCID.txt
syscap_tool -Resi RPCID.sc -o path/
# 将 pcid.sc 编码为字符串格式,文件名rpcid.txt
syscap_tool -resi pcid.sc -o path/
# 将 PCID.sc 编码为字符串格式,文件名PCID.txt
syscap_tool -Pesi PCID.sc -o path/
# 将 pcid.sc 编码为字符串格式,文件名pcid.txt
syscap_tool -pesi pcid.sc -o path/
# 比较字符串格式的PCID和RPCID,pcid 符合条件返回成功提示,不符合则提示原因。
# 比较字符串格式的pcid和rpcid,pcid 符合条件返回成功提示,不符合则提示原因。
syscap_tool -C pcid.txt rpcid.txt
# 功能类似 -C 选项,区别为 -SC 选项为直接输入字符串。
syscap_tool -sC "pcidstring" "rpcidstring"
# 将字符串格式的 pcid 转为 json 格式,文件名 PCID.json。
syscap_tool -Pdsi pcid.txt -o path/
# 将字符串格式的 pcid 转为 json 格式,文件名 pcid.json。
syscap_tool -pdsi pcid.txt -o path/
```
**说明:** -o 选项指定输出目录,缺省为当前目录。
+1 -1
View File
@@ -1,5 +1,5 @@
v2.0.0 reorganize syscap define.
v1.1.2 add syscap "SystemCapability.ArkUI.UiAppearance".
v1.1.1 add compare string pcid with rpcid function.
v1.1.0 add encode/decode string format PCID/RPCID.
v1.1.0 add encode/decode string format pcid/rpcid.
v1.0.0 first release.
+3 -3
View File
@@ -57,7 +57,7 @@ typedef struct ProductCompatibilityID {
uint8_t osSyscap[OS_SYSCAP_BYTES];
} PCIDMain;
static const char *g_pcidPath = "/system/etc/PCID.sc";
static const char *g_pcidPath = "/system/etc/pcid.sc";
struct FreeAfterDecodeRpcidInfo {
char *priSyscap;
@@ -91,7 +91,7 @@ bool EncodeOsSyscap(char *output, int len)
ret = GetFileContext(g_pcidPath, &contextBuffer, &bufferLen);
if (ret != 0) {
PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n");
PRINT_ERR("GetFileContext failed, input file : /system/etc/pcid.sc\n");
return false;
}
@@ -115,7 +115,7 @@ bool EncodePrivateSyscap(char **output, int *outputLen)
ret = GetFileContext(g_pcidPath, &contextBuffer, &bufferLen);
if (ret != 0) {
PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n");
PRINT_ERR("GetFileContext failed, input file : /system/etc/pcid.sc\n");
return false;
}
+3 -3
View File
@@ -213,7 +213,7 @@ int32_t GetPriSyscapLen(uint32_t privateCapSize, cJSON *jsonPriSyscapObj, uint16
static int32_t CheckConvertedContextSaveAsFile(char *outDirPath, PCIDMain *pcidBuffer, uint16_t pcidLength, int32_t ret)
{
const char pcidFileName[] = "PCID.sc";
const char pcidFileName[] = "pcid.sc";
ret = ConvertedContextSaveAsFile(outDirPath, pcidFileName, (char *)pcidBuffer, pcidLength);
if (ret != 0) {
PRINT_ERR("Save as file failed, outDirPath:%s, filename:%s\n", outDirPath, pcidFileName);
@@ -502,7 +502,7 @@ int32_t DecodePCID(char *inputFile, char *outDirPath)
freePcidJsonInfo.sysCapObj = NULL; // avoid being released repeatedly.
char *strJson = cJSON_Print(freePcidJsonInfo.jsonRootObj);
const char outputFileName[] = "PCID.json";
const char outputFileName[] = "pcid.json";
ret = ConvertedContextSaveAsFile(outDirPath, outputFileName, strJson, strlen(strJson));
if (ret != 0) {
PRINT_ERR("ConvertedContextSaveAsFile failed, outDirPath:%s, filename:%s\n", outDirPath, outputFileName);
@@ -706,7 +706,7 @@ int32_t DecodeStringPCIDToJson(char *input, char *outDirPath)
}
// save as json file
char *jsonBuffer = cJSON_Print(rootObj);
const char outputFileName[] = "PCID.json";
const char outputFileName[] = "pcid.json";
if (ConvertedContextSaveAsFile(outDirPath, outputFileName,
jsonBuffer, strlen(jsonBuffer)) != 0) {
PRINT_ERR("Save as json file failed.\n");
+16 -16
View File
@@ -50,8 +50,8 @@ int32_t OperateByBitMap(char *const *argv, uint16_t bitMap, char *outputpath);
static struct option g_longOptions[] = {
{"help", no_argument, 0, 'h' },
{"version", no_argument, 0, 'v' },
{"RPCID", no_argument, 0, 'R' },
{"PCID", no_argument, 0, 'P' },
{"rpcid", no_argument, 0, 'r' },
{"pcid", no_argument, 0, 'p' },
{"compare", required_argument, 0, 'C' },
{"encode", no_argument, 0, 'e' },
{"decode", no_argument, 0, 'd' },
@@ -103,28 +103,28 @@ int32_t OperateByBitMap(char *const *argv, uint16_t bitMap, char *outputpath)
{
int32_t ret = 0;
switch (bitMap) {
case 0x109: // 0x109, -Rei inputfile
case 0x109: // 0x109, -rei inputfile
ret = RPCIDEncode(g_customerfileinfo.inputfile, outputpath); break;
case 0x10A: // 0x10A, -Rdi inputfile
case 0x10A: // 0x10A, -rdi inputfile
ret = RPCIDDecode(g_customerfileinfo.inputfile, outputpath); break;
case 0x10D: // 0x10D, -Resi inputfile
case 0x10D: // 0x10D, -resi inputfile
ret = EncodeRpcidscToString(g_customerfileinfo.inputfile, outputpath); break;
case 0x115: // 0x115, -Pesi inputfile
case 0x115: // 0x115, -pesi inputfile
ret = EncodePcidscToString(g_customerfileinfo.inputfile, outputpath); break;
case 0x60: // 0x60, -C PCID.txt RPCID.txt
case 0x60: // 0x60, -C pcid.txt rpcid.txt
ret = ComparePcidWithRpcidString(g_customerfileinfo.pcidfile, g_customerfileinfo.rpcidfile, TYPE_FILE);
break;
case 0x64: // 0x64, -sC "pcidstring" "rpcidstring"
case 0x64: // 0x64, -sc "pcidstring" "rpcidstring"
ret = ComparePcidWithRpcidString(g_customerfileinfo.pcidfile, g_customerfileinfo.rpcidfile, TYPE_STRING);
break;
case 0x111: // 0x111, -Pei inputfile
case 0x111: // 0x111, -pei inputfile
ret = CreatePCID(g_customerfileinfo.inputfile, outputpath); break;
case 0x112: // 0x112, -Pdi inputfile
case 0x112: // 0x112, -pdi inputfile
ret = DecodePCID(g_customerfileinfo.inputfile, outputpath); break;
case 0x116: // 0x116, -Pdsi inputfile
case 0x116: // 0x116, -pdsi inputfile
ret = DecodeStringPCIDToJson(g_customerfileinfo.inputfile, outputpath); break;
case 0x10E: // 0x10E, -Rdsi inputfile
printf("-Rdsi is not support currently.\n"); break;
case 0x10E: // 0x10E, -rdsi inputfile
printf("-rdsi is not support currently.\n"); break;
case 0x80: // 0x80, -v
(void)OutputVersion(argv[optind], optind); break;
default:
@@ -186,10 +186,10 @@ void PrintVersion(void)
void PrintHelp(void)
{
printf("syscap_tool -R/P -e/d -i filepath [-o outpath]\n");
printf("syscap_tool -r/p -e/d -i filepath [-o outpath]\n");
printf("-h, --help\t: how to use\n");
printf("-R, --RPCID\t: encode or decode RPCID\n");
printf("-P, --PCID\t: encode or decode PCID\n");
printf("-r, --rpcid\t: encode or decode rpcid\n");
printf("-p, --pcid\t: encode or decode pcid\n");
printf("-C, --compare\t: compare pcid with rpcid string format.\n\t"
"-s, --string : input string.\n");
printf("-e, --encode\t: encode to sc format.\n\t-s, --string : encode to string format.\n");
+3 -3
View File
@@ -179,7 +179,7 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath)
if (ret == -1) {
return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret);
}
ret = ConvertedContextSaveAsFile(outputPath, "RPCID.sc", convertedBuffer, convertedBufLen);
ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen);
if (ret != 0) {
PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath);
}
@@ -258,7 +258,7 @@ int32_t RPCIDDecode(char *inputFile, char *outputPath)
// save to json file
convertedBuffer = cJSON_Print(rpcidRoot);
ret = ConvertedContextSaveAsFile(outputPath, "RPCID.json", convertedBuffer, strlen(convertedBuffer));
ret = ConvertedContextSaveAsFile(outputPath, "rpcid.json", convertedBuffer, strlen(convertedBuffer));
if (ret != 0) {
PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.json\n", outputPath);
goto FREE_RPCID_ROOT;
@@ -333,7 +333,7 @@ static int32_t PrintOutputToFile(struct FreeAfterEncodeRpcidscInfo freeAfterEnco
}
}
const char outputFilename[] = "RPCID.txt";
const char outputFilename[] = "rpcid.txt";
ret = ConvertedContextSaveAsFile(outDirPath, outputFilename, freeAfterEncodeRpcidscInfo.outBuffer,
strlen(freeAfterEncodeRpcidscInfo.outBuffer));
if (ret != 0) {