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

!638 delete patch_ohos_para function

Merge pull request !638 from chenmudan/cherry-pick-1670393845
...@@ -131,7 +131,7 @@ def add_options(parser): ...@@ -131,7 +131,7 @@ def add_options(parser):
default='default') default='default')
parser.add_argument('--build-variant', parser.add_argument('--build-variant',
help='specifies device operating mode', help='specifies device operating mode',
default='user') default='root')
parser.add_argument('--share-ccache', parser.add_argument('--share-ccache',
default="", default="",
help='It is customized path to place ccache, which allow' help='It is customized path to place ccache, which allow'
......
...@@ -158,7 +158,6 @@ class Build(): ...@@ -158,7 +158,6 @@ class Build():
else: else:
if not cmd_args.get('disable_post_build'): if not cmd_args.get('disable_post_build'):
post_build = PostBuild(self.config) post_build = PostBuild(self.config)
post_build.patch_ohos_para(cmd_args)
if not cmd_args.get('disable_package_image'): if not cmd_args.get('disable_package_image'):
post_build.package_image() post_build.package_image()
if not disable_post_build_args or 'output_part_rom_status' not in disable_post_build_args: if not disable_post_build_args or 'output_part_rom_status' not in disable_post_build_args:
...@@ -236,6 +235,8 @@ class Build(): ...@@ -236,6 +235,8 @@ class Build():
os_level = self.config.os_level os_level = self.config.os_level
if cmd_args.get('build_variant'): if cmd_args.get('build_variant'):
self.register_args('build_variant', cmd_args.get('build_variant')) self.register_args('build_variant', cmd_args.get('build_variant'))
if cmd_args.get('device_type'):
self.register_args('device_type', cmd_args.get('device_type'))
gn_cmd = [ gn_cmd = [
gn_path, gn_path,
'gen', 'gen',
......
...@@ -20,7 +20,7 @@ import os ...@@ -20,7 +20,7 @@ import os
import subprocess import subprocess
from datetime import datetime from datetime import datetime
from distutils.spawn import find_executable from distutils.spawn import find_executable
from hb_internal.common.utils import OHOSException, exec_command from hb_internal.common.utils import exec_command
from hb_internal.common.utils import hb_warning from hb_internal.common.utils import hb_warning
...@@ -109,39 +109,6 @@ class PostBuild: ...@@ -109,39 +109,6 @@ class PostBuild:
self.get_warning_list() self.get_warning_list()
if not disable_post_build_args or 'compute_overlap_rate' not in disable_post_build_args: if not disable_post_build_args or 'compute_overlap_rate' not in disable_post_build_args:
self.compute_overlap_rate() self.compute_overlap_rate()
def patch_ohos_para(self, cmd_args):
ohos_para_data = []
ohos_para_file_path = os.path.join(self._out_path, 'packages/phone/system/etc/param/ohos.para')
if not os.path.exists(ohos_para_file_path):
return
with open(ohos_para_file_path, 'r', encoding='utf-8') as ohos_para_file:
for line in ohos_para_file:
ohos_para_data.append(line)
if cmd_args.get('device_type') and cmd_args.get('device_type') != 'default':
for i, line in enumerate(ohos_para_data):
if ohos_para_data[i].__contains__('const.build.characteristics'):
ohos_para_data[i] = 'const.build.characteristics=' + cmd_args.get('device_type') + '\n'
break
if cmd_args.get('build_variant'):
if cmd_args.get('build_variant') != 'user' and cmd_args.get('build_variant') != 'root':
raise OHOSException('Error: --build-variant support user or root mode currently')
for i, line in enumerate(ohos_para_data):
if ohos_para_data[i].__contains__('const.secure'):
if cmd_args.get('build_variant') == 'user':
ohos_para_data[i] = 'const.secure=1\n'
else:
ohos_para_data[i] = 'const.secure=0\n'
if ohos_para_data[i].__contains__('const.debuggable'):
if cmd_args.get('build_variant') == 'user':
ohos_para_data[i] = 'const.debuggable=0\n'
else:
ohos_para_data[i] = 'const.debuggable=1\n'
data = ''
for line in ohos_para_data:
data += line
with open(ohos_para_file_path, 'w', encoding='utf-8') as ohos_para_file:
ohos_para_file.write(data)
def package_image(self): def package_image(self):
image_path = os.path.join(self._out_path, 'packages/phone/images/') image_path = os.path.join(self._out_path, 'packages/phone/images/')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册