[arch-general] Howto look outside chroot for local git tree?

C Anthony Risinger anthony at xtfx.me
Thu Mar 1 10:19:47 EST 2012


On Thu, Mar 1, 2012 at 2:07 AM, Damien Churchill <damoxc at 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


More information about the arch-general mailing list