lbkit 0.6.0__tar.gz → 0.6.1__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 (55) hide show
  1. {lbkit-0.6.0/lbkit.egg-info → lbkit-0.6.1}/PKG-INFO +3 -3
  2. lbkit-0.6.1/lbkit/__init__.py +2 -0
  3. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/build_conan_parallel.py +9 -1
  4. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/component/build.py +4 -1
  5. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/component/template/conanbase.mako +13 -3
  6. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/build_rootfs.py +5 -37
  7. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/tools.py +5 -2
  8. {lbkit-0.6.0 → lbkit-0.6.1/lbkit.egg-info}/PKG-INFO +3 -3
  9. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit.egg-info/requires.txt +2 -2
  10. {lbkit-0.6.0 → lbkit-0.6.1}/setup.py +1 -1
  11. lbkit-0.6.0/lbkit/__init__.py +0 -2
  12. {lbkit-0.6.0 → lbkit-0.6.1}/AUTHORS +0 -0
  13. {lbkit-0.6.0 → lbkit-0.6.1}/LICENSE +0 -0
  14. {lbkit-0.6.0 → lbkit-0.6.1}/MANIFEST.in +0 -0
  15. {lbkit-0.6.0 → lbkit-0.6.1}/README.md +0 -0
  16. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/ci_robot/__init__.py +0 -0
  17. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/ci_robot/gitee.py +0 -0
  18. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/cli.py +0 -0
  19. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/__init__.py +0 -0
  20. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/codegen.py +0 -0
  21. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/ctype_defination.py +0 -0
  22. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/idf_interface.py +0 -0
  23. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/renderer.py +0 -0
  24. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/client.c.mako +0 -0
  25. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/client.h.mako +0 -0
  26. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/interface.c.mako +0 -0
  27. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
  28. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/public.c.mako +0 -0
  29. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/public.h.mako +0 -0
  30. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/server.c.mako +0 -0
  31. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/codegen/template/server.h.mako +0 -0
  32. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/component/__init__.py +0 -0
  33. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/component/arg_parser.py +0 -0
  34. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/component/template/deploy.mako +0 -0
  35. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/component/test.py +0 -0
  36. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/errors.py +0 -0
  37. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/helper.py +0 -0
  38. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/__init__.py +0 -0
  39. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/build_image.py +0 -0
  40. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/build_manifest.py +0 -0
  41. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/build_prepare.py +0 -0
  42. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/config.py +0 -0
  43. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/task.py +0 -0
  44. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/integration/template/conanfile.py.mako +0 -0
  45. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/lbkit.py +0 -0
  46. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/log.py +0 -0
  47. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit/misc.py +0 -0
  48. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit.egg-info/SOURCES.txt +0 -0
  49. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit.egg-info/dependency_links.txt +0 -0
  50. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit.egg-info/entry_points.txt +0 -0
  51. {lbkit-0.6.0 → lbkit-0.6.1}/lbkit.egg-info/top_level.txt +0 -0
  52. {lbkit-0.6.0 → lbkit-0.6.1}/setup.cfg +0 -0
  53. {lbkit-0.6.0 → lbkit-0.6.1}/test/__init__.py +0 -0
  54. {lbkit-0.6.0 → lbkit-0.6.1}/test/test_codegen.py +0 -0
  55. {lbkit-0.6.0 → lbkit-0.6.1}/test/test_helper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -14,12 +14,12 @@ License-File: AUTHORS
14
14
  Requires-Dist: pyyaml
15
15
  Requires-Dist: colorama
16
16
  Requires-Dist: mako
17
- Requires-Dist: node-semver==0.6.1
17
+ Requires-Dist: node-semver>=0.6.1
18
18
  Requires-Dist: jsonschema
19
19
  Requires-Dist: conan
20
20
  Requires-Dist: requests
21
21
  Requires-Dist: gitpython
22
22
  Requires-Dist: inflection
23
- Requires-Dist: meson==1.4.0
23
+ Requires-Dist: meson>=1.4.0
24
24
 
25
25
  build and code generate tools
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.6.1'
@@ -1,6 +1,7 @@
1
1
  """任务基础类"""
2
2
  import os
3
3
  import json
4
+ import tempfile
4
5
  from queue import Queue
5
6
  from threading import Thread
6
7
  from lbkit.log import Logger
