jolt 0.9.342__py3-none-any.whl → 0.9.429__py3-none-any.whl

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 (158) hide show
  1. jolt/__init__.py +47 -0
  2. jolt/cache.py +358 -159
  3. jolt/cli.py +71 -104
  4. jolt/config.py +14 -26
  5. jolt/filesystem.py +2 -2
  6. jolt/graph.py +56 -28
  7. jolt/influence.py +67 -2
  8. jolt/loader.py +150 -186
  9. jolt/log.py +12 -2
  10. jolt/manifest.py +0 -46
  11. jolt/options.py +35 -12
  12. jolt/pkgs/abseil.py +42 -0
  13. jolt/pkgs/asio.py +25 -0
  14. jolt/pkgs/autoconf.py +41 -0
  15. jolt/pkgs/automake.py +41 -0
  16. jolt/pkgs/b2.py +31 -0
  17. jolt/pkgs/boost.py +111 -0
  18. jolt/pkgs/boringssl.py +32 -0
  19. jolt/pkgs/busybox.py +39 -0
  20. jolt/pkgs/bzip2.py +43 -0
  21. jolt/pkgs/cares.py +29 -0
  22. jolt/pkgs/catch2.py +36 -0
  23. jolt/pkgs/cbindgen.py +17 -0
  24. jolt/pkgs/cista.py +19 -0
  25. jolt/pkgs/clang.py +44 -0
  26. jolt/pkgs/cli11.py +23 -0
  27. jolt/pkgs/cmake.py +48 -0
  28. jolt/pkgs/cpython.py +196 -0
  29. jolt/pkgs/crun.py +29 -0
  30. jolt/pkgs/curl.py +38 -0
  31. jolt/pkgs/dbus.py +18 -0
  32. jolt/pkgs/double_conversion.py +24 -0
  33. jolt/pkgs/fastfloat.py +21 -0
  34. jolt/pkgs/ffmpeg.py +28 -0
  35. jolt/pkgs/flatbuffers.py +29 -0
  36. jolt/pkgs/fmt.py +27 -0
  37. jolt/pkgs/fstree.py +20 -0
  38. jolt/pkgs/gflags.py +18 -0
  39. jolt/pkgs/glib.py +18 -0
  40. jolt/pkgs/glog.py +25 -0
  41. jolt/pkgs/glslang.py +21 -0
  42. jolt/pkgs/golang.py +16 -11
  43. jolt/pkgs/googlebenchmark.py +18 -0
  44. jolt/pkgs/googletest.py +46 -0
  45. jolt/pkgs/gperf.py +15 -0
  46. jolt/pkgs/grpc.py +73 -0
  47. jolt/pkgs/hdf5.py +19 -0
  48. jolt/pkgs/help2man.py +14 -0
  49. jolt/pkgs/inja.py +28 -0
  50. jolt/pkgs/jsoncpp.py +31 -0
  51. jolt/pkgs/libarchive.py +43 -0
  52. jolt/pkgs/libcap.py +44 -0
  53. jolt/pkgs/libdrm.py +44 -0
  54. jolt/pkgs/libedit.py +42 -0
  55. jolt/pkgs/libevent.py +31 -0
  56. jolt/pkgs/libexpat.py +27 -0
  57. jolt/pkgs/libfastjson.py +21 -0
  58. jolt/pkgs/libffi.py +16 -0
  59. jolt/pkgs/libglvnd.py +30 -0
  60. jolt/pkgs/libogg.py +28 -0
  61. jolt/pkgs/libpciaccess.py +18 -0
  62. jolt/pkgs/libseccomp.py +21 -0
  63. jolt/pkgs/libtirpc.py +24 -0
  64. jolt/pkgs/libtool.py +42 -0
  65. jolt/pkgs/libunwind.py +35 -0
  66. jolt/pkgs/libva.py +18 -0
  67. jolt/pkgs/libvorbis.py +33 -0
  68. jolt/pkgs/libxml2.py +35 -0
  69. jolt/pkgs/libxslt.py +17 -0
  70. jolt/pkgs/libyajl.py +16 -0
  71. jolt/pkgs/llvm.py +81 -0
  72. jolt/pkgs/lua.py +54 -0
  73. jolt/pkgs/lz4.py +26 -0
  74. jolt/pkgs/m4.py +14 -0
  75. jolt/pkgs/make.py +17 -0
  76. jolt/pkgs/mesa.py +81 -0
  77. jolt/pkgs/meson.py +17 -0
  78. jolt/pkgs/mstch.py +28 -0
  79. jolt/pkgs/mysql.py +60 -0
  80. jolt/pkgs/nasm.py +49 -0
  81. jolt/pkgs/ncurses.py +30 -0
  82. jolt/pkgs/ng_log.py +25 -0
  83. jolt/pkgs/ninja.py +45 -0
  84. jolt/pkgs/nlohmann_json.py +25 -0
  85. jolt/pkgs/nodejs.py +19 -11
  86. jolt/pkgs/opencv.py +24 -0
  87. jolt/pkgs/openjdk.py +26 -0
  88. jolt/pkgs/openssl.py +103 -0
  89. jolt/pkgs/paho.py +76 -0
  90. jolt/pkgs/patchelf.py +16 -0
  91. jolt/pkgs/perl.py +42 -0
  92. jolt/pkgs/pkgconfig.py +64 -0
  93. jolt/pkgs/poco.py +39 -0
  94. jolt/pkgs/protobuf.py +77 -0
  95. jolt/pkgs/pugixml.py +27 -0
  96. jolt/pkgs/python.py +19 -0
  97. jolt/pkgs/qt.py +35 -0
  98. jolt/pkgs/rapidjson.py +26 -0
  99. jolt/pkgs/rapidyaml.py +28 -0
  100. jolt/pkgs/re2.py +30 -0
  101. jolt/pkgs/re2c.py +17 -0
  102. jolt/pkgs/readline.py +15 -0
  103. jolt/pkgs/rust.py +41 -0
  104. jolt/pkgs/sdl.py +28 -0
  105. jolt/pkgs/simdjson.py +27 -0
  106. jolt/pkgs/soci.py +46 -0
  107. jolt/pkgs/spdlog.py +29 -0
  108. jolt/pkgs/spirv_llvm.py +21 -0
  109. jolt/pkgs/spirv_tools.py +24 -0
  110. jolt/pkgs/sqlite.py +83 -0
  111. jolt/pkgs/ssl.py +12 -0
  112. jolt/pkgs/texinfo.py +15 -0
  113. jolt/pkgs/tomlplusplus.py +22 -0
  114. jolt/pkgs/wayland.py +26 -0
  115. jolt/pkgs/x11.py +58 -0
  116. jolt/pkgs/xerces_c.py +20 -0
  117. jolt/pkgs/xorg.py +360 -0
  118. jolt/pkgs/xz.py +29 -0
  119. jolt/pkgs/yamlcpp.py +30 -0
  120. jolt/pkgs/zeromq.py +47 -0
  121. jolt/pkgs/zlib.py +69 -0
  122. jolt/pkgs/zstd.py +33 -0
  123. jolt/plugins/autotools.py +66 -0
  124. jolt/plugins/cmake.py +74 -6
  125. jolt/plugins/conan.py +238 -0
  126. jolt/plugins/cxxinfo.py +7 -0
  127. jolt/plugins/docker.py +3 -3
  128. jolt/plugins/environ.py +11 -0
  129. jolt/plugins/fetch.py +141 -0
  130. jolt/plugins/gdb.py +10 -6
  131. jolt/plugins/git.py +60 -11
  132. jolt/plugins/libtool.py +63 -0
  133. jolt/plugins/linux.py +990 -0
  134. jolt/plugins/meson.py +61 -0
  135. jolt/plugins/ninja-compdb.py +11 -7
  136. jolt/plugins/ninja.py +245 -26
  137. jolt/plugins/paths.py +11 -1
  138. jolt/plugins/pkgconfig.py +219 -0
  139. jolt/plugins/podman.py +15 -41
  140. jolt/plugins/python.py +137 -0
  141. jolt/plugins/rust.py +25 -0
  142. jolt/plugins/scheduler.py +18 -14
  143. jolt/plugins/selfdeploy/setup.py +2 -1
  144. jolt/plugins/selfdeploy.py +21 -30
  145. jolt/plugins/strings.py +19 -10
  146. jolt/scheduler.py +428 -138
  147. jolt/tasks.py +159 -7
  148. jolt/tools.py +105 -51
  149. jolt/utils.py +16 -1
  150. jolt/version.py +1 -1
  151. {jolt-0.9.342.dist-info → jolt-0.9.429.dist-info}/METADATA +64 -9
  152. jolt-0.9.429.dist-info/RECORD +207 -0
  153. {jolt-0.9.342.dist-info → jolt-0.9.429.dist-info}/WHEEL +1 -1
  154. jolt/plugins/debian.py +0 -338
  155. jolt/plugins/repo.py +0 -253
  156. jolt-0.9.342.dist-info/RECORD +0 -93
  157. {jolt-0.9.342.dist-info → jolt-0.9.429.dist-info}/entry_points.txt +0 -0
  158. {jolt-0.9.342.dist-info → jolt-0.9.429.dist-info}/top_level.txt +0 -0
