bisos.capability 0.25__tar.gz → 0.27__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 (31) hide show
  1. {bisos_capability-0.25 → bisos_capability-0.27}/PKG-INFO +25 -1
  2. {bisos_capability-0.25 → bisos_capability-0.27}/README.rst +24 -0
  3. {bisos_capability-0.25 → bisos_capability-0.27}/_description.org +16 -0
  4. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cbmProc_csu.py +79 -6
  5. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cbmProc_seedInfo.py +69 -7
  6. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/sysCbmManage_csu.py +21 -0
  7. {bisos_capability-0.25 → bisos_capability-0.27}/bisos.capability.egg-info/PKG-INFO +25 -1
  8. {bisos_capability-0.25 → bisos_capability-0.27}/setup.py +2 -2
  9. {bisos_capability-0.25 → bisos_capability-0.27}/bin/capMaterializationDispatch.cs +0 -0
  10. {bisos_capability-0.25 → bisos_capability-0.27}/bin/cba-sysd.cs +0 -0
  11. {bisos_capability-0.25 → bisos_capability-0.27}/bin/cbm-materialize-cbs.cs +0 -0
  12. {bisos_capability-0.25 → bisos_capability-0.27}/bin/cbmProc-seed.cs +0 -0
  13. {bisos_capability-0.25 → bisos_capability-0.27}/bin/sysCbmManage.cs +0 -0
  14. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/__init__.py +0 -0
  15. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/__init__.py +0 -0
  16. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cba_assemble.py +0 -0
  17. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cba_csu.py +0 -0
  18. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cba_seed.py +0 -0
  19. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cba_sysd_csu.py +0 -0
  20. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cba_sysd_seed.py +0 -0
  21. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cbmProc_seed.py +0 -0
  22. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/cbm_csu.py +0 -0
  23. {bisos_capability-0.25 → bisos_capability-0.27}/bisos/capability/materializationDispatch_csu.py +0 -0
  24. {bisos_capability-0.25 → bisos_capability-0.27}/bisos.capability.egg-info/SOURCES.txt +0 -0
  25. {bisos_capability-0.25 → bisos_capability-0.27}/bisos.capability.egg-info/dependency_links.txt +0 -0
  26. {bisos_capability-0.25 → bisos_capability-0.27}/bisos.capability.egg-info/not-zip-safe +0 -0
  27. {bisos_capability-0.25 → bisos_capability-0.27}/bisos.capability.egg-info/requires.txt +0 -0
  28. {bisos_capability-0.25 → bisos_capability-0.27}/bisos.capability.egg-info/top_level.txt +0 -0
  29. {bisos_capability-0.25 → bisos_capability-0.27}/lh-agpl3-LICENSE.txt +0 -0
  30. {bisos_capability-0.25 → bisos_capability-0.27}/pyproject.toml +0 -0
  31. {bisos_capability-0.25 → bisos_capability-0.27}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: bisos.capability
3
- Version: 0.25
3
+ Version: 0.27
4
4
  Summary: bisos.capability: BISOS Capabilities Bundles -- Abstraction, Specification and Materialization
5
5
  Author: Mohsen Banan
6
6
  Author-email: libre@mohsen.1.banan.byname.net
@@ -87,6 +87,18 @@ Each of the three tiers in detail:
87
87
  - ``cbm_materialize`` / ``cbm_reMaterialize`` /
88
88
  ``cbm_unMaterialize`` / ``cbm_sbom`` — gated; subprocess-invoke
89
89
  ``<cbsSpec> -i cbs_<verb>``
90
+ - ``cbm_bootstrap`` — run the leaf's own ``cbmBootstrap-sbom.pcs``,
91
+ which installs what the capability needs before its CBS can run
92
+ (e.g. the pip package that puts ``<cap>-cbs.pcs`` on PATH).
93
+ ``cbm_materialize``, ``cbm_reMaterialize`` and ``cbm_sbom`` run it
94
+ first when it exists.
95
+
96
+ A leaf's status log is not in the leaf: it is a fact of the host, and
97
+ the leaf may be a read-only clone. It is at
98
+ ``/bisos/var/cbm/<leafRel>/cbmProc.status``, with ``<leafRel>`` the
99
+ leaf's path under ``/bisos/git/<vcMode>/bxRepos/`` (the vcMode
100
+ dropped, so an anon and an auth clone share it), next to a ``leaf``
101
+ symlink back to the leaf. ``cbm_status`` prints the path.
90
102
 
