mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-16 10:49:26 +03:00
fixed %news and %warp sending for rebuilds
This commit is contained in:
parent
163f2bdcf6
commit
a9443ca78b
@ -148,6 +148,31 @@
|
|||||||
?~ liz a
|
?~ liz a
|
||||||
$(liz t.liz, a (put k i.liz))
|
$(liz t.liz, a (put k i.liz))
|
||||||
::
|
::
|
||||||
|
++ downstream-dents
|
||||||
|
:> obtain all dents that depend on any of the dents in the sample.
|
||||||
|
:>
|
||||||
|
:> traverses the nozzle. product does not include the supplied dents
|
||||||
|
:> themselves.
|
||||||
|
|= des=(set dent) ^- (set dent)
|
||||||
|
%- ~(rep in des)
|
||||||
|
|= [den=dent dos=(set dent)] ^+ des
|
||||||
|
=? dos !?=(%beam -.den)
|
||||||
|
(~(put in dos) den)
|
||||||
|
(~(uni in dos) ^$(des (~(get ju sup.a) den)))
|
||||||
|
::
|
||||||
|
++ upstream-dents
|
||||||
|
:> obtain all dents upon which any of the dents in the sample depend.
|
||||||
|
:>
|
||||||
|
:> traverses the nozzle, gathering all direct and indirect dependencies.
|
||||||
|
:> dents in the sample may also appear in the product.
|
||||||
|
|= arg=(set dent) ^- (set dent)
|
||||||
|
=/ des arg
|
||||||
|
|- ^- (set dent)
|
||||||
|
%- ~(rep in des)
|
||||||
|
|= [den=dent dos=(set dent)] ^+ des
|
||||||
|
=? dos !(~(has in arg) den) (~(put in dos) den)
|
||||||
|
(~(uni in dos) ^$(des (~(get ju sub.a) den)))
|
||||||
|
::
|
||||||
++ beam-dents-in-dir
|
++ beam-dents-in-dir
|
||||||
:> find all %beam dents inside the folder {bem} with care {ren}.
|
:> find all %beam dents inside the folder {bem} with care {ren}.
|
||||||
|= folder=[%beam bem=beam ren=care:clay]
|
|= folder=[%beam bem=beam ren=care:clay]
|
||||||
@ -659,16 +684,9 @@
|
|||||||
=. sup.bay (~(put ju sup.bay) dep hen)
|
=. sup.bay (~(put ju sup.bay) dep hen)
|
||||||
::
|
::
|
||||||
=/ des (~(got by def.deh.bay) dep)
|
=/ des (~(got by def.deh.bay) dep)
|
||||||
=/ bes=(list [beam care:clay]) ~(tap in (dep-beams des))
|
%- ~(rep in (dep-beams des))
|
||||||
|- ^+ this
|
|= [dep=[beam care:clay] dis=_this]
|
||||||
?~ bes this
|
(maybe-warp:dis dep)
|
||||||
:: already sent
|
|
||||||
?: (~(has in out.bay) i.bes) $(bes t.bes)
|
|
||||||
%_ $
|
|
||||||
out.bay (~(put in out.bay) i.bes)
|
|
||||||
bes t.bes
|
|
||||||
mow :_(mow [hen (pass-warp & i.bes)])
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ wasp-cancel
|
++ wasp-cancel
|
||||||
|= dep=@uvH ^+ this
|
|= dep=@uvH ^+ this
|
||||||
@ -677,17 +695,26 @@
|
|||||||
this
|
this
|
||||||
::
|
::
|
||||||
=/ des (~(got by def.deh.bay) dep)
|
=/ des (~(got by def.deh.bay) dep)
|
||||||
=/ bes=(list [beam care:clay]) ~(tap in (dep-beams des))
|
%- ~(rep in (dep-beams des))
|
||||||
|- ^+ this
|
|= [dep=[beam care:clay] dis=_this]
|
||||||
?~ bes this
|
(maybe-cancel:dis dep)
|
||||||
?. (~(has in out.bay) i.bes) $(bes t.bes) :: already cancelled
|
::
|
||||||
?: (dent-has-subscribers [%beam i.bes])
|
++ maybe-warp
|
||||||
:: if any other dep cares about this beam, stay subscribed
|
|= dep=[beam care:clay] ^+ this
|
||||||
$(bes t.bes)
|
?: (~(has in out.bay) dep) this
|
||||||
|
%_ this
|
||||||
|
out.bay (~(put in out.bay) dep)
|
||||||
|
mow :_(mow [hen (pass-warp & dep)])
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ maybe-cancel
|
||||||
|
|= dep=[beam care:clay] ^+ this
|
||||||
|
?. (~(has in out.bay) dep) this :: already cancelled
|
||||||
|
?: (dent-has-subscribers [%beam dep])
|
||||||
|
this :: if any other dep cares about this beam, stay subscribed
|
||||||
%_ $
|
%_ $
|
||||||
out.bay (~(del in out.bay) i.bes)
|
out.bay (~(del in out.bay) dep)
|
||||||
bes t.bes
|
mow :_(mow [hen (pass-warp | dep)])
|
||||||
mow :_(mow [hen (pass-warp | i.bes)])
|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ dent-has-subscribers
|
++ dent-has-subscribers
|
||||||
@ -724,30 +751,71 @@
|
|||||||
=+ `[ren=care:clay wen=case *]`p.u.p.sih :: destructure sih
|
=+ `[ren=care:clay wen=case *]`p.u.p.sih :: destructure sih
|
||||||
?. =(ren ^ren) ~|([%bad-care ren ^ren] !!) :: cares should match
|
?. =(ren ^ren) ~|([%bad-care ren ^ren] !!) :: cares should match
|
||||||
::
|
::
|
||||||
:: rebuild and promote all affected builds
|
|
||||||
=. this (on-update bem ren -.bem(r wen))
|
|
||||||
::
|
|
||||||
:: %clay subscription no longer exists for this beam
|
:: %clay subscription no longer exists for this beam
|
||||||
=. out.bay (~(del in out.bay) bem)
|
=. out.bay (~(del in out.bay) bem)
|
||||||
::
|
::
|
||||||
|
:: rebuild and promote all affected builds,
|
||||||
|
:: calculating which beams resulted in new builds
|
||||||
|
:: for which we should send %news updates.
|
||||||
|
=/ bek -.bem(r wen)
|
||||||
|
=+ [new downstreams]=(dents-to-rebuild bem ren)
|
||||||
|
=^ changed this (on-update new downstreams bek)
|
||||||
|
::
|
||||||
|
|^
|
||||||
|
::
|
||||||
|
=/ changed-hashes (hashes-for-dents changed)
|
||||||
|
=/ downstream-hashes (hashes-for-dents downstreams)
|
||||||
|
=/ sames-hashes ~(tap in (~(dif in downstream-hashes) changed-hashes))
|
||||||
|
::
|
||||||
|
:: loop over the hashes of builds whose results haven't changed and
|
||||||
|
:: update our dependencies and subscriptions accordingly.
|
||||||
|
=. this
|
||||||
|
|- ^+ this
|
||||||
|
?~ sames-hashes this
|
||||||
|
=. this $(sames-hashes t.sames-hashes)
|
||||||
|
=* hax i.sames-hashes
|
||||||
|
::
|
||||||
|
:: find the deps for this hash that could have changed
|
||||||
|
:: as a result of this clay change.
|
||||||
|
=/ dep (~(get ju def.deh.bay) hax)
|
||||||
|
=/ upd (~(int in dep) downstreams)
|
||||||
|
::
|
||||||
|
:: resubscribe to clay at the new revision, since
|
||||||
|
:: the subscription for the old revision closed when
|
||||||
|
:: clay told us something had changed.
|
||||||
|
=. this
|
||||||
|
%- ~(rep in (dep-beams upd))
|
||||||
|
|= [dep=[bem=beam care:clay] dis=_this]
|
||||||
|
(maybe-warp:dis dep(r.bem wen))
|
||||||
|
::
|
||||||
|
:: make hash depend on dents at new beak
|
||||||
|
%_ this
|
||||||
|
deh.bay
|
||||||
|
%- ~(rep in upd)
|
||||||
|
|= [den=dent deh=_deh.bay]
|
||||||
|
=/ new-den ((move-to bek) den)
|
||||||
|
::
|
||||||
|
=. def.deh (~(del ju def.deh) hax den)
|
||||||
|
=. def.deh (~(put ju def.deh) hax new-den)
|
||||||
|
::
|
||||||
|
=. bak.deh (~(del ju bak.deh) den hax)
|
||||||
|
=. bak.deh (~(put ju bak.deh) new-den hax)
|
||||||
|
deh
|
||||||
|
==
|
||||||
|
::
|
||||||
:: for each affected build (keyed by hash),
|
:: for each affected build (keyed by hash),
|
||||||
:: send %news moves to listeners and cancel listeners
|
:: send %news moves to listeners and cancel listeners
|
||||||
:: TODO: don't send %news for unchanged builds
|
=/ hashes=(list @uvH) ~(tap in changed-hashes)
|
||||||
=/ den=dent [%beam bem ren]
|
|
||||||
=/ dos=(set dent) (downstream-dents (sy den ~))
|
|
||||||
=. dos (~(put in dos) den)
|
|
||||||
=/ hashes=(list @uvH)
|
|
||||||
=- ~(tap in hashes)
|
|
||||||
%- ~(rep in dos)
|
|
||||||
|= [den=dent hashes=(set @uvH)]
|
|
||||||
(~(uni in hashes) (~(get ju bak.deh.bay) den))
|
|
||||||
::
|
::
|
||||||
:: ~& [den=den dos=dos hashes=hashes]
|
:: ~& [den=den dos=dos hashes=hashes]
|
||||||
::
|
::
|
||||||
|- ^+ this
|
|- ^+ this
|
||||||
?~ hashes this
|
?~ hashes this
|
||||||
=. this $(hashes t.hashes) :: iterate
|
=. this $(hashes t.hashes) :: iterate
|
||||||
|
::
|
||||||
=/ listeners=(set duct) (~(get ju sup.bay) i.hashes)
|
=/ listeners=(set duct) (~(get ju sup.bay) i.hashes)
|
||||||
|
=. sup.bay (~(del by sup.bay) i.hashes) :: close subscriptions
|
||||||
|
::
|
||||||
=. mow :: send %news moves
|
=. mow :: send %news moves
|
||||||
%- weld :_ mow
|
%- weld :_ mow
|
||||||
%+ turn ~(tap in listeners)
|
%+ turn ~(tap in listeners)
|
||||||
@ -755,31 +823,33 @@
|
|||||||
::
|
::
|
||||||
(wasp-cancel i.hashes)
|
(wasp-cancel i.hashes)
|
||||||
::
|
::
|
||||||
++ downstream-dents
|
++ hashes-for-dents
|
||||||
:> obtain all dents that depend on any of the dents in the sample.
|
|= des=(set dent) ^- (set @uvH)
|
||||||
:>
|
|
||||||
:> traverses the nozzle. product does not include the supplied dents
|
|
||||||
:> themselves.
|
|
||||||
|= des=(set dent) ^- (set dent)
|
|
||||||
%- ~(rep in des)
|
%- ~(rep in des)
|
||||||
|= [den=dent dos=(set dent)] ^+ des
|
|= [den=dent hashes=(set @uvH)]
|
||||||
=? dos !?=(%beam -.den)
|
=/ bak (~(get ju bak.deh.bay) den)
|
||||||
(~(put in dos) den)
|
(~(uni in hashes) (~(get ju bak.deh.bay) den))
|
||||||
(~(uni in dos) ^$(des (~(get ju sup.gaf.bay) den)))
|
--
|
||||||
::
|
::
|
||||||
:> # TODO name this chapter
|
:> # TODO name this chapter
|
||||||
+|
|
+|
|
||||||
::
|
::
|
||||||
|
++ dents-to-rebuild
|
||||||
|
|= [bem=beam ren=care:clay]
|
||||||
|
^- [(set dent) (set dent)]
|
||||||
|
=/ new (~(beam-dents-in-dir na gaf.bay) %beam bem ren)
|
||||||
|
=/ downstreams (~(downstream-dents na gaf.bay) new)
|
||||||
|
[new downstreams]
|
||||||
|
::
|
||||||
++ on-update
|
++ on-update
|
||||||
:> {bem} is at the old revision, {bek} is at the new revision.
|
:> {bem} is at the old revision, {bek} is at the new revision.
|
||||||
|= {bem/beam ren/care:clay bek/beak} ^+ this
|
|= [new=(set dent) downstreams=(set dent) bek=beak]
|
||||||
=/ new (~(beam-dents-in-dir na gaf.bay) %beam bem ren)
|
^+ [*(set dent) this]
|
||||||
~? dbg new-dents+[(en-beam bem) new]
|
=/ todo ~(tap in downstreams)
|
||||||
=/ dos (downstream-dents new)
|
=^ results this (rebuild bek new todo)
|
||||||
=/ todo ~(tap in dos)
|
=+ [changed unchanged]=results
|
||||||
=^ unchanged this (rebuild bek new todo)
|
|
||||||
~| unchanged=unchanged
|
~| unchanged=unchanged
|
||||||
(promote-unchanged unchanged bek)
|
[changed (promote-unchanged unchanged bek)]
|
||||||
::
|
::
|
||||||
++ rebuild :: !. :: TODO reinstate
|
++ rebuild :: !. :: TODO reinstate
|
||||||
:> rebuild all builds whose dependencies have a new %clay revision.
|
:> rebuild all builds whose dependencies have a new %clay revision.
|
||||||
@ -792,8 +862,9 @@
|
|||||||
:> the previous %clay revision, if they exist and their dependencies
|
:> the previous %clay revision, if they exist and their dependencies
|
||||||
:> haven't changed.
|
:> haven't changed.
|
||||||
=| unchanged/(set dent)
|
=| unchanged/(set dent)
|
||||||
|= {bek/beak new/(set dent) todo/(list dent)} ^+ [unchanged this]
|
|= {bek/beak new/(set dent) todo/(list dent)}
|
||||||
?~ todo [unchanged this]
|
^+ [[new unchanged] this]
|
||||||
|
?~ todo [[new unchanged] this]
|
||||||
::
|
::
|
||||||
:: don't try to rebuild the changed files themselves.
|
:: don't try to rebuild the changed files themselves.
|
||||||
?: (~(has in new) i.todo)
|
?: (~(has in new) i.todo)
|
||||||
@ -893,6 +964,7 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ move-to
|
++ move-to
|
||||||
|
:> replace any beaks in dent with {bek}, curried.
|
||||||
|= bek=beak
|
|= bek=beak
|
||||||
|= den=dent ^+ den
|
|= den=dent ^+ den
|
||||||
=? den ?=(%boil -.den) den(-.bom bek)
|
=? den ?=(%boil -.den) den(-.bom bek)
|
||||||
@ -1425,7 +1497,8 @@
|
|||||||
~/ %load-file
|
~/ %load-file
|
||||||
|= {cof/cafe bem/beam}
|
|= {cof/cafe bem/beam}
|
||||||
^- (bolt cage)
|
^- (bolt cage)
|
||||||
:: TODO add-dep:bo
|
%+ tug:bo (add-dep:bo [%beam bem %z] (new:bo cof bem))
|
||||||
|
|= [cof=cafe bem=beam]
|
||||||
?: =([%ud 0] r.bem)
|
?: =([%ud 0] r.bem)
|
||||||
(err:bo cof [leaf+"ford: no data: {<(en-beam bem(s ~))>}"]~)
|
(err:bo cof [leaf+"ford: no data: {<(en-beam bem(s ~))>}"]~)
|
||||||
=+ von=(syve [151 %noun] ~ %cx bem)
|
=+ von=(syve [151 %noun] ~ %cx bem)
|
||||||
@ -1439,9 +1512,7 @@
|
|||||||
~/ %load-to-mark
|
~/ %load-to-mark
|
||||||
|= {cof/cafe for/mark bem/beam}
|
|= {cof/cafe for/mark bem/beam}
|
||||||
%+ under-dep:bo `dent`[%load bem for]
|
%+ under-dep:bo `dent`[%load bem for]
|
||||||
%+ (with-cache:bo %load)
|
%+ (with-cache:bo %load) (new:bo cof for bem)
|
||||||
:: TODO remove add-dep:bo (should be moved to load-file)
|
|
||||||
(add-dep:bo [%beam bem %z] (new:bo cof for bem))
|
|
||||||
|= {cof/cafe for/mark bem/beam}
|
|= {cof/cafe for/mark bem/beam}
|
||||||
^- (bolt (unit vase))
|
^- (bolt (unit vase))
|
||||||
%+ tug:bo (laze cof bem)
|
%+ tug:bo (laze cof bem)
|
||||||
|
Loading…
Reference in New Issue
Block a user