jolt/plugins/git.py CHANGED
@@ -1,9 +1,10 @@
1
1
  import os
2
2
  import pygit2
3
3
  import re
4
+ from threading import RLock
4
5
  import urllib.parse
5
6
 
6
- from jolt.tasks import BooleanParameter, Export, Parameter, TaskRegistry, WorkspaceResource
7
+ from jolt.tasks import BooleanParameter, Export, IntParameter, Parameter, TaskRegistry, WorkspaceResource
7
8
  from jolt.influence import FileInfluence, HashInfluenceRegistry
8
9
  from jolt.tools import Tools
9
10
  from jolt.loader import JoltLoader, workspace_locked
@@ -20,6 +21,13 @@ from jolt.error import raise_task_error_if
20
21
  log.verbose("[Git] Loaded")
21
22
 
22
23
 
24
+ def locked(func):
25
+ def _f(self, *args, **kwargs):
26
+ with self._lock:
27
+ return func(self, *args, **kwargs)
28
+ return _f
29
+
30
+
23
31
  class GitRepository(object):
24
32
  def __init__(self, url, path, relpath, refspecs=None):
25
33
  self.path = path
@@ -29,7 +37,7 @@ class GitRepository(object):
29
37
  self.url = url
30
38
  self.default_refspecs = [
31
39
  '+refs/heads/*:refs/remotes/origin/*',
32
- '+refs/tags/*:refs/remotes/origin/*',
40
+ '+refs/tags/*:refs/tags/*',
33
41
  ]