91
103
  **Load-bearing principle: CBM sits on top of CBS. It does not duplicate
92
104
  CBS content.** A ``cbmProc.spcs`` is a ~10-line pointer file
@@ -115,6 +127,18 @@ CBM machinery (additive, non-invasive to the above):
115
127
  - ``cbmProc_csu.py`` — ``cbm_*`` Cmnd classes + ``_dispatchCbs()``
116
128
  helper
117
129
  - ``bin/cbmProc-seed.cs`` — the CBM-aware seed CSXU
130
+ - ``sysCbmManage_csu.py``, ``bin/sysCbmManage.cs`` —
131
+ ``fullyMaterialize``: ``cbm_status`` then ``cbm_materialize`` over
132
+ the platform's tree — ``collective/hereWeb``, then the ``pals`` realm
133
+ (``sys/cbm/pals/<palsBxo>/<cbm>/``, planted by bisos.pals's
134
+ ``palsOfSys.cs``), then ``collective/induct`` (non-service installs:
135
+ lcnt, emacsSrcBuild, bleeBuild, …), each when it has a
136
+ ``ftoBranchProc.spcs``
137
+
138
+ An explicit ``cbsSpec`` path is used as planted, not resolved: a CBS
139
+ that is a symlink to a generic, spread-planted file (a PALS site's
140
+ ``cbm/pals-cbs.spcs``) runs by its own path, which is how it finds its
141
+ parameters.
118
142
 
119
143
  Canonical exemplar
120
144
  ------------------
@@ -51,6 +51,18 @@ Each of the three tiers in detail:
51
51
  - ``cbm_materialize`` / ``cbm_reMaterialize`` /
52
52
  ``cbm_unMaterialize`` / ``cbm_sbom`` — gated; subprocess-invoke
53
53
  ``<cbsSpec> -i cbs_<verb>``
54
+ - ``cbm_bootstrap`` — run the leaf's own ``cbmBootstrap-sbom.pcs``,
55
+ which installs what the capability needs before its CBS can run
56
+ (e.g. the pip package that puts ``<cap>-cbs.pcs`` on PATH).
57
+ ``cbm_materialize``, ``cbm_reMaterialize`` and ``cbm_sbom`` run it
58
+ first when it exists.
59
+
60
+ A leaf's status log is not in the leaf: it is a fact of the host, and
61
+ the leaf may be a read-only clone. It is at
62
+ ``/bisos/var/cbm/<leafRel>/cbmProc.status``, with ``<leafRel>`` the
63
+ leaf's path under ``/bisos/git/<vcMode>/bxRepos/`` (the vcMode
64
+ dropped, so an anon and an auth clone share it), next to a ``leaf``
65
+ symlink back to the leaf. ``cbm_status`` prints the path.
54
66
 
55
67
  **Load-bearing principle: CBM sits on top of CBS. It does not duplicate
56
68
  CBS content.** A ``cbmProc.spcs`` is a ~10-line pointer file
@@ -79,6 +91,18 @@ CBM machinery (additive, non-invasive to the above):
79
91
  - ``cbmProc_csu.py`` — ``cbm_*`` Cmnd classes + ``_dispatchCbs()``
80
92
  helper
81
93
  - ``bin/cbmProc-seed.cs`` — the CBM-aware seed CSXU
94
+ - ``sysCbmManage_csu.py``, ``bin/sysCbmManage.cs`` —
95
+ ``fullyMaterialize``: ``cbm_status`` then ``cbm_materialize`` over
96
+ the platform's tree — ``collective/hereWeb``, then the ``pals`` realm
97
+ (``sys/cbm/pals/<palsBxo>/<cbm>/``, planted by bisos.pals's
98
+ ``palsOfSys.cs``), then ``collective/induct`` (non-service installs:
99
+ lcnt, emacsSrcBuild, bleeBuild, …), each when it has a
100
+ ``ftoBranchProc.spcs``
101
+
102
+ An explicit ``cbsSpec`` path is used as planted, not resolved: a CBS
103
+ that is a symlink to a generic, spread-planted file (a PALS site's
104
+ ``cbm/pals-cbs.spcs``) runs by its own path, which is how it finds its
105
+ parameters.
82
106
 
