diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8bfe41369dcc600b12b6264773bb848630062543..da8784f5d6b73b12b7aeb4994b7075c61cb46cb3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -331,7 +331,7 @@ build: - DISTRO: [oniro-openharmony-linux] OPENHARMONY_VERSION: ["3.0"] MACHINE: [qemuarma7] - RECIPE: [oniro-openharmony-toolchain, oniro-openharmony-bundle, openharmony-standard-image] + RECIPE: [oniro-openharmony-toolchain, oniro-openharmony-bundle, openharmony-standard-image, openharmony-tools] artifacts: paths: - build/tmp-*/deploy/images/${MACHINE} diff --git a/README.md b/README.md index b63d7cb3e4085530c4efe853633de2c5a1fc67ff..143d828cf226a1570788bf7dac9ca8281b8c55ae 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,14 @@ quickly building and running OpenHarmony code in QEMU ARM simulator. See [recipes-openharmony/images/README.md](recipes-openharmony/images/README.md) for more information. +## OpenHarmony host tools + +To facilitate working with OpenHarmony systems, an image with various host tools +is provided. + +See [recipes-openharmony/tools/README.rst](recipes-openharmony/tools/README.rst) +for more information. + ## OpenHarmony prebuilts The meta-openharmony layer enables building of prebuilts for use with the diff --git a/recipes-connectivity/libuv/libuv_%s.bbappend b/recipes-connectivity/libuv/libuv_%s.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..05066f460c6acfa74718bcac303ac8d1d797aa3e --- /dev/null +++ b/recipes-connectivity/libuv/libuv_%s.bbappend @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +BBCLASSEXTEND += "nativesdk" diff --git a/recipes-devtools/hdc/hdc_1.1.1l.bb b/recipes-devtools/hdc/hdc_1.1.1l.bb index 6bc8dd7569765e74bcfb3f02738bf00345ac36cc..9c370f3247edd634a9acf27efafba6ee8e54db66 100644 --- a/recipes-devtools/hdc/hdc_1.1.1l.bb +++ b/recipes-devtools/hdc/hdc_1.1.1l.bb @@ -16,4 +16,8 @@ SRC_URI += "file://libusb-include-path.patch" DEPENDS += "libusb1 libuv openssl lz4 libboundscheck" -BBCLASSEXTEND = "native" +do_install:append() { + ln -sfT hdc ${D}${bindir}/hdc_std +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-devtools/xdevice/files/python-version-compare-fix.patch b/recipes-devtools/xdevice/files/python-version-compare-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..0f1bcc0bc6732f973ee8846f34a921ac51272aff --- /dev/null +++ b/recipes-devtools/xdevice/files/python-version-compare-fix.patch @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Handle compare with Python 3.10 and newer. + +Signed-off-by: Esben Haabendal <esben@geanix.com> +Upstream-Status: Pending + +diff --git a/src/xdevice/_core/command/console.py b/src/xdevice/_core/command/console.py +index 9e448ba8d7e3..122da3c974fb 100644 +--- a/src/xdevice/_core/command/console.py ++++ b/src/xdevice/_core/command/console.py +@@ -22,6 +22,7 @@ import platform + import signal + import sys + import threading ++from packaging import version + + from _core.config.config_manager import UserConfigManager + from _core.constants import SchedulerType +@@ -84,7 +85,7 @@ class Console(object): + """ + Main xDevice console providing user with the interface to interact + """ +- if sys.version < '3.7': ++ if version.parse(sys.version.split(' ')[0]) < version.parse('3.7'): + LOG.error("Please use python 3.7 or higher version to " + "start project") + sys.exit(0) +diff --git a/src/xdevice/_core/report/__main__.py b/src/xdevice/_core/report/__main__.py +index 33d3a492029c..0a9124f8c2e1 100644 +--- a/src/xdevice/_core/report/__main__.py ++++ b/src/xdevice/_core/report/__main__.py +@@ -19,6 +19,7 @@ + import os + import sys + import time ++from packaging import version + + from _core.logger import platform_logger + from _core.report.reporter_helper import ExecInfo +@@ -29,7 +30,7 @@ LOG = platform_logger("ReportMain") + + + def main_report(): +- if sys.version < '3.7': ++ if version.parse(sys.version.split(' ')[0]) < version.parse('3.7'): + LOG.error("Please use python 3.7 or higher version to start " + "project") + return diff --git a/recipes-devtools/xdevice/xdevice-extension_2.11.0.1091.bb b/recipes-devtools/xdevice/xdevice-extension_2.11.0.1091.bb new file mode 100644 index 0000000000000000000000000000000000000000..eb8376e61b9989e08c090d982891e9471ed158bf --- /dev/null +++ b/recipes-devtools/xdevice/xdevice-extension_2.11.0.1091.bb @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +DESCRIPTION = "XDevice, a core module of the OpenHarmony test framework, provides services on which test case execution depends." +SUMMARY = "Tool for remote test execution in OpenHarmony test framework" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://../LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" + +SRC_URI += "git://gitee.com/openharmony/test_xdevice.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=b0845abc4da7c5deef3335f7052ec9fa29ef4c34;lfs=0" +S = "${WORKDIR}/git/extension" + +inherit setuptools3 + +RDEPENDS:${PN} += "python3-setuptools" + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-devtools/xdevice/xdevice_2.11.0.1091.bb b/recipes-devtools/xdevice/xdevice_2.11.0.1091.bb new file mode 100644 index 0000000000000000000000000000000000000000..786f345c9ab6f3f8d680a7af9e619a8bab6d1c11 --- /dev/null +++ b/recipes-devtools/xdevice/xdevice_2.11.0.1091.bb @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +DESCRIPTION = "XDevice, a core module of the OpenHarmony test framework, provides services on which test case execution depends." +SUMMARY = "Tool for remote test execution in OpenHarmony test framework" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" + +SRC_URI += "git://gitee.com/openharmony/test_xdevice.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=b0845abc4da7c5deef3335f7052ec9fa29ef4c34;lfs=0" +S = "${WORKDIR}/git" + +SRC_URI += "file://python-version-compare-fix.patch" + +inherit setuptools3 + +RDEPENDS:${PN} += "python3-setuptools python3-packaging xdevice-extension" + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-openharmony/tools/README.rst b/recipes-openharmony/tools/README.rst new file mode 100644 index 0000000000000000000000000000000000000000..94f14cb5e2704b2604901dbfef66388c25ad2983 --- /dev/null +++ b/recipes-openharmony/tools/README.rst @@ -0,0 +1,48 @@ +.. SPDX-FileCopyrightText: Huawei Inc. +.. +.. SPDX-License-Identifier: CC-BY-4.0 + +.. _OpenHarmony SDK: + +OpenHarmony Tools +################# + +OpenHarmony provides a number of dedicated host tools for working with +OpenHarmony systems. + +The `openharmony-tools` recipe bundles up these tools for easy installation of these on a Linux host OS. + + +Building +******** + +To build `openharmony-tools` for OpenHarmony 3.0.1, an initialized build +environment is required:: + + TEMPLATECONF=../meta-openharmony/conf source oe-core/oe-init-build-env + +Once that is in place, the `bitbake` command is simply:: + + DISTRO=oniro-openharmony-linux MACHINE=qemuarma7 bitbake openharmony-tools + + +Installation +************ + +To install the tools on a Linux host OS, you need to use the shell script +installer. To install into /opt/openharmony-tools do something like this: + +.. code-block:: console + + $ ./openharmony-tools-3.0-cortexa7-neon-vfpv4-1.99.99.sh -y -d /opt/openharmony-tools + +As the installation above will explain, in order to use the tools you need to do the following: + +In order to use the installed tools, you need to setup your shell environment +(this needs to be done each time you create a new shell): + +.. code-block:: console + + $ . /opt/openharmony-tools/environment-setup-x86_64-oesdk-linux + +And with that, you will have access to `hdc` and `xdevice` commands. diff --git a/recipes-openharmony/tools/openharmony-tools.bb b/recipes-openharmony/tools/openharmony-tools.bb new file mode 100644 index 0000000000000000000000000000000000000000..4660f81ab2f45fcf088a748b3f36f76b01760e30 --- /dev/null +++ b/recipes-openharmony/tools/openharmony-tools.bb @@ -0,0 +1,67 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +SUMMARY = "OpenHarmony development tools" +LICENSE = "Apache-2.0" + +require sanity-check.inc + +TOOLCHAIN_HOST_TASK = "nativesdk-hdc nativesdk-xdevice" + +TOOLCHAIN_TARGET_TASK = "" + +TOOLCHAIN_OUTPUTNAME = "${PN}-${OPENHARMONY_VERSION}-${TUNE_PKGARCH}-${SDK_VERSION}" +SDK_TITLE = "OpenHarmony tools" +SDK_VERSION ?= "${DISTRO_VERSION}" + +RDEPENDS = "${TOOLCHAIN_HOST_TASK}" + +inherit populate_sdk +inherit toolchain-scripts-base +inherit nopackages + +deltask install +deltask populate_sysroot + +do_populate_sdk[stamp-extra-info] = "${PACKAGE_ARCH}" + +create_sdk_files:append () { + rm -f ${SDK_OUTPUT}/${SDKPATH}/site-config-* + rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-* + rm -f ${SDK_OUTPUT}/${SDKPATH}/version-* + + # Generate new (mini) sdk-environment-setup file + script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}} + touch $script + echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${sbindir_nativesdk}:${SDKPATHNATIVE}${base_bindir_nativesdk}:${SDKPATHNATIVE}${base_sbindir_nativesdk}:$PATH' >> $script + echo 'export PYTHONPATH=${SDKPATHNATIVE}${libdir_nativesdk}/python*/site-packages:$PYTHONPATH' >> $script + echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script + if [ -e "${SDK_OUTPUT}${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt" ]; then + echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script + echo 'export SSL_CERT_FILE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script + fi + + toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS} + + cat >> $script <<EOF +if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then + for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do + . \$envfile + done +fi +# We have to unset this else it can confuse oe-selftest and other tools +# which may also use the overlapping namespace. +unset OECORE_NATIVE_SYSROOT +EOF + + if [ "${SDKMACHINE}" = "i686" ]; then + echo 'export NO32LIBS="0"' >>$script + echo 'echo "$BB_ENV_PASSTHROUGH_ADDITIONS" | grep -q "NO32LIBS"' >>$script + echo '[ $? != 0 ] && export BB_ENV_PASSTHROUGH_ADDITIONS="NO32LIBS $BB_ENV_PASSTHROUGH_ADDITIONS"' >>$script + fi +} + +TOOLCHAIN_NEED_CONFIGSITE_CACHE = "" + +INHIBIT_DEFAULT_DEPS = "1" diff --git a/recipes-openharmony/tools/sanity-check.inc b/recipes-openharmony/tools/sanity-check.inc new file mode 100644 index 0000000000000000000000000000000000000000..bba5400419912d2be181e6bab413cb565b58e91c --- /dev/null +++ b/recipes-openharmony/tools/sanity-check.inc @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# Skip recipe if openharmony is not in DISTRO_FEATURES +inherit features_check +REQUIRED_DISTRO_FEATURES = "openharmony"