lbkit 0.6.5__tar.gz → 0.6.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {lbkit-0.6.5/lbkit.egg-info → lbkit-0.6.6}/PKG-INFO +1 -1
  2. lbkit-0.6.6/lbkit/__init__.py +2 -0
  3. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/build_image.py +1 -3
  4. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/build_manifest.py +31 -16
  5. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/build_rootfs.py +6 -0
  6. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/config.py +0 -3
  7. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/template/conanfile.py.mako +1 -1
  8. lbkit-0.6.6/lbkit/integration/template/rootfs.py.mako +27 -0
  9. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/utils/images/emmc.py +2 -22
  10. {lbkit-0.6.5 → lbkit-0.6.6/lbkit.egg-info}/PKG-INFO +1 -1
  11. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit.egg-info/SOURCES.txt +1 -0
  12. lbkit-0.6.5/lbkit/__init__.py +0 -2
  13. {lbkit-0.6.5 → lbkit-0.6.6}/AUTHORS +0 -0
  14. {lbkit-0.6.5 → lbkit-0.6.6}/LICENSE +0 -0
  15. {lbkit-0.6.5 → lbkit-0.6.6}/MANIFEST.in +0 -0
  16. {lbkit-0.6.5 → lbkit-0.6.6}/README.md +0 -0
  17. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/build_conan_parallel.py +0 -0
  18. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/ci_robot/__init__.py +0 -0
  19. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/ci_robot/gitee.py +0 -0
  20. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/cli.py +0 -0
  21. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/__init__.py +0 -0
  22. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/codegen.py +0 -0
  23. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/ctype_defination.py +0 -0
  24. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/idf_interface.py +0 -0
  25. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/renderer.py +0 -0
  26. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/client.c.mako +0 -0
  27. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/client.h.mako +0 -0
  28. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/interface.c.mako +0 -0
  29. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
  30. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/public.c.mako +0 -0
  31. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/public.h.mako +0 -0
  32. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/server.c.mako +0 -0
  33. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/codegen/template/server.h.mako +0 -0
  34. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/component/__init__.py +0 -0
  35. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/component/arg_parser.py +0 -0
  36. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/component/build.py +0 -0
  37. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/component/template/conanbase.mako +0 -0
  38. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/component/template/deploy.mako +0 -0
  39. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/component/test.py +0 -0
  40. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/errors.py +0 -0
  41. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/helper.py +0 -0
  42. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/__init__.py +0 -0
  43. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/build_prepare.py +0 -0
  44. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/integration/task.py +0 -0
  45. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/lbkit.py +0 -0
  46. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/log.py +0 -0
  47. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/misc.py +0 -0
  48. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/tools.py +0 -0
  49. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/utils/__init__.py +0 -0
  50. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit/utils/images/__init__.py +0 -0
  51. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit.egg-info/dependency_links.txt +0 -0
  52. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit.egg-info/entry_points.txt +0 -0
  53. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit.egg-info/requires.txt +0 -0
  54. {lbkit-0.6.5 → lbkit-0.6.6}/lbkit.egg-info/top_level.txt +0 -0
  55. {lbkit-0.6.5 → lbkit-0.6.6}/setup.cfg +0 -0
  56. {lbkit-0.6.5 → lbkit-0.6.6}/setup.py +0 -0
  57. {lbkit-0.6.5 → lbkit-0.6.6}/test/__init__.py +0 -0
  58. {lbkit-0.6.5 → lbkit-0.6.6}/test/test_codegen.py +0 -0
  59. {lbkit-0.6.5 → lbkit-0.6.6}/test/test_helper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.6.6'
@@ -25,8 +25,6 @@ class BuildImage(Task):
25
25
  """任务入口"""
26
26
  """检查manifest文件是否满足schema格式描述"""
27
27
  os.chdir(self.config.output_path)