83
107
  Canonical exemplar
84
108
  ------------------
@@ -46,6 +46,14 @@ Each of the three tiers in detail:
46
46
  (gate manipulation; never gated themselves)
47
47
  - =cbm_materialize= / =cbm_reMaterialize= / =cbm_unMaterialize= /
48
48
  =cbm_sbom= --- gated; subprocess-invoke =<cbsSpec> -i cbs_<verb>=
49
+ - =cbm_bootstrap= --- run the leaf's own =cbmBootstrap-sbom.pcs=, which installs what the
50
+ capability needs before its CBS can run (e.g. the pip package that puts =<cap>-cbs.pcs= on
51
+ PATH). =cbm_materialize=, =cbm_reMaterialize= and =cbm_sbom= run it first when it exists.
52
+
53
+ A leaf's status log is not in the leaf: it is a fact of the host, and the leaf may be a
54
+ read-only clone. It is at =/bisos/var/cbm/<leafRel>/cbmProc.status=, with =<leafRel>= the
55
+ leaf's path under =/bisos/git/<vcMode>/bxRepos/= (the vcMode dropped, so an anon and an auth
56
+ clone share it), next to a =leaf= symlink back to the leaf. =cbm_status= prints the path.
49
57
 
50
58
  *Load-bearing principle: CBM sits on top of CBS. It does not
51
59
  duplicate CBS content.* A =cbmProc.spcs= is a ~10-line pointer file
@@ -71,6 +79,14 @@ CBM machinery (additive, non-invasive to the above):
71
79
  - =cbmProc_seed.py= --- atexit registrar for =cbmProc-seed.cs=
72
80
  - =cbmProc_csu.py= --- =cbm_*= Cmnd classes + =_dispatchCbs()= helper
73
81
  - =bin/cbmProc-seed.cs= --- the CBM-aware seed CSXU
