zlocal + darcs

goran.krampe at bluefish.se goran.krampe at bluefish.se
Wed Nov 24 11:48:00 UTC 2004

Howdy fellow Lunatics!

I have been toying with darcs (www.darcs.net) lately, and boy is it fun!
A remarkable SCM tool that I recommend anyone to play with!

I then started playing with "darcsifying" zlocal.

Eh, what? :) Well, in order to more easily share modules with each other
without having to go all "official" about it through CVS I thought darcs
- because of its distributed p2p nature - would fit like a glove.

So, instead of babbling, let me just show how this works. Hopefully this
is repeatable on other Lunar boxes so I don't have any local dependency:

1. lin darcs. Takes an awful lot of time but its worth it IMHO. :) I
posted the module ghc and darcs earlier on this list. Otherwise you can
find them here:
There is also a single binary you can use here:

2. As root, go to your /var/lib/lunar/moonbase/zlocal and type "darcs
init". Voila. zlocal is now a darcs repository and you can see a new
directory called "_darcs"! That is the *only* thing darcs adds - no
"CVS" dirs strewn around or anything like that. So if you ever think
this was all a bad idea - just "rm -r _darcs" and everything is back to
normal. :)

3. Now you "add" the files in zlocal so that darcs is aware of it:
	darcs add -r
	darcs record -m start	

	The first line adds all files recursively to darcs, record is the same
thing as commit in CVS.
	For more info type "darcs" or "darcs add -h" etc.

4. Having a directory called "_darcs" in zlocal screws up the lunar
tools, especially since _darcs has a directory called current which
contains a transactional copy of the zlocal file tree. :) So a few small
patches to the Lunar tools are needed in order to hide that directory. I
just did "lvu install theedge | xargs grep zlocal" to find the places it
is being used (are there more?) and used "-prune" in those find
commands. Tada. This patch is attached to this post.

5. Okidoki, getting down to business. One of the great things with darcs
is that it is so simple to use and that there is no need for a central
repository. So you can trivially "pull" other people's zlocals into your
own! So now, to get my published modules, place yourself in your zlocal
and do this:

	darcs pull

It should go into interactive mode and you can press ? to get advice.

6. You want to track multiple other people? Well, just write a bash
script somewhere that simply has a bunch of lines like the above, you
can try another one I have called zlocal2:

	darcs pull

It just contains some possibly broken modules. :)

Finally, I don't intend to disrupt any plans from the core Lunar
developers on how the moonbase should be managed etc. I am just posting
this as an experiment. And it was fun to hack it. :)

regards, Göran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: darcs-zlocal.patch
Type: application/octet-stream
Size: 1522 bytes
Desc: not available
Url : http://lunar-linux.org/pipermail/lunar/attachments/20041124/6cd5db11/darcs-zlocal.obj

More information about the Lunar mailing list