28
- cmd = "qemu-system-aarch64 -M virt -cpu cortex-a57 -M virt,dumpdtb=virt.dtb"
29
- self.exec(cmd)
30
28
 
31
29
  mk = MekeEmmcImage(os.path.join(self.config.temp_path, "emmc_tmp_dir"))
32
30
  rootfs_size = self.get_manifest_config("metadata/rootfs_size")
@@ -35,7 +33,7 @@ class BuildImage(Task):
35
33
  emmc_size = self.get_manifest_config("metadata/emmc_size")
36
34
  if emmc_size:
37
35
  mk.size_1m = self._trans_to_blk_1m(emmc_size)
38
- mk.run("virt.dtb", self.config.rootfs_img, "qemu.img")
36
+ mk.run(self.config.rootfs_img, "qemu.img")
39
37
  cmd = 'cp /usr/share/litebmc/qemu.conf qemu.conf'
40
38
  self.exec(cmd)
41
39
  output_img = os.path.join(self.config.output_path, "litebmc_qemu.tar.gz")
@@ -68,6 +68,25 @@ class BuildManifest(Task):
68
68
  cmd = f"conan download {pkg} -r {self.config.remote} --only-recipe"
69
69
  self.exec(cmd, ignore_error=True)
70
70
 
71
+ def build_rootfs(self):
72
+ """构建产品rootfs包"""
73
+ log.info("build rootfs")
74
+
75
+ manifest = self.load_manifest()
76
+ # 使用模板生成litebmc组件的配置
77
+ lookup = TemplateLookup(directories=os.path.join(src_cwd, "template"))
78
+ template = lookup.get_template("rootfs.py.mako")
79
+ conanfile = template.render(lookup=lookup, pkg=manifest)
80
+
81
+ recipe = os.path.join(self.conan_build, "rootfs")
82
+ os.makedirs(recipe, exist_ok=True)
83
+ os.chdir(recipe)
84
+ fp = open("conanfile.py", "w", encoding="utf-8")
85
+ fp.write(conanfile)
86
+ fp.close()
87
+
88
+ self.exec("conan create . " + self.common_args)
89
+
71
90
  def build_litebmc(self):
72
91
  """构建产品conan包"""
73
92
  log.info("build litebmc")
@@ -88,23 +107,17 @@ class BuildManifest(Task):
88
107
  fp.close()
89
108
 
90
109
  base_cmd = f"{self.common_args} {self.conan_settings}"
91
- lockfile = os.path.join(self.config.code_path, "conan.lock")
110
+ lockfile = os.path.join(self.config.temp_path, "conan.lock")
92
111
  threadPool = ThreadPoolExecutor(max_workers=16)
93
- # 指定-l参数或conan.lock文件不存在时创建lock文件
94
- if self.config.create_conan_lock or not os.path.isfile(lockfile):
95
- # 创建新的conan.lock文件
96
- for dep in manifest.get("dependencies", []):
97
- pkg = dep.get("package")
98
- threadPool.submit(self.download_recipe, pkg)
99
- lock_cmd = f"conan lock create . {base_cmd} --lockfile-out={lockfile}"
100
- self.exec(lock_cmd)
101
- else:
102
- with open(lockfile, "r") as fp:
103
- lock = json.load(fp)
104
- for key in ["requires", "build_requires", "python_requires", "config_requires"]:
105
- requires = lock.get(key, [])
106
- for require in requires:
107
- threadPool.submit(self.download_recipe, require)
112
+ # 创建新的conan.lock文件
113
+ lock_cmd = f"conan lock create . {base_cmd} --lockfile-out={lockfile}"
114
+ self.exec(lock_cmd)
115
+ with open(lockfile, "r") as fp:
116
+ lock = json.load(fp)
117
+ for key in ["requires", "build_requires", "python_requires", "config_requires"]:
118
+ requires = lock.get(key, [])
119
+ for require in requires:
120
+ threadPool.submit(self.download_recipe, require)
108
121
  threadPool.shutdown(wait=True)