82
+ - =sysCbmManage_csu.py=, =bin/sysCbmManage.cs= --- =fullyMaterialize=: =cbm_status= then
83
+ =cbm_materialize= over the platform's tree --- =collective/hereWeb=, then the =pals= realm
84
+ (=sys/cbm/pals/<palsBxo>/<cbm>/=, planted by bisos.pals's =palsOfSys.cs=), then =collective/induct=
85
+ (non-service installs: lcnt, emacsSrcBuild, bleeBuild, ...), each when it has a =ftoBranchProc.spcs=
86
+
87
+ An explicit =cbsSpec= path is used as planted, not resolved: a CBS that is a symlink to a generic,
88
+ spread-planted file (a PALS site's =cbm/pals-cbs.spcs=) runs by its own path, which is how it finds its
89
+ parameters.
74
90
 
75
91
  ** Canonical exemplar
76
92
 
@@ -187,11 +187,12 @@ class cbm_status(cs.Cmnd):
187
187
  if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
188
188
  return b_io.eh.badOutcome(cmndOutcome)
189
189
  p = _params()
190
+ path = cbmProc_seedInfo.statusPath(p.plantDir)
190
191
  contents = cbmProc_seedInfo.statusRead(p.plantDir)
191
192
  if not contents:
192
- b_io.ann.write(f"[{p.capabilityName}] cbmProc.status is empty or absent")
193
+ b_io.ann.write(f"[{p.capabilityName}] {path} is empty or absent")
193
194
  else:
194
- b_io.ann.write(f"[{p.capabilityName}] cbmProc.status:\n{contents}")
195
+ b_io.ann.write(f"[{p.capabilityName}] {path}:\n{contents}")
195
196
  return cmndOutcome.set(opError=b.op.OpError.Success, opResults=contents)
196
197
 
197
198
 
@@ -252,13 +253,40 @@ class cbm_control(cs.Cmnd):
252
253
  # an error outcome.
253
254
  # 3. subprocess.run([cbs, '-i', verb, *extraArgs]). Log outcome to
254
255
  # cbmProc.status.
256
+ #
257
+ # With bootstrapFirst, the leaf's cbmBootstrap-sbom.pcs (when present) runs
258
+ # between 1 and 2, since what it installs is what makes cbsSpec resolvable.
255
259
  ###############################################################################
256
260
 
261
+ def _bootstrapRun(
262
+ p: cbmProc_seedInfo.CbmProcParams,
263
+ verb: str,
264
+ ) -> int | None:
265
+ """Run the leaf's cbmBootstrap-sbom.pcs -i sbom_fullUpdate. None when the leaf has none, else rc.
266
+
267
+ NOTYET: a failed sbom_fullUpdate exits 0 (bisos-pip/b Stage 4), so a failure here usually
268
+ shows only as the cbsSpec-unresolvable line that follows.
269
+ """
270
+ bootstrap = cbmProc_seedInfo.bootstrapPath(p.plantDir)
271
+ if not bootstrap.exists():
272
+ return None
273
+ argv = [str(bootstrap), '-i', 'sbom_fullUpdate']
274
+ b_io.ann.note(f"[{p.capabilityName}] bootstrap: {' '.join(argv)}")
275
+ rc = subprocess.run(argv, check=False, cwd=p.plantDir).returncode
276
+ if rc == 0:
277
+ cbmProc_seedInfo.statusWrite(p.plantDir, f"ran: bootstrap ok (for {verb})")
278
+ else:
279
+ cbmProc_seedInfo.statusWrite(p.plantDir, f"ran: bootstrap failed rc={rc} (for {verb})")
280
+ b_io.ann.write(f"[{p.capabilityName}] bootstrap failed (subprocess rc={rc})")
281
+ return rc
282
+
283
+
257
284
  def _dispatchCbs(
258
285
  verb: str,
259
286
  rtInv: cs.RtInvoker,
260
287
  cmndOutcome: b.op.Outcome,
261
288
  extraArgs: list[str] | None = None,
289
+ bootstrapFirst: bool = False,
262
290
  ) -> b.op.Outcome:
263
291
  p = _params()
264
292
  plantDir = p.plantDir
@@ -278,6 +306,12 @@ def _dispatchCbs(
278
306
  opResults=f"skipped: control={state.value}",
279
307
  )
280
308
 
309
+ # --- 1b. The leaf's bootstrap ---
310
+ if bootstrapFirst:
311
+ rc = _bootstrapRun(p, verb)
312
+ if rc not in (None, 0):
313
+ return b_io.eh.badOutcome(cmndOutcome)
314
+
281
315
  # --- 2. Resolve cbsSpec ---
282
316
  try:
283
317
  cbsExec = cbmProc_seedInfo.resolveCbsSpec()
@@ -309,6 +343,43 @@ def _dispatchCbs(
309
343
  return b_io.eh.badOutcome(cmndOutcome)
310
344
 
311
345
 
346
+ ###############################################################################
347
+ # cbm_bootstrap --- run the leaf's cbmBootstrap-sbom.pcs (not gated)
348
+ ###############################################################################
349
+
350
+ class cbm_bootstrap(cs.Cmnd):
351
+ """Run this leaf's cbmBootstrap-sbom.pcs -i sbom_fullUpdate.
352
+
353
+ Installs what the capability needs before its CBS can run. Not gated by
354
+ cbmProc.control: it is run on request. cbm_materialize, cbm_reMaterialize
355
+ and cbm_sbom run it first (after the gate) when the file exists.
356
+ """
357
+ cmndParamsMandatory = []
358
+ cmndParamsOptional = []
359
+ cmndArgsLen = {'Min': 0, 'Max': 0}
360
+
361
+ @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
362
+ def cmnd(
363
+ self,
364
+ rtInv: cs.RtInvoker,
365
+ cmndOutcome: b.op.Outcome,
366
+ argsList: typing.Optional[list[str]] = None,
367
+ ) -> b.op.Outcome:
368
+ callParamsDict = {}
369
+ if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
370
+ return b_io.eh.badOutcome(cmndOutcome)
371
+ p = _params()
372
+ rc = _bootstrapRun(p, 'cbm_bootstrap')
373
+ if rc is None:
374
+ b_io.ann.write(
375
+ f"[{p.capabilityName}] no {cbmProc_seedInfo.BOOTSTRAP_FILENAME} in {p.plantDir}"
376
+ )
377
+ return cmndOutcome.set(opError=b.op.OpError.Success, opResults="no bootstrap")
378
+ if rc != 0:
379
+ return b_io.eh.badOutcome(cmndOutcome)
380
+ return cmndOutcome.set(opError=b.op.OpError.Success, opResults="ran: bootstrap ok")
381
+
382
+
312
383
  ###############################################################################
313
384
  # cbm_materialize --- gate-check + subprocess to cbsSpec -i cbs_materialize
314
385
  ###############################################################################
@@ -317,7 +388,8 @@ class cbm_materialize(cs.Cmnd):
317
388
  """Materialize this capability: subprocess cbsSpec -i cbs_materialize.
318
389
 
319
390
  Gated by cbmProc.control (must be =enabled=). CBS lives elsewhere ---
320
- CBM does not duplicate it; it invokes it.
391
+ CBM does not duplicate it; it invokes it. The leaf's cbmBootstrap-sbom.pcs,
392
+ if any, runs first.
321
393
  """
322
394
  cmndParamsMandatory = []
323
395
  cmndParamsOptional = []
@@ -333,7 +405,7 @@ class cbm_materialize(cs.Cmnd):
333
405
  callParamsDict = {}
334
406
  if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
335
407
  return b_io.eh.badOutcome(cmndOutcome)
336
- return _dispatchCbs('cbs_materialize', rtInv, cmndOutcome)
408
+ return _dispatchCbs('cbs_materialize', rtInv, cmndOutcome, bootstrapFirst=True)
337
409
 
338
410
 
339
411
  ###############################################################################
@@ -356,7 +428,7 @@ class cbm_reMaterialize(cs.Cmnd):
356
428
  callParamsDict = {}
357
429
  if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
358
430
  return b_io.eh.badOutcome(cmndOutcome)
359
- return _dispatchCbs('cbs_reMaterialize', rtInv, cmndOutcome)
431
+ return _dispatchCbs('cbs_reMaterialize', rtInv, cmndOutcome, bootstrapFirst=True)
360
432
 
361
433
 
362
434
  ###############################################################################
@@ -402,7 +474,7 @@ class cbm_sbom(cs.Cmnd):
402
474
  callParamsDict = {}
403
475
  if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
404
476
  return b_io.eh.badOutcome(cmndOutcome)
405
- return _dispatchCbs('cbs_sbom', rtInv, cmndOutcome)
477
+ return _dispatchCbs('cbs_sbom', rtInv, cmndOutcome, bootstrapFirst=True)
406
478
 
407
479
 
408
480
  ###############################################################################
@@ -434,6 +506,7 @@ def examples_csu() -> None:
434
506
  cmnd('cbm_reMaterialize', comment="# unMaterialize + materialize")
435
507
  cmnd('cbm_unMaterialize', comment="# explicit teardown")
436
508
  cmnd('cbm_sbom', comment="# just the sbom step")
509
+ cmnd('cbm_bootstrap', comment="# just ./cbmBootstrap-sbom.pcs (runs first in the above)")
437
510
 
438
511
 
439
512
  ###############################################################################
@@ -28,6 +28,7 @@ csInfo['status'] = 'inDev'
28
28
  import typing
29
29
  import enum
30
30
  import datetime
31
+ import os
31
32
  import pathlib
32
33
  import shutil
33
34
  from dataclasses import dataclass
@@ -62,8 +63,8 @@ class CbmProcParams:
62
63
  """Parameters derived from a cbmProc.spcs plant path.
63
64
 
64
65
  plantPath --- resolved absolute path to the .spcs file.
65
- plantDir --- directory containing the .spcs (where .control /
66
- .status also live).
66
+ plantDir --- directory containing the .spcs (where .control lives;
67
+ .status is under /bisos/var/cbm, see statusPath()).
67
68
  capabilityName --- from cbmProc_seedInfo.setup(capabilityName=...) if
68
69
  the .spcs called it, else the leaf directory name.
69
70
  """
@@ -170,8 +171,10 @@ def resolveCbsSpec(cbsSpec: str | None = None) -> pathlib.Path:
170
171
 
171
172
  if '/' in cbsSpec or cbsSpec.startswith('~'):
172
173
  # Explicit path form (absolute or relative-with-slash or ~).
173
- # Expand ~ and resolve; require it to exist.
174
- resolved = pathlib.Path(cbsSpec).expanduser().resolve()
174
+ # Expand ~ and make absolute, but do NOT follow symlinks: a spread-planted CBS (e.g. a PALS's
175
+ # cbm/pals-cbs.spcs -> bisos.pals's generic one) takes its parameters from where it is planted,
176
+ # so it must run by the path it is planted at. Require it to exist.
177
+ resolved = pathlib.Path(cbsSpec).expanduser().absolute()
175
178
  if not resolved.exists():
176
179
  raise ValueError(
177
180
  f"cbsSpec {cbsSpec!r} resolved to {resolved} which does not exist."
@@ -185,7 +188,7 @@ def resolveCbsSpec(cbsSpec: str | None = None) -> pathlib.Path:
185
188
  f"cbsSpec {cbsSpec!r} not found on PATH. Either add its directory "
186
189
  f"to PATH or use an absolute path in setup(cbsSpec=...)."
187
190
  )
188
- return pathlib.Path(onPath).resolve()
191
+ return pathlib.Path(onPath).absolute() # not resolved: see the explicit-path form above
189
192
 
190
193
 
191
194
  ###############################################################################
@@ -225,10 +228,49 @@ def controlWrite(plantDir: pathlib.Path, state: ControlState) -> None:
225
228
  #
226
229
  # Format: plain text, one line per event (append). Machine-written by the seed
227
230
  # after each cbs_* dispatch. NOT JSON (per Q4 decision).
231
+ #
232
+ # Location (2026-11-24): not in the leaf. What a leaf has materialized is a fact of this host, and
233
+ # the leaf may be a read-only clone (an anon clone of a bro_ repo), so the status is under
234
+ # /bisos/var/cbm/<leafRel>/cbmProc.status
235
+ # with <leafRel> the leaf's resolved directory relative to /bisos/git/<vcMode>/bxRepos/. The vcMode
236
+ # is dropped, so an anon and an auth clone of one leaf share one status. A leaf outside a bxRepos
237
+ # tree is keyed by its absolute path, under _abs_/. Next to the status, a `leaf` symlink points
238
+ # back to the leaf that wrote it last. Nothing is written in the leaf.
228
239
  ###############################################################################
229
240
 
241
+ STATUS_BASE = pathlib.Path("/bisos/var/cbm")
242
+ STATUS_LEAF_LINK = "leaf"
243
+
244
+
245
+ def leafRel(plantDir: pathlib.Path) -> pathlib.PurePath:
246
+ """The leaf's key under STATUS_BASE: relative to /bisos/git/<vcMode>/bxRepos/, else _abs_/<path>."""
247
+ parts = pathlib.Path(plantDir).parts
248
+ if len(parts) > 5 and parts[:3] == ('/', 'bisos', 'git') and parts[4] == 'bxRepos':
249
+ return pathlib.PurePath(*parts[5:])
250
+ return pathlib.PurePath('_abs_', *parts[1:])
251
+
252
+
253
+ def statusDir(plantDir: pathlib.Path) -> pathlib.Path:
254
+ return STATUS_BASE / leafRel(plantDir)
255
+
256
+
230
257
  def statusPath(plantDir: pathlib.Path) -> pathlib.Path:
231
- return plantDir / STATUS_FILENAME
258
+ return statusDir(plantDir) / STATUS_FILENAME
259
+
260
+
261
+ def _statusDirEnsure(plantDir: pathlib.Path) -> pathlib.Path:
262
+ """Create the status directory (group bisos, 2775) and point its `leaf` link at plantDir."""
263
+ sDir = statusDir(plantDir)
264
+ missing = [d for d in [sDir, *sDir.parents] if not d.exists()]
265
+ for d in reversed(missing):
266
+ d.mkdir()
267
+ os.chmod(d, 0o2775) # umask would drop the group write; setgid keeps group bisos
268
+ link = sDir / STATUS_LEAF_LINK
269
+ if not (link.is_symlink() and os.readlink(link) == str(plantDir)):
270
+ tmp = sDir / f".{STATUS_LEAF_LINK}.{os.getpid()}"
271
+ tmp.symlink_to(plantDir)
272
+ os.replace(tmp, link)
273
+ return sDir
232
274
 
233
275
 
234
276
  def statusRead(plantDir: pathlib.Path) -> str:
@@ -248,8 +290,28 @@ def statusWrite(plantDir: pathlib.Path, line: str) -> None:
248
290
  'ran: cbs_materialize failed rc=1'
249
291
  """
250
292
  ts = datetime.datetime.now().isoformat(timespec='seconds')
251
- with statusPath(plantDir).open('a') as fh:
293
+ _statusDirEnsure(plantDir)
294
+ path = statusPath(plantDir)
295
+ isNew = not path.exists()
296
+ with path.open('a') as fh:
252
297
  fh.write(f"{ts} {line}\n")
298
+ if isNew:
299
+ os.chmod(path, 0o664)
300
+
301
+
302
+ ###############################################################################
303
+ # bootstrapPath --- the leaf's own bootstrap sbom (optional)
304
+ #
305
+ # cbmBootstrap-sbom.pcs, next to cbmProc.spcs: what the capability needs before its CBS can run
306
+ # (Phase 1: the pip packages that carry the CBS, into /bisos/venv/py3/bisos3). cbm_bootstrap runs
307
+ # it; cbm_materialize, cbm_reMaterialize and cbm_sbom run it first when it exists.
308
+ ###############################################################################
309
+
310
+ BOOTSTRAP_FILENAME = "cbmBootstrap-sbom.pcs"
311
+
312
+
313
+ def bootstrapPath(plantDir: pathlib.Path) -> pathlib.Path:
314
+ return plantDir / BOOTSTRAP_FILENAME
253
315
 
254
316
 
255
317
  ###############################################################################
@@ -81,6 +81,7 @@ from bisos.common import csParam
81
81
  import collections
82
82
  ####+END:
83
83
 
84
+ import os
84
85
  import subprocess
85
86
  # import time
86
87
 
@@ -236,6 +237,26 @@ This pattern is called listOfArgs subject to Action.
236
237
  f"""ftoBranchProc.spcs -i fto_forwardToLeaves --cmndName='cbm_materialize'""",
237
238
  ).isProblematic(): return(b_io.eh.badOutcome(cmndOutcome))
238
239
 
240
+ # Then the pals realm: the CBM leaves bisos.pals plants from each PALS-BXO's declarations
241
+ # (palsOfSys.cs -i palsLeavesPlant). After collective/hereWeb, which brings nginx and Node; so
242
+ # platform.here's snapshot, taken last in hereWeb, shows the pals leaves' previous outcome.
243
+ # ./ftoBranchProc.spcs: this realm's own branch file, not one found on PATH.
244
+ palsRoot = "/bisos/platform/sys/cbm/pals"
245
+ if os.path.isfile(os.path.join(palsRoot, "ftoBranchProc.spcs")):
246
+ for cmndName in ('cbm_status', 'cbm_materialize'):
247
+ if b.subProc.WOpW(invedBy=self, cd=palsRoot, log=1).bash(
248
+ f"""./ftoBranchProc.spcs -i fto_forwardToLeaves --cmndName='{cmndName}'""",
249
+ ).isProblematic(): return(b_io.eh.badOutcome(cmndOutcome))
250
+
251
+ # Then collective/induct: non-service capabilities (lcnt, Emacs from source, Blee, ...), in the
252
+ # order of its ftoBranchProc.spcs. Last: none of the services above needs them. AI-WorkPlan.org 4.7.
253
+ inductRoot = "/bisos/platform/sys/cbm/collective/induct"
254
+ if os.path.isfile(os.path.join(inductRoot, "ftoBranchProc.spcs")):
255
+ for cmndName in ('cbm_status', 'cbm_materialize'):
256
+ if b.subProc.WOpW(invedBy=self, cd=inductRoot, log=1).bash(
257
+ f"""./ftoBranchProc.spcs -i fto_forwardToLeaves --cmndName='{cmndName}'""",
258
+ ).isProblematic(): return(b_io.eh.badOutcome(cmndOutcome))
259
+
239
260
  return cmndOutcome.set(
240
261
  opError=b.op.OpError.Success,
241
262
  opResults=None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: bisos.capability
3
- Version: 0.25
3
+ Version: 0.27
4
4
  Summary: bisos.capability: BISOS Capabilities Bundles -- Abstraction, Specification and Materialization
5
5
  Author: Mohsen Banan
6
6
  Author-email: libre@mohsen.1.banan.byname.net
@@ -87,6 +87,18 @@ Each of the three tiers in detail:
87
87
  - ``cbm_materialize`` / ``cbm_reMaterialize`` /
88
88
  ``cbm_unMaterialize`` / ``cbm_sbom`` — gated; subprocess-invoke
89
89
  ``<cbsSpec> -i cbs_<verb>``
90
+ - ``cbm_bootstrap`` — run the leaf's own ``cbmBootstrap-sbom.pcs``,
91
+ which installs what the capability needs before its CBS can run
92
+ (e.g. the pip package that puts ``<cap>-cbs.pcs`` on PATH).
93
+ ``cbm_materialize``, ``cbm_reMaterialize`` and ``cbm_sbom`` run it
94
+ first when it exists.
95
+
96
+ A leaf's status log is not in the leaf: it is a fact of the host, and
97
+ the leaf may be a read-only clone. It is at
98
+ ``/bisos/var/cbm/<leafRel>/cbmProc.status``, with ``<leafRel>`` the
99
+ leaf's path under ``/bisos/git/<vcMode>/bxRepos/`` (the vcMode
100
+ dropped, so an anon and an auth clone share it), next to a ``leaf``
101
+ symlink back to the leaf. ``cbm_status`` prints the path.
90
102
 
91
103
  **Load-bearing principle: CBM sits on top of CBS. It does not duplicate
92
104
  CBS content.** A ``cbmProc.spcs`` is a ~10-line pointer file
@@ -115,6 +127,18 @@ CBM machinery (additive, non-invasive to the above):
115
127
  - ``cbmProc_csu.py`` — ``cbm_*`` Cmnd classes + ``_dispatchCbs()``
116
128
  helper
117
129
  - ``bin/cbmProc-seed.cs`` — the CBM-aware seed CSXU
130
+ - ``sysCbmManage_csu.py``, ``bin/sysCbmManage.cs`` —
131
+ ``fullyMaterialize``: ``cbm_status`` then ``cbm_materialize`` over
132
+ the platform's tree — ``collective/hereWeb``, then the ``pals`` realm
133
+ (``sys/cbm/pals/<palsBxo>/<cbm>/``, planted by bisos.pals's
134
+ ``palsOfSys.cs``), then ``collective/induct`` (non-service installs:
135
+ lcnt, emacsSrcBuild, bleeBuild, …), each when it has a
136
+ ``ftoBranchProc.spcs``
137
+
138
+ An explicit ``cbsSpec`` path is used as planted, not resolved: a CBS
139
+ that is a symlink to a generic, spread-planted file (a PALS site's
140
+ ``cbm/pals-cbs.spcs``) runs by its own path, which is how it finds its
141
+ parameters.
118
142
 
119
143
  Canonical exemplar
120
144
  ------------------
@@ -43,9 +43,9 @@ def longDescription():
43
43
  # b:py3:pypi:setup/version Arguments :forSys t :forPyPi t :constant "666"
44
44
  ####+BEGIN: b:py3:pypi:setup/version :comment "Auto Detected"
45
45
 
46
- # ./pypiUploadVer EXISTED -- forPypiVersion=0.25 -- forLocalVersion=0.1 -- constant=NA
46
+ # ./pypiUploadVer EXISTED -- forPypiVersion=0.27 -- forLocalVersion=0.1 -- constant=NA
47
47
  def pkgVersion():
48
- return '0.25'
48
+ return '0.27'
49
49
 
50
50
  ####+END:
51
51