• Lv0
    粉丝0

积分17 / 贡献0

提问3答案被采纳0文章0

OpenHarmony4.1软总线测试工具SoftBusDumpDeviceInfo 运行失败

liuxinli 显示全部楼层 发表于 2024-7-4 15:04:54
在mac 上 搭建私库   创建自动化脚本时  上传har包到远程仓库时需要输入创建公私钥时输入的密码   这一步怎么自动化   目前使用expect 没有效果

#expect

/usr/bin/expect << EOF

spawn ohpm publish name.har --publish_registry http://*********/repos/ohpm

expect "what is your passphrase of the private key"

send "******\r"  

expect eof

interact   

EOF

您尚未登录,无法参与评论,登录后可以:
参与开源共建问题交流
认同或收藏高质量问答
获取积分成为开源共建先驱

精彩评论7

shixiaocheng

沙发 发表于 2024-7-5 17:09:10
那就添加ohos.permission.DISTRIBUTED_DATASYNC这个权限,例如
inline void AddPermission()
{
    uint64_t tokenId;
    const char *perms[2];
    perms[1] = OHOS_PERMISSION_DISTRIBUTED_SOFTBUS_CENTER;
    perms[0] = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
    NativeTokenInfoParams infoInstance = {
        .dcapsNum = 0,
        .permsNum = 2,
        .aclsNum = 0,
        .dcaps = NULL,
        .perms = perms,
        .acls = NULL,
        .processName = "com.huawei.dmsdp.sxc",
        .aplStr = "system_core",
    };
    tokenId = GetAccessTokenId(&infoInstance);
    SetSelfTokenID(tokenId);
}

liuxinli

发表于 2024-7-8 15:15  IP属地: 上海市

回复 shixiaocheng: 加入此函数后,需要引用accesstoken相关库,再编译时遇到此问题:

Exception: deps validation part_name: 'dsoftbus', target: '//foundation/communication/dsoftbus/tools:SoftBusDumpDeviceInfo', dep: '//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk' failed!!

BUILD.gz 文件如下:

# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//foundation/communication/dsoftbus/dsoftbus.gni")
import("//base/security/access_token/access_token.gni")

ohos_executable("SoftBusDumpDeviceInfo") {
  sources = [ "device_info/get_device_info.c" ]

  include_dirs = [
    "$dsoftbus_root_path/interfaces/kits/common",
    "$dsoftbus_root_path/interfaces/kits/bus_center",
    "$softbus_adapter_common/include",
    "//base/security/access_token/interfaces/innerkits/token_setproc/include",
    "//base/security/access_token/interfaces/innerkits/nativetoken/include",
    "//base/security/access_token/interfaces/innerkits/accesstoken/include"
  ]

  deps = [
    "$dsoftbus_root_path/sdk:softbus_client",
    "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
    "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken",
    "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc"
    ]

  part_name = "dsoftbus"
  subsystem_name = "communication"
}

group("tool") {
  deps = [ ":SoftBusDumpDeviceInfo" ]
}

shixiaocheng

发表于 2024-7-8 17:30  IP属地: 福建省厦门市

回复 liuxinli: 试试添加external_deps =
        [ "access_token:libaccesstoken_sdk",
          "access_token:libnativetoken",
          "access_token:libtoken_setproc",
          "bluetooth:btframework" ]

liuxinli

发表于 2024-7-9 10:05  IP属地: 上海市

回复 shixiaocheng: 加入 “external_deps ” 后可行,但还需要把 get_device_info.c 文件名有 .c 修改成 .cpp  因为 OpenHarmony4.1 版本的"accesstoken_kit.h" 用到了 c++的头文件。

【4 条回复】 查看全部

liuxinli

板凳 发表于 2024-7-8 15:34:34
试过命令行: setenforce 0

再运行:SoftBusDumpDeviceInfo 也是一样

yeyao

地板 发表于 昨天 10:15
共7 条回复,点击查看

Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

返回顶部