From 8d4be9d7f4df11bc437ec871d94713ed374a21a3 Mon Sep 17 00:00:00 2001 From: alichinese Date: Wed, 16 Aug 2023 17:50:28 +0800 Subject: [PATCH 1/5] generate: format list param info * format oebuild generate -l informattion Signed-off-by: lixinyu --- setup.py | 3 +- src/oebuild/app/plugins/generate/generate.py | 41 +++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/setup.py b/setup.py index 6f9a917..ddbecb8 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,8 @@ setuptools.setup( 'colorama', 'ruamel.yaml', 'dataclasses', - 'reprint' + 'reprint', + 'prettytable' ], python_requires='>=3.8', entry_points={'console_scripts': ('oebuild = oebuild.app.main:main',)}, diff --git a/src/oebuild/app/plugins/generate/generate.py b/src/oebuild/app/plugins/generate/generate.py index a148df7..0913b3b 100644 --- a/src/oebuild/app/plugins/generate/generate.py +++ b/src/oebuild/app/plugins/generate/generate.py @@ -17,6 +17,8 @@ import sys import pathlib from shutil import copyfile +from prettytable import PrettyTable + from oebuild.command import OebuildCommand import oebuild.util as oebuild_util from oebuild.parse_compile import ParseCompile,CheckCompileError @@ -56,9 +58,9 @@ class Generate(OebuildCommand): %(prog)s [-p platform] [-f features] [-t toolchain_dir] [-d build_directory] [-l list] [-b_in build_in] ''') - parser.add_argument('-l', dest='list', choices=['platform', 'feature'], + parser.add_argument('-l', dest='list',action = "store_true", help=''' - with platform will list support archs, with feature will list support features + will list support archs and features ''' ) @@ -198,8 +200,8 @@ class Generate(OebuildCommand): if args.tmp_dir is not None: self.tmp_dir = args.tmp_dir - if args.list is not None: - self.list_info(args=args) + if args.list: + self.list_info() return build_dir = self._init_build_dir(args=args) @@ -257,7 +259,7 @@ following container, enter it numerically, and enter q to exit:''') index = int(k) docker_tag = image_list[index] break - except: + except IndexError: print("please entry true number") docker_tag = docker_tag.strip() docker_tag = docker_tag.strip('\n') @@ -349,16 +351,12 @@ oebuild bitbake os.makedirs(build_dir) return build_dir - def list_info(self, args): + def list_info(self,): ''' print platform list or feature list ''' - if args.list == 'platform': - self._list_platform() - return - if args.list == 'feature': - self._list_feature() - return + self._list_platform() + self._list_feature() def _list_platform(self): logger.info("=============================================") @@ -366,30 +364,35 @@ oebuild bitbake yocto_oebuild_dir = os.path.join(yocto_dir, ".oebuild") list_platform = os.listdir(os.path.join(yocto_oebuild_dir, 'platform')) print("the platform list is:") + table = PrettyTable(['platform name']) + table.align = "l" for platform in list_platform: if platform.endswith('.yml'): - print(platform.replace('.yml', ''), INFO_COLOR) + table.add_row([platform.replace('.yml', '')]) if platform.endswith('.yaml'): - print(platform.replace('.yaml', ''), INFO_COLOR) + table.add_row([platform.replace('.yaml', '')]) + print(table, INFO_COLOR) def _list_feature(self,): - logger.info("=============================================") yocto_dir = self.configure.source_yocto_dir() yocto_oebuild_dir = os.path.join(yocto_dir, ".oebuild") list_feature = os.listdir(os.path.join(yocto_oebuild_dir, 'features')) print("the feature list is:") + table = PrettyTable(['feature name','support arch']) + table.align = "l" for feature in list_feature: if feature.endswith('.yml'): - print(feature.replace('.yml',''), INFO_COLOR) + feature_name = feature.replace('.yml','') if feature.endswith('.yaml'): - print(feature.replace('.yaml',''), INFO_COLOR) + feature_name = feature.replace('.yaml','') feat = oebuild_util.read_yaml(pathlib.Path(os.path.join(yocto_oebuild_dir, 'features', feature))) if "support" in feat: - print(" support arch: %s", feat.get('support')) + table.add_row([feature_name, feat.get('support')]) else: - print(" support arch: all") + table.add_row([feature_name, "all"]) + print(table, INFO_COLOR) def check_support_oebuild(self, yocto_dir): ''' -- Gitee From 43fff6ae9a269828998eecafddfb516c01fdd81e Mon Sep 17 00:00:00 2001 From: alichinese Date: Wed, 16 Aug 2023 19:31:55 +0800 Subject: [PATCH 2/5] config: update oebuild config.yaml * update the map about openEuler Embedded version and docker tag Signed-off-by: lixinyu --- src/oebuild/app/conf/config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/oebuild/app/conf/config.yaml b/src/oebuild/app/conf/config.yaml index ce4cc08..d4e2d94 100644 --- a/src/oebuild/app/conf/config.yaml +++ b/src/oebuild/app/conf/config.yaml @@ -1,9 +1,9 @@ docker: repo_url: swr.cn-north-4.myhuaweicloud.com/openeuler-embedded/openeuler-container tag_map: - openEuler-23.03: latest - master: latest + openEuler-23.03: "23.03" openEuler-22.03-LTS-SP2: 22.03-lts-sp2 + master: latest basic_repo: yocto_meta_openeuler: path: yocto-meta-openeuler -- Gitee From 4e918d87f9be1d3798507a2df6749f941077053a Mon Sep 17 00:00:00 2001 From: alichinese Date: Wed, 16 Aug 2023 19:33:45 +0800 Subject: [PATCH 3/5] version: upgrade version to 0.0.28 * the release log: * format oebuild generate -l infomation * update map about openEuler Embedded version and docker tag 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 1c5b7cd..c1c1845 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.27' +__version__ = '0.0.28' -- Gitee From 9ae448ea5bcb1dccfba5f437767ae4f56ca9f41c Mon Sep 17 00:00:00 2001 From: alichinese Date: Thu, 17 Aug 2023 19:43:18 +0800 Subject: [PATCH 4/5] bitbake: alter bitbake environment * alter volumn about build directory * check container if same drop remote and branch Signed-off-by: lixinyu --- src/oebuild/app/plugins/bitbake/const.py | 2 +- .../app/plugins/bitbake/in_container.py | 15 ++++---------- src/oebuild/parse_env.py | 20 ------------------- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/src/oebuild/app/plugins/bitbake/const.py b/src/oebuild/app/plugins/bitbake/const.py index 3ce2db5..4da16d0 100644 --- a/src/oebuild/app/plugins/bitbake/const.py +++ b/src/oebuild/app/plugins/bitbake/const.py @@ -12,7 +12,7 @@ See the Mulan PSL v2 for more details. BASH_END_FLAG = " ###!!!###" CONTAINER_SRC = '/usr1/openeuler/src' -CONTAINER_BUILD = '/home/openeuler/build' +CONTAINER_BUILD = '/home/openeuler' CONTAINER_USER = "openeuler" BASH_BANNER = ''' diff --git a/src/oebuild/app/plugins/bitbake/in_container.py b/src/oebuild/app/plugins/bitbake/in_container.py index 5fada89..12b008c 100644 --- a/src/oebuild/app/plugins/bitbake/in_container.py +++ b/src/oebuild/app/plugins/bitbake/in_container.py @@ -18,7 +18,6 @@ from oebuild.local_conf import NATIVE_GCC_DIR, SSTATE_CACHE from oebuild.parse_env import ParseEnv, EnvContainer from oebuild.docker_proxy import DockerProxy from oebuild.configure import Configure -from oebuild.ogit import OGit from oebuild.parse_compile import ParseCompile from oebuild.m_log import logger import oebuild.app.plugins.bitbake.const as bitbake_const @@ -55,13 +54,8 @@ class InContainer(BaseBuild): `oebuild update docker`''') return - yocto_dir = os.path.join( - self.configure.source_dir(), "yocto-meta-openeuler") - remote, branch = OGit.get_repo_info(yocto_dir) self.deal_env_container( env=parse_env, - remote=remote, - branch=branch, toolchain_dir=parse_compile.toolchain_dir, sstate_cache=parse_compile.sstate_cache, docker_image=parse_compile.docker_image) @@ -70,8 +64,6 @@ class InContainer(BaseBuild): def deal_env_container(self, env: ParseEnv, - remote: str, - branch: str, toolchain_dir=None, sstate_cache = None, docker_image = ""): @@ -83,9 +75,12 @@ class InContainer(BaseBuild): are inconsistent, you need to create a new container, otherwise directly enable the sleeping container ''' + cwd_name = os.path.basename(os.getcwd()) volumns = [] volumns.append(self.configure.source_dir() + ':' + bitbake_const.CONTAINER_SRC) - volumns.append(self.configure.build_dir() + ':' + bitbake_const.CONTAINER_BUILD) + volumns.append(os.path.join(self.configure.build_dir(), cwd_name) + + ':' + + os.path.join(bitbake_const.CONTAINER_BUILD, cwd_name)) if toolchain_dir is not None: volumns.append(toolchain_dir + ":" + NATIVE_GCC_DIR) @@ -94,8 +89,6 @@ class InContainer(BaseBuild): try: env_container = EnvContainer( - remote=remote, - branch=branch, volumns=volumns, short_id="" ) diff --git a/src/oebuild/parse_env.py b/src/oebuild/parse_env.py index 2e8e4a7..b6c7cd4 100644 --- a/src/oebuild/parse_env.py +++ b/src/oebuild/parse_env.py @@ -21,10 +21,6 @@ class EnvContainer: ''' the container object in env object ''' - remote: str - - branch: str - short_id: Optional[str] volumns: list @@ -64,8 +60,6 @@ class ParseEnv: if "container" in data: env_container = data['container'] self.env.container = EnvContainer( - remote=oebuild_util.add_git_suffix(env_container['remote']), - branch=env_container['branch'], short_id=env_container['short_id'], volumns=env_container['volumns'] ) @@ -74,12 +68,6 @@ class ParseEnv: ''' judge if container same with container in env.yaml ''' - if data.remote is None: - raise ValueError("the key remote is lack") - - if data.branch is None: - raise ValueError("the key branch is lack") - if data.volumns is None: raise ValueError("the key volumns is lack") @@ -89,12 +77,6 @@ class ParseEnv: if self.env.container is None: return False - if self.env.container.remote != data.remote: - return False - - if self.env.container.branch != data.branch: - return False - if len(self.env.container.volumns) != len(data.volumns): return False @@ -121,8 +103,6 @@ class ParseEnv: if self.env.container is not None: container = self.env.container data['container'] = { - 'remote': container.remote, - 'branch': container.branch, 'short_id': container.short_id, 'volumns': container.volumns } -- Gitee From 271b934749e57cdc3c446044f4ddf3879f17764c Mon Sep 17 00:00:00 2001 From: alichinese Date: Thu, 17 Aug 2023 19:48:30 +0800 Subject: [PATCH 5/5] version: upgrade version to 0.0.29 * the release log: * when you start the container, the directory where the build is mounted is changed to the specific build directory * the check on the container when starting the container removes information about the main build 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 c1c1845..0a68310 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.28' +__version__ = '0.0.29' -- Gitee