109
122
  graph_cmd = f"conan graph info . {base_cmd} -f json --lockfile={lockfile}"
110
123
  graphfile = os.path.join(self.config.temp_path, "graph.info")
@@ -112,11 +125,13 @@ class BuildManifest(Task):
112
125
  bcp = BuildConanParallel(graphfile, lockfile, self.common_args, self.config.from_source)
113
126
  bcp.build()
114
127
 
128
+ self.exec(f"sed -i 's@rootfs_df190c/0.0.1#.*\"@rootfs_df190c/0.0.1\"@g' {lockfile}")
115
129
  # 部署应用到self.config.conan_install
116
130
  self.deploy(graphfile)
117
131
 
118
132
  def run(self):
119
133
  """任务入口"""
134
+ self.build_rootfs()
120
135
  self.build_litebmc()
121
136
  error = False
122
137
  if not self.config.rootfs_tar:
@@ -127,6 +127,12 @@ class BuildRootfs(Task):
127
127
  if os.path.isdir(product_rootfs):
128
128
  self.copy_conan_install(product_rootfs, mnt_path)
129
129
 
130
+ # 设置boot目录权限
131
+ log.info("设置boot目录权限")
132
+ self.exec(f"chown 0:0 boot/ -R")
133
+ self.exec(f"chmod 600 boot/ -R")
134
+ if os.path.isdir("extlinux"):
135
+ self.exec(f"chmod 700 boot/extlinux/")
130
136
  # 执行rootfs定制化脚本
131
137
  os.chdir(self.config.work_dir)
132
138
  hook_name = "hook.post_rootfs"
@@ -34,8 +34,6 @@ class Config(object):
34
34
  self.profile_build = args.profile_build
35
35
  # 编译目标配置项
36
36
  self.profile_host = args.profile
37
- # 是否创建新的lockfile
38
- self.create_conan_lock = args.create_conan_lock
39
37
 
40
38
  # 设置并创建构建所需目录
41
39
  log.info("Work dir: %s", self.work_dir)
@@ -67,7 +65,6 @@ class Config(object):
67
65
  parser.add_argument("-pr:b", "--profile_build", help="Apply the specified profile to the build machine", default="default")
68
66
  parser.add_argument("-t", "--build_type", type=str, choices=['debug', 'release', 'minsize'], help="Set the build type", default="debug")
69
67
  parser.add_argument("-r", "--remote", help="specified conan server", default="litebmc")
70
- parser.add_argument("-l", "--create_conan_lock", help="Create new conan.lock", action="store_true")
71
68
  return parser
72
69
 
73
70
  def get_manifest_config(self, key: str, default=None):
@@ -20,7 +20,7 @@ class LitebmcConan(ConanFile):
20
20
  % for dep in pkg["dependencies"]:
21
21
  self.requires("${dep["package"]}")
22
22
  % endfor
23
- pass
23
+ self.requires("rootfs_df190c/0.0.1")
24
24
 
25
25
  def configure(self):
26
26
  % for dep in pkg["dependencies"]:
@@ -0,0 +1,27 @@
1
+ import os
2
+ from conan import ConanFile
3
+ <% dts = pkg.get("metadata", {}).get("dts") %>
4
+
5
+ class RootfsConan(ConanFile):
6
+ """用于构建产品的顶层rootfs包"""
7
+ name = "rootfs_df190c"
8
+ settings = "os", "arch", "compiler", "build_type"
9
+ description = "build rootfs component"
10
+ url = "https://litebmc.com"
11
+ extension_properties = {
12
+ "compatibility_cppstd": False,
13
+ "compatibility_cstd": False
14
+ }
15
+ homepage = "https://www.litebmc.com"
16
+ license = "BSL-1.0"
17
+ version = "0.0.1"
18
+
19
+ % if dts:
20
+ def build_requirements(self):
21
+ self.tool_requires("dtc/1.7.0")
22
+
23
+ def build(self):
24
+ os.makedirs(self.package_folder + "/boot")
25
+ self.run(f"dtc -I dts -O dtb ${dts["input"]} -o {self.package_folder}/boot/${dts["output"]}")
26
+
27
+ % endif
@@ -26,7 +26,7 @@ class MakeImage():
26
26
  cmd = "umount " + tmp_dir