34
42
  self.refspecs = refspecs or []
35
43
  self._tree_hash = {}
@@ -68,7 +76,7 @@ class GitRepository(object):
68
76
  def is_indexed(self):
69
77
  return self.is_cloned() and fs.path.exists(self._git_index())
70
78
 
71
- def clone(self):
79
+ def clone(self, submodules=False):
72
80
  log.info("Cloning into {0}", self.path)
73
81
 
74
82
  # Get reference repository path
@@ -103,19 +111,30 @@ class GitRepository(object):
103
111
 
104
112
  utils.call_and_catch(self.tools.run, "git remote remove origin", output=False)
105
113
  self.tools.run("git remote add origin {}", self.url, output_on_error=True)
106
- self.tools.run("git fetch origin", output_on_error=True)
114
+ self._fetch_origin(submodules=submodules)
107
115
  self.tools.run("git checkout -f FETCH_HEAD", output_on_error=True)
108
116
  else:
117
+ # Get configurable extra clone options
118
+ extra_clone_options = config.get("git", "clone_options", "")
119
+
109
120
  if refpath and os.path.isdir(refpath):
110
- self.tools.run("git clone --reference-if-able {0} {1} {2}", refpath, self.url, self.path, output_on_error=True)
121
+ self.tools.run("git clone --reference-if-able {0} {1} {2} {3}", refpath, extra_clone_options, self.url, self.path, output_on_error=True)
111
122
  else:
112
- self.tools.run("git clone {0} {1}", self.url, self.path, output_on_error=True)
123
+ self.tools.run("git clone {0} {1} {2}", extra_clone_options, self.url, self.path, output_on_error=True)
113
124
 
114
125
  self._init_repo()
115
126
  raise_error_if(
116
127
  self.repository is None,
117
128
  "Failed to clone repository '{0}'", self.relpath)
118
129
 
130
+ @utils.retried.on_exception(JoltCommandError, pattern="Command failed: git fetch", count=6, backoff=[2, 5, 10, 15, 20, 30])
131
+ def _fetch_origin(self, submodules=False):
132
+ # Get configurable extra clone options
133
+ extra_fetch_options = config.get("git", "fetch_options", "")
134
+
135
+ with self.tools.cwd(self.path):
136
+ self.tools.run("git fetch {0} {1} origin", "", extra_fetch_options, output_on_error=True)
137
+
119
138
  @utils.cached.instance
