15f9996aaSopenharmony_ci#!/usr/bin/env python3 25f9996aaSopenharmony_ci# -*- coding: utf-8 -*- 35f9996aaSopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd. 45f9996aaSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 55f9996aaSopenharmony_ci# you may not use this file except in compliance with the License. 65f9996aaSopenharmony_ci# You may obtain a copy of the License at 75f9996aaSopenharmony_ci# 85f9996aaSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 95f9996aaSopenharmony_ci# 105f9996aaSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 115f9996aaSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 125f9996aaSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135f9996aaSopenharmony_ci# See the License for the specific language governing permissions and 145f9996aaSopenharmony_ci# limitations under the License. 155f9996aaSopenharmony_ci 165f9996aaSopenharmony_ciclass BCWarnInfo: 175f9996aaSopenharmony_ci CHECK_RULE_2_1 = r"规则2.1 部件描述文件中字段须准确。" 185f9996aaSopenharmony_ci 195f9996aaSopenharmony_ci NAME_NO_FIELD = r'缺少 "name" 字段。' 205f9996aaSopenharmony_ci NAME_EMPTY = r'"name" 字段不能为空。' 215f9996aaSopenharmony_ci NAME_FORMAT_ERROR = r"格式错误, 命名规则为: @{organization}/{component_name}。" 225f9996aaSopenharmony_ci NAME_LOWCASE = r'"name" 字段的英文字符均为小写。' 235f9996aaSopenharmony_ci COMPONENT_NAME_FROMAT = r"部件名使用小写加下划线风格命名, 如: unix_like。" 245f9996aaSopenharmony_ci COMPONENT_NAME_FROMAT_LEN = r"部件名不能超过 63 个有效英文字符." 255f9996aaSopenharmony_ci 265f9996aaSopenharmony_ci VERSION_EMPTY = r'"Version" 字段不能为空。' 275f9996aaSopenharmony_ci VERSION_NO_FIELD = r'缺少 "version" 字段。' 285f9996aaSopenharmony_ci VERSION_ERROR = r'"version" 值有误,请检查。' 295f9996aaSopenharmony_ci 305f9996aaSopenharmony_ci SEGMENT_NO_FIELD = r'缺少 "segment" 字段。' 315f9996aaSopenharmony_ci SEGMENT_DESTPATH_NO_FIELD = r'缺少 "segment:destPath" 字段。' 325f9996aaSopenharmony_ci SEGMENT_DESTPATH_EMPTY = r'"segment:destPath" 字段不能为空。' 335f9996aaSopenharmony_ci SEGMENT_DESTPATH_UNIQUE = r'"segment:destPath" 只能有一个路径。' 345f9996aaSopenharmony_ci SEGMENT_DESTPATH_ABS = r'"segment:destPath" 只能为相对路径。' 355f9996aaSopenharmony_ci 365f9996aaSopenharmony_ci COMPONENT_NO_FIELD = r'缺少 "component" 字段。' 375f9996aaSopenharmony_ci COMPONENT_NAME_NO_FIELD = r'缺少 "component:name" 字段。' 385f9996aaSopenharmony_ci COMPONENT_NAME_EMPTY = r'"component:name" 字段不能为空。' 395f9996aaSopenharmony_ci COMPONENT_NAME_VERACITY = r'"component:name" 字段应该与 "name" 字段部件名部分相同。' 405f9996aaSopenharmony_ci COMPONENT_SUBSYSTEM_NO_FIELD = r'缺少 "component:subsystem" 字段。' 415f9996aaSopenharmony_ci COMPONENT_SUBSYSTEM_EMPTY = r'"component:subsystem" 字段不能为空。' 425f9996aaSopenharmony_ci COMPONENT_SUBSYSTEM_LOWCASE = r'"component:subsystem" 值必须为全小写字母。' 435f9996aaSopenharmony_ci COMPONENT_SYSCAP_STRING_EMPTY = r'"component:syscap" 中的值不能为空字符串。' 445f9996aaSopenharmony_ci COMPONENT_SYSCAP_STRING_FORMAT_ERROR = r'''"component:syscap" 中的值命名规则为 "SystemCapability.子系统.部件能力.子能力(可选)"。 455f9996aaSopenharmony_ci 如, SystemCapability.Media.Camera, SystemCapability.Media.Camera.Front。并且每个部分必须为大驼峰命名规则''' 465f9996aaSopenharmony_ci COMPONENT_FEATURES_STRING_EMPTY = r'"component:features" 中的值不能为空字符串。' 475f9996aaSopenharmony_ci COMPONENT_FEATURES_SEPARATOR_ERROR = r'"component:features" 的值须加上部件名为前缀并以 "_" 为分隔符"。' 485f9996aaSopenharmony_ci COMPONENT_FEATURES_FORMAT_ERROR = r'"component:features" 命名格式为 "{componentName}_feature_{featureName}"。' 495f9996aaSopenharmony_ci COMPONENT_AST_NO_FIELD = r'缺少 "component:adapted_system_type" 字段。' 505f9996aaSopenharmony_ci COMPONENT_AST_EMPTY = r'"component:adapted_system_type" 字段不能为空。' 515f9996aaSopenharmony_ci COMPONENT_AST_NO_REP = r'"component:adapted_system_type" 值最多只能有 3 个("mini", "small", "standard")且不能重复。' 525f9996aaSopenharmony_ci COMPONENT_ROM_NO_FIELD = r'缺少 "component:rom" 字段。' 535f9996aaSopenharmony_ci COMPONENT_ROM_EMPTY = r'"component:rom" 字段不能为空。' 545f9996aaSopenharmony_ci COMPONENT_ROM_SIZE_ERROR = r'"component:rom" 非数值或者小于0。' 555f9996aaSopenharmony_ci COMPONENT_ROM_UNIT_ERROR = r'"component:rom" 的单位错误(KB, KByte, MByte, MB, 默认为KByte)' 565f9996aaSopenharmony_ci COMPONENT_RAM_NO_FIELD = r'缺少 "component:ram" 字段。' 575f9996aaSopenharmony_ci COMPONENT_RAM_EMPTY = r'"component:ram" 字段不能为空。' 585f9996aaSopenharmony_ci COMPONENT_RAM_SIZE_ERROR = r'"component:ram" 非数值或者小于等于0。' 595f9996aaSopenharmony_ci COMPONENT_RAM_UNIT_ERROR = r'"component:ram" 的单位错误(KB, KByte, MByte, MB, 默认为KByte)' 605f9996aaSopenharmony_ci COMPONENT_DEPS_NO_FIELD = r'缺少 "component:deps" 字段。'