factors common elements of +brass and +solid into lib/pill

This commit is contained in:
Joe Bryan 2018-12-04 13:41:04 -05:00
parent 4e58545be6
commit b0c286f418
3 changed files with 131 additions and 220 deletions

View File

@ -2,6 +2,7 @@
:::: /hoon/brass/gen
::
/? 310
/+ pill
::
::::
!:
@ -182,128 +183,8 @@
compiler-source
arvo-source
==
::
:: module-ova: vane load operations.
::
=+ ^= module-ova ^- (list ovum)
|^ :~ ::
:: sys/zuse: standard library
::
(vent %$ /zuse)
::
:: sys/vane/ames: network
::
(vent %a /vane/ames)
::
:: sys/vane/behn: timer
::
(vent %b /vane/behn)
::
:: sys/vane/clay: revision control
::
(vent %c /vane/clay)
::
:: sys/vane/dill: console
::
(vent %d /vane/dill)
::
:: sys/vane/eyre: web
::
(vent %e /vane/eyre)
::
:: sys/vane/ford: build
::
(vent %f /vane/ford)
::
:: sys/vane/gall: applications
::
(vent %g /vane/gall)
::
:: sys/vane/jael: security
::
(vent %j /vane/jael)
==
::
++ vent
|= {abr/term den/path}
=+ pax=(weld sys den)
=+ txt=.^(@ %cx (welp pax /hoon))
`ovum`[[%vane den] [%veer abr pax txt]]
--
::
:: file-ovum: userspace filesystem load
::
=+ ^= file-ovum ^- ovum
::
:: /app %gall applications
:: /gen :dojo generators
:: /lib %ford libraries
:: /mar %ford marks
:: /ren %ford renderers
:: /sec %eyre security drivers
:: /sur %ford structures
:: /sys system files
:: /tests unit tests
:: /web %eyre web content
::
%. [/app /gen /lib /mar /ren /sec /sur /sys /tests /web ~]
|= :: sal: all spurs to load from
::
sal/(list spur)
^- ovum
::
:: hav: all user files
::
=; hav ~& user-files+(lent hav)
[[%$ %sync ~] [%into %$ & hav]]
=| hav/mode:clay
|- ^+ hav
?~ sal ~
=. hav $(sal t.sal)
::
:: tyl: spur
::
=/ tyl i.sal
|- ^+ hav
::
:: pax: full path at `tyl`
:: lon: directory at `tyl`
::
=/ pax (en-beam:format bec tyl)
=/ lon .^(arch %cy pax)
:: XX this serialization should use marks
::
=? hav ?=(^ fil.lon)
?. ?= ?($css $hoon $js $json $md $txt $udon $umd)
-.tyl
::
:: install only files with whitelisted marks
::
~& ignoring+pax
hav
::
:: cot: file as plain-text octet-stream
::
=; cot [[(flop `path`tyl) `[/text/plain cot]] hav]
^- octs
?- tyl
{$json *}
=/ dat .^(json %cx pax)
(as-octt:mimes:html (en-json:html dat))
::
{$txt *}
=/ dat .^(wain %cx pax)
(as-octs:mimes:html (of-wain:format dat))
::
*
=/ dat .^(@t %cx pax)
[(met 3 dat) dat]
==
=/ all ~(tap by dir.lon)
|- ^- mode:clay
?~ all hav
$(all t.all, hav ^$(tyl [p.i.all tyl]))
::
:: a pill is a 3-tuple of event-lists: [boot kernel userspace]
::
[boot-ova module-ova [file-ovum ~]]
:+ boot-ova
(module-ova:pill sys)
[(file-ovum:pill (en-beam:format bec /)) ~]

View File

@ -6,6 +6,7 @@
:::: /hoon/solid/gen
::
/? 310
/+ pill
::
::::
!:
@ -56,112 +57,17 @@
whole-formula
::
~& [%solid-kernel `@ux`(mug arvo-formula)]
:: module-ova: vane load operations.
::
=/ module-ova=(list ovum)
|^ :~ (vent %$ /zuse)
(vent %a /vane/ames)
(vent %b /vane/behn)
(vent %c /vane/clay)
(vent %d /vane/dill)
(vent %e /vane/eyre)
(vent %f /vane/ford)
(vent %g /vane/gall)
(vent %j /vane/jael)
==
++ vent
|= [abr=term den=path]
^- ovum
=/ pax (weld sys den)
=/ txt .^(@ %cx (weld pax /hoon))
[[%vane den] [%veer abr pax txt]]
--
:: installed: Arvo gate (formal interface) with %zuse and vanes installed
::
=/ installed
=< q
%^ spin
module-ova
(module-ova:pill sys)
.*(0 arvo-formula)
|= [ovo=ovum ken=*]
[~ .*(ken [%9 2 %10 [6 %1 now ovo] %0 1])]
::
:: file-ovum: userspace filesystem load
::
:: XX use top.arg
:: XX deduplicate with +brass (lib/pill ?)
::
=/ file-ovum=ovum
::
:: /app %gall applications
:: /gen :dojo generators
:: /lib %ford libraries
:: /mar %ford marks
:: /ren %ford renderers
:: /sec %eyre security drivers
:: /sur %ford structures
:: /sys system files
:: /tests unit tests
:: /web %eyre web content
::
%. [/app /gen /lib /mar /ren /sec /sur /sys /tests /web ~]
|= :: sal: all spurs to load from
::
sal/(list spur)
^- ovum
::
:: hav: all user files
::
=; hav ~& user-files+(lent hav)
[[%$ %sync ~] [%into %$ & hav]]
=| hav/mode:clay
|- ^+ hav
?~ sal ~
=. hav $(sal t.sal)
::
:: tyl: spur
::
=/ tyl i.sal
|- ^+ hav
::
:: pax: full path at `tyl`
:: lon: directory at `tyl`
::
=/ pax (en-beam:format bec tyl)
=/ lon .^(arch %cy pax)
:: XX this serialization should use marks
::
=? hav ?=(^ fil.lon)
?. ?= ?($css $hoon $js $json $md $txt $udon $umd)
-.tyl
::
:: install only files with whitelisted marks
::
~& ignoring+pax
hav
::
:: cot: file as plain-text octet-stream
::
=; cot [[(flop `path`tyl) `[/text/plain cot]] hav]
^- octs
?- tyl
{$json *}
=/ dat .^(json %cx pax)
(as-octt:mimes:html (en-json:html dat))
::
{$txt *}
=/ dat .^(wain %cx pax)
(as-octs:mimes:html (of-wain:format dat))
::
*
=/ dat .^(@t %cx pax)
[(met 3 dat) dat]
==
=/ all ~(tap by dir.lon)
|- ^- mode:clay
?~ all hav
$(all t.all, hav ^$(tyl [p.i.all tyl]))
::
:: our boot-ova is a list containing one massive formula:
::
:: We evaluate :arvo-formula (for jet registration),
@ -176,4 +82,6 @@
:: Our userspace event-list is a list containing a full %clay
:: filesystem sync event.
::
[boot-ova ~ [file-ovum ~]]
:+ boot-ova ~
=/ bas (flop (tail (flop sys)))
[(file-ovum:pill bas) ~]

