carcass
carcass copied to clipboard
Solve carcasses distribution and updates
I'm using Carcass and would like to redistribute my bones (based on a MirageOS layout). Do you have any recommendation for how to hook into carcass setup
so that my rules can be fetched? Happy to host it in a repo and create a carcass-mirage
package that installs the files somewhere sensible, if that helps.
Yes I thought this would quickly show up and I didn't do anything because I had no good answer to it yet. I'm also not very happy about the procedure to reinstall carcasses (carcass setup --force carcass
) on update. I think I should split the flesh setup from carcasses install and provide a good solution along the way to carcass install by third-parties. Here are a few options:
- Have some kind of
CARCASS_PATH
environment variable. Which defines directories where carcasses are looked up, packages would then install their carcasses in theiretc
directory. The problem is then how do packages update that environment variable and I guess most people (myself included) are tired of each tool having it's ownPATH
variables and having to setup it in their. It also makes carcasses less hackable by users. - Have a
carcass install DIR
command that simply copies DIR to the user ~/.carcass directory. You could then for example simply distribute the carcasses in mirage itself, install them in e.g.etc
and have a post message to advise to do acarcass install $(opam config var mirage:etc)/carcass
. Theinstall
could also be a little more clever than what is done by trying to diff directories and md5 the files.
If you have any better idea. Welcome.
P.S. I just warn you that I will have to slightly tweak the body syntax in order to solve #3.
How about a carcass install
that could be managed by OPAM and not in ~/.carcass
at all? This would let us make a carcass-mirage
that can be updated by the MirageOS project, and not let users do local modification (unless they are more advanced and do the 2. step above).
User experience:
opam install carcass-mirage
carcass setup
carcass body mirage/topkg/pkg mypkg
(cd mypkg && git init && git add . && git commit -m "First commit.")
opam pin add -kgit mypkg mypkg#master
So no need for any Mirage-specific carcass installation as it would just be picked up by carcass
as a builtin search path.
P.S. I just warn you that I will have to slightly tweak the body syntax in order to solve #3.
Only experimentally using topkg atm so that's just fine by me!
How about a carcass install that could be managed by OPAM and not in ~/.carcass at all?
Not sure what you mean by that. I don't really want to built-in assumptions about OPAM in the tool.
So no need for any Mirage-specific carcass installation as it would just be picked up by carcass as a builtin search path.
I wanted to avoid this kind of mechanism (also what would be the search path be ?). One of the reason is that packages installing carcasses could then easily override carcasses ids of other package which could break other carcasses in arbitrary ways. The idea to have all the carcasses at the same place in a single ~/.carcass
directory (rather than many directories along a tool specific lookup path) makes that kind of things easier to manage and understand to the end user.
Maybe carcass install (which would be called by carcass-mirage
's install instruction) could only symlink a directory into .carcass
(this would prevent spurious overrides).
Taking inspiration of what was done in odig
I think a good scheme for this would be the following.
We add a notion of $CARCASS_ROOT
, this will typically be $(opam config var etc)
. Carcass identifiers are then mapped to files as follows ($ID
is a relative path):
-
/$PKG/$ID
->$CARCASS_ROOT/$PKG/carcass/$ID
-
$ID
->~/.carcass/$ID
-
./$ID
->$PWD/.carcass/$ID
This will make it easy for packages to install and update carcasses for their package (and/or refer to the carcasses of other packages). It will properly namespaces everything by piggybacking on opam names and make a clear distinction between package/user/per-project carcasses. We still avoid having a notion of PATH
.
So for example if mirage
installs a pkg
body in the carcass
directory of its etc
directory this would be usable as carcass body /mirage/pkg mypkg
.
Would that suit you @avsm ?
(I considered having a workflow based on git repos that you add as a list of sources and then have some kind of carcass update
command, but I think we already have enough things to update/upgrade
on our systems).