未验证 提交 4b01cc5c 编写于 作者: O openharmony_ci 提交者: Gitee

!510 hb supports dependency checking

Merge pull request !510 from lipengzheng_gitee/dep_check
......@@ -16,12 +16,15 @@
# limitations under the License.
#
import os
import sys
from collections import defaultdict
from hb_internal.build.build_process import Build
from hb_internal.set.set import set_product
from hb_internal.common.utils import get_current_time
from hb_internal.common.utils import OHOSException
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),"../../../")))
from scripts.tools_checker import check_build_requried_packages,check_os_version
def add_options(parser):
......@@ -118,6 +121,8 @@ def add_options(parser):
def exec_command(args):
host_info = check_os_version()
check_build_requried_packages(host_info[1])
if len(args.product):
if '@' in args.product[0]:
product, company = args.product[0].split('@')
......
......@@ -16,16 +16,38 @@
# limitations under the License.
#
import os
import sys
from hb_internal import CONFIG_JSON
from hb_internal.common.utils import read_json_file
from hb_internal.common.utils import hb_info
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),"../../../")))
from scripts.tools_checker import check_build_requried_packages,check_os_version
OPTIONS_FUN_LIST = [
{
"para": "check",
"function":"check_dep"
}
]
def add_options(parser):
pass
parser.add_argument('--check',
help='compile-time environment dependencies',
action='store_true')
def exec_command(args):
def check_dep():
host_info = check_os_version()
packages_info = check_build_requried_packages(host_info[1],check=False)
hb_info('necessary_package: {}'.format(','.join(packages_info[0])))
hb_info('installed_package: {}'.format(','.join(packages_info[1])))
hb_info('uninstalled_package: {}'.format(','.join(packages_info[2])))
def check_os_info():
json_data = read_json_file(CONFIG_JSON)
root_path = json_data.get('root_path', 'not set')
board = json_data.get('board', 'not set')
......@@ -42,3 +64,22 @@ def exec_command(args):
hb_info('product path: {}'.format(product_path))
hb_info('device path: {}'.format(device_path))
hb_info('device company: {}'.format(device_company))
def para_to_function(para):
for options in OPTIONS_FUN_LIST:
if options["para"] == para:
eval(options["function"])()
def exec_command(args):
args_list = [e for e in dir(args) if not e.startswith('_')]
for para in args_list:
options_list = []
options_list.append("args.{}".format(para))
for _options in options_list:
if eval(_options):
para_to_function(para)
break
else:
check_os_info()
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册