122
lib/pill.hoon Normal file
View File

@ -0,0 +1,122 @@
:: |pill: helper functions for making pills
::
|%
:: +module-ova: vane load operations.
::
:: sys: full path to /sys directory
::
++ module-ova
|= sys=path
^- (list ovum)
|^ :~ :: sys/zuse: standard library
::
(vent %$ /zuse)
:: sys/vane/ames: network
::
(vent %a /vane/ames)
:: sys/vane/behn: timer
::
(vent %b /vane/behn)
:: sys/vane/clay: revision control
::
(vent %c /vane/clay)
:: sys/vane/dill: console
::
(vent %d /vane/dill)
:: sys/vane/eyre: web
::
(vent %e /vane/eyre)
:: sys/vane/ford: build
::
(vent %f /vane/ford)
:: sys/vane/gall: applications
::
(vent %g /vane/gall)
:: sys/vane/jael: security
::
(vent %j /vane/jael)
==
++ vent
|= [abr=term den=path]
^- ovum
=/ pax (weld sys den)
=/ txt .^(@ %cx (weld pax /hoon))
[[%vane den] [%veer abr pax txt]]
--
:: +file-ovum: userspace filesystem load
::
:: bas: full path to / directory
::
++ file-ovum
|= bas=path
^- ovum
::
:: /app %gall applications
:: /gen :dojo generators
:: /lib %ford libraries
:: /mar %ford marks
:: /ren %ford renderers
:: /sec %eyre security drivers
:: /sur %ford structures
:: /sys system files
:: /tests unit tests
:: /web %eyre web content
::
%. [/app /gen /lib /mar /ren /sec /sur /sys /tests /web ~]
|= :: sal: all spurs to load from
::
sal/(list spur)
^- ovum
::
:: hav: all user files
::
=; hav ~& user-files+(lent hav)
[[%$ %sync ~] [%into %$ & hav]]
=| hav/mode:clay
|- ^+ hav
?~ sal ~
=. hav $(sal t.sal)
::
:: tyl: spur
::
=/ tyl i.sal
|- ^+ hav
::
:: pax: full path at `tyl`
:: lon: directory at `tyl`
::
=/ pax (weld bas (flop tyl))
=/ lon .^(arch %cy pax)
:: XX this serialization should use marks
::
=? hav ?=(^ fil.lon)
?. ?= ?($css $hoon $js $json $md $txt $udon $umd)
-.tyl
::
:: install only files with whitelisted marks
::
~& ignoring+pax
hav
::
:: cot: file as plain-text octet-stream
::
=; cot [[(flop `path`tyl) `[/text/plain cot]] hav]
^- octs
?- tyl
{$json *}
=/ dat .^(json %cx pax)
(as-octt:mimes:html (en-json:html dat))
::
{$txt *}
=/ dat .^(wain %cx pax)
(as-octs:mimes:html (of-wain:format dat))
::
*
=/ dat .^(@t %cx pax)
[(met 3 dat) dat]
==
=/ all ~(tap by dir.lon)
|- ^- mode:clay
?~ all hav
$(all t.all, hav ^$(tyl [p.i.all tyl]))
--