@@ -92,7 +93,7 @@ class BuildConanParallel(object):
92
93
  self.exception = e
93
94
  self.queue.put(cp)
94
95
 
95
- def build(self):
96
+ def _build(self):
96
97
  with open(self.graphinfo, "r") as fp:
97
98
  grapth = json.load(fp)
98
99
  nodes = grapth.get("graph", {}).get("nodes", {})
@@ -195,3 +196,10 @@ class BuildConanParallel(object):
195
196
  dep.building = False
196
197
  dep.binary_exist = True
197
198
 
199
+
200
+ def build(self):
201
+ cwd = os.getcwd()
202
+ tmp = tempfile.TemporaryDirectory()
203
+ os.chdir(tmp.name)
204
+ self._build()
205
+ os.chdir(cwd)
@@ -190,10 +190,13 @@ class BuildComponent():
190
190
  def build(self):
191
191
  log.info(os.getcwd())
192
192
 
193
+ export_cmd = f"conan export . --user={self.user} --channel={self.channel}"
194
+ tools.run(export_cmd, capture_output=False)
195
+
193
196
  lockfile = os.path.join(cwd, ".temp", "conan.lock")
194
197
  graphfile = os.path.join(cwd, ".temp", "graph.info")
195
198
  lock_cmd = f"conan lock create . {self.base_cmd} --lockfile-out={lockfile}"
196
- tools.exec(lock_cmd)
199
+ tools.run(lock_cmd, capture_output=False)
197
200
  graph_cmd = f"conan graph info . {self.base_cmd} -f json --lockfile={lockfile}"
198
201
  tools.pipe([graph_cmd], out_file=graphfile)
199
202
  log.success(f"start build dependency packages of {self.package}")
@@ -77,9 +77,19 @@ class LiteBmcConan(ConanFile):
77
77
  files.update_conandata(self, {"sources": {"commit": None, "url": None, "pwd": os.getcwd()}})
78
78
  return
79
79
 
80
- scm_url, scm_commit = git.get_url_and_commit()
81
- if not scm_url.startswith("https://"):
82
- print(f"url not startswith https://, use fake conandata.yml instead")
80
+ scm_url = None
81
+ remotes = git.run("remote -v")
82
+ checked_name = []
83
+ for r in remotes.splitlines():
84
+ name, url = r.split(maxsplit=1)
85
+ if name in checked_name:
86
+ continue
87
+ checked_name.append(name)
88
+ url, scm_commit = git.get_url_and_commit(remote=name)
89
+ if url.startswith("https://"):
90
+ scm_url = url
91
+ break
92
+ if not scm_url:
83
93
  files.update_conandata(self, {"sources": {"commit": None, "url": None, "pwd": os.getcwd()}})
84
94
  return
85
95
  files.update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}})
@@ -90,7 +90,7 @@ class BuildRootfs(Task):
90
90
  src_dir += "/"
91
91
  cmd = f"rsync -aHK --exclude 'include' --exclude '*.a' --chown=0:0 {src_dir} {mnt_path}"
92
92
  log.info("copy %s to %s", src_dir, mnt_path)
93
- self.exec_easy(cmd, capture_output=False)
93
+ self.exec(cmd, echo_cmd=False)
94
94
  for root, dirs, files in os.walk(src_dir):
95
95
  root = root.replace(src_dir, "")
96
96
  for dir in dirs:
@@ -105,6 +105,10 @@ class BuildRootfs(Task):
105
105
  continue
106
106
  cmd = f"chown 0:0 {name}"
107
107
  self.exec(cmd, echo_cmd=False)
108
+ strip = self.get_manifest_config("metadata/strip")
109
+ if strip:
110
+ cmds = [f"file {name}", "grep \"not stripped\", "f"{self.config.strip} -s {name}"]
111
+ self.pipe(cmds, error_log="", ignore_error=True)
108
112
  per_file = os.path.join(src_dir, "permissions")
109
113
  self.do_permission(per_file)
110
114
 
@@ -146,42 +150,6 @@ class BuildRootfs(Task):
146
150
  cmd = "rm " + os.path.join(self.config.mnt_path, "permissions")
147
151
  self.exec(cmd)
148
152
 
