On Thu, Mar 1, 2012 at 2:07 AM, Damien Churchill <dam...@gmail.com> wrote:
>
> You could mount --bind the location of your local git repositories to
> a point inside your chroot, that's probably the quickest and simplest
> way of doing it, although it offers no protection of your git
> repositories from being wiped out from within the chroot.

you can readonly --bind mount at the VFS level:

mount --bind /a /b
mount -oremount,bind,ro /b

... i have an AUR package that does exactly this:

(the for loop after "# Allow env passthru ...")
http://aur.archlinux.org/packages/py/pyjamas-engine-pythonwebkit/PKGBUILD

... this block allows variables to be set from the ENV, but more
related is the excerpt later on in build():

    if [[ ! -e ${g}/objects ]]; then
        msg "[git] Creating NEW repository ... "
        git --git-dir="${g}" --work-tree="${w}" init
    elif [[ ! -w ${g}/objects ]]; then
        warning "[git] Repository read-only, setting up proxy ... "
        git --git-dir="${_gitrepo_proxy}" --work-tree="${w}" init
        echo "${g}/objects" > "${_gitrepo_proxy}/objects/info/alternates"
        cp -r "${g}/refs" "${_gitrepo_proxy}"
        g="${_gitrepo_proxy}"
    fi

... this block check for an objects directory: if missing clone new,
if readonly create proxy.  the proxy works by creating a new git repo,
and assigning the original as an alternate object store ... this
allows the build to not only reuse the existing repo but *also*
download/use/change within it's own repo.

i use this for webkit because it's a 1GiB+ repository.

-- 

C Anthony

Reply via email to