120
139
  def diff_unchecked(self):
121
140
  if not self.is_indexed():
@@ -239,20 +258,25 @@ class GitRepository(object):
239
258
  with self.tools.cwd(self.path):
240
259
  return self.tools.run("git reset --hard", output_on_error=True)
241
260
 
261
+ @utils.retried.on_exception(JoltCommandError, pattern="Command failed: git fetch", count=6, backoff=[2, 5, 10, 15, 20, 30])
242
262
  def fetch(self, commit=None):
243
263
  if commit and not self.is_valid_sha(commit):
244
264
  commit = None
245
265
 
266
+ # Get configurable extra clone options
267
+ extra_fetch_options = config.get("git", "fetch_options", "")
268
+
246
269
  refspec = " ".join(self.default_refspecs + self.refspecs)
247
270
  with self.tools.cwd(self.path):
248
271
  log.info("Fetching {0} from {1}", commit or refspec or 'commits', self.url)
249
272
  self.tools.run(
250
- "git fetch --prune {url} {what}",
273
+ "git fetch --force --prune {extra_fetch_options} {url} {what}",
274
+ extra_fetch_options=extra_fetch_options,
251
275
  url=self.url,
252
276
  what=commit or refspec or '',
253
277
  output_on_error=True)
254
278
 
255
- def checkout(self, rev, commit=None):
279
+ def checkout(self, rev, commit=None, submodules=False):
256
280
  if rev == self._last_rev:
257
281
  log.debug("Checkout skipped, already @ {}", rev)
258
282
  return False
@@ -260,16 +284,24 @@ class GitRepository(object):
260
284
  with self.tools.cwd(self.path):
261
285
  try:
262
286
  self.tools.run("git checkout -f {rev}", rev=rev, output=False)
287
+ if submodules:
288
+ self._update_submodules()
263
289
  except Exception:
264
290
  self.fetch(commit=commit)
265
291
  try:
266
292
  self.tools.run("git checkout -f {rev}", rev=rev, output_on_error=True)
293
+ if submodules:
294
+ self._update_submodules()
267
295
  except Exception:
268
296
  raise_error("Commit does not exist in remote for '{}': {}", self.relpath, rev)
269
297
  self._original_head = False
270
298
  self._last_rev = rev
271
299
  return True
272
300
 
301
+ def _update_submodules(self):
302
+ with self.tools.cwd(self.path):
303
+ self.tools.run("git submodule update --init --recursive", output_on_error=True)
304
+
273
305
 
274
306
  _gits = {}
275
307
 
@@ -420,6 +452,12 @@ class Git(WorkspaceResource, FileInfluence):
420
452
  path = Parameter(required=False, help="Local path where the repository should be cloned.")
421
453
  """ Alternative path where the repository should be cloned. Relative to ``joltdir``. Optional. """
422
454
 
455
+ submodules = BooleanParameter(default=False, help="Initialize and update git submodules after cloning.")
456
+ """ Initialize and update git submodules after cloning. Default ``False``. Optional. """
457
+
458
+ clean = BooleanParameter(default=False, help="Clean repository after it has been used")
459
+ """ Removes untracked files from the repository. """
460
+
423
461
  _revision = Export(value=lambda t: t._export_revision())
424
462
  """ To worker exported value of the revision to be checked out. """
425
463
 
@@ -428,6 +466,7 @@ class Git(WorkspaceResource, FileInfluence):
428
466
 
429
467
  def __init__(self, *args, **kwargs):
430
468
  super().__init__(*args, **kwargs)
469
+ self._lock = RLock()
431
470
  self.joltdir = JoltLoader.get().joltdir
432
471
 
433
472
  # Set the path to the repo
@@ -438,6 +477,9 @@ class Git(WorkspaceResource, FileInfluence):
438
477
  self.abspath = fs.path.join(self.joltdir, str(self.path) or self._get_name())
439
478
  self.relpath = fs.path.relpath(self.abspath, self.tools.wsroot)
440
479
 
480
+ self.abspath = fs.path.normpath(self.abspath)
481
+ self.relpath = fs.path.normpath(self.relpath)
482
+
441
483
  # Create the git repository
442
484
  self.refspecs = kwargs.get("refspecs", [])
443
485
  self.git = new_git(self.url, self.abspath, self.relpath, self.refspecs)
@@ -482,6 +524,11 @@ class Git(WorkspaceResource, FileInfluence):
482
524
  self._assign_git(owner)