149
- # 清理冗余静态文件
150
- cmds = ["find " + self.config.mnt_path + " -name *.a -type f", "xargs -i{} rm {} -f"]
151
- self.pipe(cmds)
152
-
153
- # 按manifest配置的大小调整rootfs
154
- strip = self.get_manifest_config("metadata/strip")
155
- if strip:
156
- log.info("Start strip files")
157
- file_list = os.path.join(self.config.temp_path, "strip.filelist")
158
- unstrip_regex = [
159
- "*.yaml$",
160
- "*.mo$",
161
- "*.target$",
162
- "*.service$",
163
- "*.md$",
164
- "*.html$",
165
- "*usr/share/",
166
- "*.py$",
167
- "*.pc$",
168
- "*.mc$",
169
- "*.in$",
170
- "*.ini$",
171
- "*.rules$",
172
- "*.conf$"]
173
- cmds = ["find " + self.config.mnt_path + " -type f"]
174
- for unstrip in unstrip_regex:
175
- cmds.append(f"grep -vE {unstrip}")
176
- self.pipe(cmds, out_file=file_list)
177
-
178
- cmds = [f"cat {file_list}", "xargs file", "grep 'not stripped'", "awk -F':' '{{print $1}}'"]
179
- cmds.append(f"xargs -i{{}} {self.config.strip} -s {{}}")
180
- self.pipe(cmds)
181
-
182
- log.info("remove static libraries")
183
- cmds = [f"find {self.config.mnt_path} -name *.a", "xargs -i{} rm {}"]
184
- self.pipe(cmds)
185
153
  log.info("remove all .fuse_hiddeng* files")
186
154
  cmds = [f"find {self.config.mnt_path} -name .fuse_hidden*", "xargs -i{} rm {}"]
187
155
  self.pipe(cmds)
@@ -104,10 +104,13 @@ class Tools(object):
104
104
  raise errors.RunCommandException(f"Run command {real_cmd[0]} failed")
105
105
  ret.communicate()
106
106
  if ret.returncode != 0:
107
+ error_log = "Run command ({}) failed, error: {}".format(cmd, ret.stderr)
108
+ error_log = kwargs.get("error_log", error_log)
107
109
  if ignore_error:
108
- self.log.info("Run command ({}) failed".format(cmd), uptrace=uptrace)
110
+ if error_log:
111
+ self.log.info(failed_info)
109
112
  return
110
- raise errors.RunCommandException(f"command {cmd} return non-zero, error: {ret.stderr}")
113
+ raise errors.RunCommandException(error_log)
111
114
  if stdin:
112
115
  stdin.close()
113
116
  stdin = stdout
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -14,12 +14,12 @@ License-File: AUTHORS
14
14
  Requires-Dist: pyyaml
15
15
  Requires-Dist: colorama
16
16
  Requires-Dist: mako
17
- Requires-Dist: node-semver==0.6.1
17
+ Requires-Dist: node-semver>=0.6.1
18
18
  Requires-Dist: jsonschema
19
19
  Requires-Dist: conan
20
20
  Requires-Dist: requests
21
21
  Requires-Dist: gitpython
22
22
  Requires-Dist: inflection
23
- Requires-Dist: meson==1.4.0
23
+ Requires-Dist: meson>=1.4.0
24
24
 
25
25
  build and code generate tools
@@ -1,10 +1,10 @@
1
1
  pyyaml
2
2
  colorama
3
3
  mako
4
- node-semver==0.6.1
4
+ node-semver>=0.6.1
5
5
  jsonschema
6
6
  conan
7
7
  requests
8
8
  gitpython
9
9
  inflection
10
- meson==1.4.0
10
+ meson>=1.4.0
@@ -19,7 +19,7 @@ setup(
19
19
  description="Tools provided by litebmc.com",
20
20
  long_description="build and code generate tools",
21
21
  long_description_content_type="text/markdown",
22
- install_requires=["pyyaml", "colorama", "mako", "node-semver==0.6.1", "jsonschema", "conan", "requests", "gitpython", "inflection", "meson==1.4.0"],
22
+ install_requires=["pyyaml", "colorama", "mako", "node-semver>=0.6.1", "jsonschema", "conan", "requests", "gitpython", "inflection", "meson>=1.4.0"],
23
23
  url="https://www.litebmc.com",
24
24
  packages=find_packages(),
25
25
  include_package_data=True,
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.6.0'
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