mr bootstrap

Marc Haber mh+vcs-home at zugschlus.de
Fri Jun 3 17:14:28 CEST 2016


On Fri, Jun 03, 2016 at 11:10:24AM +0200, Marc Haber wrote:
> I am trying to make sense out of the mr bootstrap feature, which seems
> incredibly byzantine for me for lack of an example.

I think I have something that works now. It's not pretty though, IMO.

(1)
I have an URL which delivers an mrconfig file, used for mr bootstrap,
with the following content:

|include = cat ~/.config/mr/config-default
|
|[$HOME/.config/vcsh/repo.d/mr.git]
|checkout = vcsh clone http://git/vcsh/mrboot
|
|include = cat ~/.config/mr/config.d/*

mr.git gets checked out automatically after calling mr --trusted
bootstrap $URL.

Issue (1a):
--trusted is needed

Issue (1b):
mr bootstrap complains that there is no .config/mr/config.d is there
and that no .config/mr/config-default is there.

Issue (1c):
The bootstrap mrconfig file must be the one that is ultimately used,
so it needs to interface with the contents of another repository.

(2)
the mr.git repository contains the vcsh hooks from John, the
config-default and the .config/mr/(available.d|config.d)/foo.git
definitions.

config-default has
|[DEFAULT]
|git_gc = git gc "$@"
|jobs = 5

Here are the hooks:
|$ head -n -0 .config/vcsh/hooks-available/*
|==> .config/vcsh/hooks-available/pre-upgrade.00-sparse-checkout <==
|#!/bin/sh
|git config core.sparseCheckout true
|if [ ! -f $GIT_DIR/info/sparse-checkout ]; then
|  cat >> $GIT_DIR/info/sparse-checkout << EOF
|*
|!.gitignore
|!LICENSE*
|!README*
|!docs
|!*~
|EOF
|fi
|
|==> .config/vcsh/hooks-available/pre-upgrade.10-pull-rebase <==
|#!/bin/sh
|git config pull.rebase true
|$ ls -al .config/vcsh/hooks-enabled/
|total 16K
|drwxrwxr-x 1 marc marc 280 Jun  3 16:58 ./
|drwxrwxr-x 1 marc marc  68 Jun  3 16:58 ../
|lrwxrwxrwx 1 marc marc  49 Jun  3 16:58 mr.post-clone.pre-upgrade.00-sparse-checkout -> ../hooks-available/pre-upgrade.00-sparse-checkout*
|lrwxrwxrwx 1 marc marc  45 Jun  3 16:58 mr.post-clone.pre-upgrade.10-pull-rebase -> ../hooks-available/pre-upgrade.10-pull-rebase*
|lrwxrwxrwx 1 marc marc  49 Jun  3 16:58 pre-upgrade.00-sparse-checkout -> ../hooks-available/pre-upgrade.00-sparse-checkout*
|lrwxrwxrwx 1 marc marc  45 Jun  3 16:58 pre-upgrade.10-pull-rebase -> ../hooks-available/pre-upgrade.10-pull-rebase*
|[26/26]marc at swivel:~$


Issue (2a):
the contents from config-default cannot be in .mrconfig since the
.mrconfig downloaded by mr bootstrap must not contain a DEFAULT
section, and one cannot have a file in a repository that will
overwrite an already-existing file.

The mr.git also contains the global .gitconfig:

|# This is Git's per-user configuration file.
|# managed from the mr.git repository
|[user]
|        name = Marc Haber
|        email = mh at example.com
|
|[url "git+ssh://user@git/~/vcsh/"]
|        pushInsteadOf = "http://git/vcsh/"

The url clause allows one to use unauthenticated http to keep the
local clones current (without needing ssh credentials) and
automatically rewrites the URL to git+ssh for pushes, so one can
easily push after connecting with ssh -A with the cached key.

(3)
After mr bootstrap has run, mr checkout gets all the repositories.

Issue (3a):
mr checkout needs to be run manually, because there is no
post-bootstrap hook. The mr code contains a scheduled mr checkout, but
that one is not recursive and thus only checks out the mr.git
repository.

An example repository is configured like:

|[$HOME/.config/vcsh/repo.d/dotfiles.git]
|checkout = vcsh clone http://git/vcsh/dotfiles
|skip = [ "$1" = update ] && ! hours_since "$1" 8

The skip clause makes it possible to have "mr update" in the .profile
without delaying _every_ login.



I have not used this much in practice, so I cannot comment about
pull/push/rebase behavior and per-host configuration, but I'd like to
hear your comments and suggestions before I begin with the roll-out.

Greetings
Marc
    

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421


More information about the vcs-home mailing list