From 2217be5e2b98d60ea6a5caae1d9dc1dd65cc1646 Mon Sep 17 00:00:00 2001 From: alichinese Date: Wed, 28 Jun 2023 14:47:31 +0800 Subject: [PATCH 1/3] bitbake: optimize host construction bash prefix symbols * The PTY prefix enabled by the original host build is the same as before the build, and it is difficult to identify where the real environment is, so the bash prefix is changed to ">" to identify the PTY that is built Signed-off-by: lixinyu --- src/oebuild/app/main.py | 4 ---- src/oebuild/app/plugins/bitbake/in_container.py | 4 +--- src/oebuild/app/plugins/bitbake/in_host.py | 10 ++++------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/oebuild/app/main.py b/src/oebuild/app/main.py index 60c4c0d..9b1c482 100644 --- a/src/oebuild/app/main.py +++ b/src/oebuild/app/main.py @@ -11,11 +11,7 @@ See the Mulan PSL v2 for more details. ''' import sys -import argparse import pathlib -import shutil -import textwrap -from io import StringIO from collections import OrderedDict import getpass diff --git a/src/oebuild/app/plugins/bitbake/in_container.py b/src/oebuild/app/plugins/bitbake/in_container.py index d497d7c..5fada89 100644 --- a/src/oebuild/app/plugins/bitbake/in_container.py +++ b/src/oebuild/app/plugins/bitbake/in_container.py @@ -51,7 +51,7 @@ class InContainer(BaseBuild): # check docker image if exists docker_proxy = DockerProxy() if not docker_proxy.is_image_exists(parse_compile.docker_image): - logger.error(f'''the docker image does not exists, please run fellow command: + logger.error('''the docker image does not exists, please run fellow command: `oebuild update docker`''') return @@ -107,8 +107,6 @@ class InContainer(BaseBuild): or env.container.short_id is None \ or not self.client.is_container_exists(env.container.short_id): # judge which container - config = self.configure.parse_oebuild_config() - container_config = config.docker container:Container = self.client.container_run_simple( image=docker_image, volumes=volumns) # type: ignore diff --git a/src/oebuild/app/plugins/bitbake/in_host.py b/src/oebuild/app/plugins/bitbake/in_host.py index 3041a51..b467932 100644 --- a/src/oebuild/app/plugins/bitbake/in_host.py +++ b/src/oebuild/app/plugins/bitbake/in_host.py @@ -35,7 +35,7 @@ class InHost(BaseBuild): execute bitbake commands ''' self._init_build_sh(build_dir=os.getcwd()) - self.mk_build_sh(nativesdk_dir=parse_compile.nativesdk_dir, build_dir=os.getcwd()) + self._mk_build_sh(nativesdk_dir=parse_compile.nativesdk_dir, build_dir=os.getcwd()) self.init_bitbake() # add bblayers, this action must before replace local_conf @@ -99,15 +99,13 @@ initialization operations''') self.update_bashrc(new_content) pty.spawn("bash") - def mk_build_sh(self, nativesdk_dir, build_dir): - ''' - xxx - ''' + def _mk_build_sh(self, nativesdk_dir, build_dir): init_sdk_command = f'. {nativesdk_dir}/environment-setup-x86_64-pokysdk-linux' set_template = f'export TEMPLATECONF="{self.configure.source_dir()}/yocto-meta-openeuler/.oebuild"' init_oe_command = f'. {self.configure.source_dir()}/yocto-poky/oe-init-build-env {build_dir}' + ps1_command = 'PS1="\\u\\h:\\W> "' - self._append_build_sh(str_list= [init_sdk_command, set_template, init_oe_command], + self._append_build_sh(str_list= [init_sdk_command, set_template, init_oe_command, ps1_command], build_dir=build_dir) def _init_build_sh(self, build_dir): -- Gitee From eff599bf2558080f5405b8cbc035c37964e2ae8e Mon Sep 17 00:00:00 2001 From: alichinese Date: Wed, 28 Jun 2023 16:37:37 +0800 Subject: [PATCH 2/3] help: Refines command help information * The four commands init, update, generate, and bitbake have been re-described in detail Signed-off-by: lixinyu --- src/oebuild/app/plugins/bitbake/bitbake.py | 6 ++++-- src/oebuild/app/plugins/generate/generate.py | 9 +++++++-- src/oebuild/app/plugins/init/init.py | 13 +++++++++++-- src/oebuild/app/plugins/update/update.py | 18 ++++++++++++++++-- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/oebuild/app/plugins/bitbake/bitbake.py b/src/oebuild/app/plugins/bitbake/bitbake.py index e9fc707..2fb8190 100644 --- a/src/oebuild/app/plugins/bitbake/bitbake.py +++ b/src/oebuild/app/plugins/bitbake/bitbake.py @@ -39,8 +39,10 @@ class Bitbake(OebuildCommand): 'bitbake', 'execute bitbake command', textwrap.dedent(''' - Bitbake instructions can enter the build interactive environment and then directly run bitbake-related instructions, - or run bitbake command directly, for example: `oebuild bitbake busybox` + The bitbake command performs the build operation, and for the build environment, + there are two types, one is to build in docker and the other is to build in the + host. There are also two construction methods, one is to build directly, and the + other is to call up the build environment to be operated freely by the user ''') ) diff --git a/src/oebuild/app/plugins/generate/generate.py b/src/oebuild/app/plugins/generate/generate.py index bea902b..a148df7 100644 --- a/src/oebuild/app/plugins/generate/generate.py +++ b/src/oebuild/app/plugins/generate/generate.py @@ -39,7 +39,12 @@ class Generate(OebuildCommand): 'generate', 'help to mkdir build directory and generate compile.yaml', textwrap.dedent('''\ - compile.yaml is generated according to different command parameters by generate + The generate command is the core command in the entire build process, which + is mainly used to customize the build configuration parameters and generate + a compile.yaml by customizing each parameter. In addition, for a large number + of configuration parameter input is not very convenient, generate provides a + way to specify compile.yaml, users can directly specify the file after + customizing the build configuration file ''' )) @@ -242,7 +247,7 @@ class Generate(OebuildCommand): If the system does not recognize which container image to use, select the following container, enter it numerically, and enter q to exit:''') image_list = check_docker_tag.get_tags() - + for key,value in enumerate(image_list): print(f"{key}, {oebuild_config.docker.repo_url}:{value}") k = input("please entry number:") diff --git a/src/oebuild/app/plugins/init/init.py b/src/oebuild/app/plugins/init/init.py index c71bb79..602a629 100644 --- a/src/oebuild/app/plugins/init/init.py +++ b/src/oebuild/app/plugins/init/init.py @@ -37,8 +37,17 @@ class Init(OebuildCommand): 'init', 'Initialize an OEBUILD working directory', textwrap.dedent('''\ - Initialize an OEBUILD working directory, and execute - all other OEbuild instructions in the initialized directory + Initialize the OEbuild working directory, and after executing this command, + a new directory will be created as the OEBUILD working directory based on the + current path. After initialization, the working directory will create an .oebuild + directory, which stores configuration-related files, currently the directory has + config and compile.yaml.sample two files, config files record environment-related + parameters, mainly the main build warehouse yocto-meta-openeuler related information + and build container related information, compile.yaml.sample is an example file of + the build configuration file, users can copy the file to other places and then make + certain changes according to their own needs。 This file is to meet the user's global + consideration of the build configuration of OEbuild, and can be easily called by third + parties ''' )) diff --git a/src/oebuild/app/plugins/update/update.py b/src/oebuild/app/plugins/update/update.py index 82eae1d..84409a3 100644 --- a/src/oebuild/app/plugins/update/update.py +++ b/src/oebuild/app/plugins/update/update.py @@ -41,8 +41,22 @@ class Update(OebuildCommand): 'update', 'Update the basic environment required for the build', textwrap.dedent(''' - Update the base environment required at build time, such as - updating the necessary docker images and yocto-meta-openeuler repositories + The update command will involve three areas, namely the build container, + yocto-meta-openeuler and the corresponding layers, if there are no parameters + after the update, it will be updated in order yocto-meta-openeuler, build + container and layers, the update of these three places is related, the update + of the build container will be affected by three factors, first, execute the + tag parameter, The container image related to the tag is updated, the second + identifies the build container image bound to the main build repository, in + yocto-meta-openeuler/.oebuild/env.yaml, the third identifies the branch + information of the main build repository, and identifies the type of build image + through the branch information of the main build repository. The layer update must + rely on yocto-meta-openeuler, if the main build repository does not exist will first + download the main build repository (the relevant git information is in .oebuild/config), + the layers update execution logic is different in different directories, if not in + the build directory will be parsed yocto-meta-openeuler/.oebuild/ common.yaml to get + the information that needs to be updated, and if it is in the build directory, it will + parse compile.yaml to get the updated information ''') ) -- Gitee From 5624226836f7522df8760ae90849cb29be6fc338 Mon Sep 17 00:00:00 2001 From: alichinese Date: Wed, 28 Jun 2023 16:39:22 +0800 Subject: [PATCH 3/3] version: upgrade version to 0.0.27 * alter version to 0.0.27 Signed-off-by: lixinyu --- src/oebuild/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oebuild/version.py b/src/oebuild/version.py index d705e18..1c5b7cd 100644 --- a/src/oebuild/version.py +++ b/src/oebuild/version.py @@ -10,4 +10,4 @@ MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. ''' -__version__ = '0.0.26' +__version__ = '0.0.27' -- Gitee