483
525
  artifact.worktree = fs.path.relpath(self.abspath, owner.joltdir)
484
526
 
527
+ def release(self, artifact, deps, tools, owner):
528
+ if self.clean:
529
+ self.git.clean()
530
+ self.git.reset()
531
+
485
532
  def prepare_ws_for(self, task):
486
533
  """ Prepare the workspace for the task.
487
534
 
@@ -502,10 +549,11 @@ class Git(WorkspaceResource, FileInfluence):
502
549
  if force or self._must_influence() or self._revision.is_imported:
503
550
  self._acquire_ws()
504
551
 
552
+ @locked
505
553
  def _acquire_ws(self):
506
554
  commit = None
507
555
  if not self.git.is_cloned():
508
- self.git.clone()
556
+ self.git.clone(submodules=bool(self.submodules))
509
557
  if not self._revision.is_imported:
510
558
  self.git.diff_unchecked()
511
559
  else:
@@ -518,7 +566,7 @@ class Git(WorkspaceResource, FileInfluence):
518
566
  # Should be safe to do this now
519
567
  rev = self.git.rev_parse(rev)
520
568
  if not self.git.is_head(rev) or self._revision.is_imported:
521
- if self.git.checkout(rev, commit=commit):
569
+ if self.git.checkout(rev, commit=commit, submodules=bool(self.submodules)):
522
570
  self.git.clean()
523
571
  self.git.patch(self._diff.value)
524
572
 
@@ -545,10 +593,11 @@ class Git(WorkspaceResource, FileInfluence):
545
593
  influence = super()._influence()
546
594
  return influence + [self] if self._must_influence() else influence
547
595
 
596
+ @locked
548
597
  @utils.cached.instance
549
598
  def get_influence(self, task):
550
599
  if not self.git.is_cloned():
551
- self.git.clone()
600
+ self.git.clone(submodules=bool(self.submodules))
552
601
  if not self._revision.is_imported:
553
602
  self.git.diff_unchecked()
554
603
  rev = self._get_revision()
@@ -0,0 +1,63 @@
1
+ from jolt import attributes
2
+
3
+
4
+ class Libtool(object):
5
+ def __init__(self, tools):
6
+ self.tools = tools
7
+
8
+ def relocate(self, artifact, dirs=["lib"], prefix=None):
9
+ prefix = str(artifact.strings.install_prefix) if prefix is None else prefix
10
+ for dir in dirs:
11
+ with self.tools.cwd(artifact.path, dir):
12
+ for file in self.tools.glob("*.la"):
13
+ self.tools.replace_in_file(file, prefix, artifact.final_path)
14
+
15
+
16
+ def relocate(dirs=["lib"]):
17
+ """
18
+ Relocate libtool archive files (.la) published by task.
19
+
20
+ When an artifact is published, all .la files found in the specified
21
+ directories will have their install prefix updated to the artifact's final path.
22
+ The original install prefix is stored in the artifact's strings metadata
23
+ under the key 'libtool_prefix' for use during unpacking.
24
+
25
+ :param dirs: List of directories inside the artifact to relocate .la files in.
26
+
27
+ """
28
+
29
+ def decorate(cls):
30
+ original_publish = cls.publish
31
+ original_unpack = cls.unpack
32
+
33
+ def publish(self, artifact, tools):
34
+ original_publish(self, artifact, tools)
35
+ lt = Libtool(tools)
36
+ lt.relocate(artifact, dirs, prefix=artifact.strings.install_prefix)
37
+ artifact.libtool_prefix = artifact.final_path
38
+
39
+ def unpack(self, artifact, tools):
40
+ original_unpack(self, artifact, tools)
41
+ lt = Libtool(tools)
42
+ lt.relocate(artifact, dirs, prefix=artifact.strings.libtool_prefix)
43
+ artifact.strings.libtool_prefix = None
44
+
45
+ cls.publish = publish
46
+ cls.unpack = unpack
47
+
48
+ return cls
49
+
50
+ return decorate
51
+
52
+
53
+ def requires():
54
+ """ Decorator to add Libtool requirement to a task. """
55
+
56
+ import jolt.pkgs.libtool
57
+
58
+ def decorate(cls):
59
+ cls = attributes.requires("requires_libtool")(cls)
60
+ cls.requires_libtool = ["libtool"]
61
+ return cls
62
+
63
+ return decorate