27
27
  self.tools.exec(cmd, ignore_error=True, echo_cmd=False)
28
28
 
29
- def run(self, dtb, rootfs, output="emmc.img"):
29
+ def run(self, rootfs, output="emmc.img"):
30
30
  blk_1k = self.misc_blk_1k + self.ubootenv_blk_1k + self.vbmeta_blk_1k
31
31
  blk_1k += self.rootfs_blk_1m * 1024 * 3
32
32
  blk_1k += self.userdata_blk_1m * 1024
@@ -57,26 +57,6 @@ class MakeImage():
57
57
  end += self.rootfs_blk_1m * 1024 * 2
58
58
  self.log.info("创建rootfs镜像区")
59
59
  self.tools.exec(f"parted -s -a none {output} mkpart rootfs_a {start}s {end - 1}s")
60
- self.log.info(f"挂载rootfs分区并复制内容,注意,此时会修改原始{rootfs}镜像并添加dtb以及启动参数")
61
- self.tools.exec(f"fuse2fs {rootfs} {self.tmp_dir} -o fakeroot -o nonempty")
62
- extlinux = os.path.join(self.tmp_dir, "boot/extlinux")
63
- os.makedirs(extlinux, exist_ok=True)
64
- with open(os.path.join(extlinux, "extlinux.conf"), "w+") as fp:
65
- fp.write("menu title U-Boot menu\n")
66
- fp.write("prompt 0\n")
67
- fp.write("timeout 10\n")
68
- fp.write("\n")
69
- fp.write("label litebmc-active\n")
70
- fp.write(" kernel /boot/Image\n")
71
- fp.write(" fdt /boot/litebmc.dtb\n")
72
- fp.write(" append console=ttyAMA0 loglevel=10 rootwait root=/dev/nvme0n1p4 rw\n")
73
- self.tools.exec(f"cp {dtb} {self.tmp_dir}/boot/litebmc.dtb")
74
- self.tools.exec(f"chown 0:0 {self.tmp_dir}/boot/ -R")
75
- self.tools.exec(f"chmod 700 {self.tmp_dir}/boot/extlinux/")
76
- self.tools.exec(f"chmod 600 {self.tmp_dir}/boot/extlinux/extlinux.conf")
77
- self.tools.exec(f"chmod 600 {self.tmp_dir}/boot/Image")
78
- self.tools.exec(f"chmod 600 {self.tmp_dir}/boot/litebmc.dtb")
79
- self.tools.exec(f"umount {self.tmp_dir}")
80
60
  self.log.info("复制镜像文件到rootfs_a区域")
81
61
  self.tools.exec(f"dd if={rootfs} of={output} bs=512 seek={start} conv=notrunc")
82
62
  self.log.info("制作rootfs_b")
@@ -106,4 +86,4 @@ class MakeImage():
106
86
 
107
87
  if __name__ == "__main__":
108
88
  mk = MakeImage()
109
- mk.run("./Image", "./virt.dtb", "./rootfs.img", "./qemu.img")
89
+ mk.run("./rootfs.img", "./qemu.img")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -47,6 +47,7 @@ lbkit/integration/build_rootfs.py
47
47
  lbkit/integration/config.py
48
48
  lbkit/integration/task.py
49
49
  lbkit/integration/template/conanfile.py.mako
50
+ lbkit/integration/template/rootfs.py.mako
50
51
  lbkit/utils/__init__.py
51
52
  lbkit/utils/images/__init__.py
52
53
  lbkit/utils/images/emmc.py
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.6.5'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes