[aur-general] Git sparse checkouts

Jan Steffens jan.steffens at gmail.com
Wed Dec 21 01:41:46 EST 2011


On Wed, Dec 21, 2011 at 4:37 AM, Simon Stoakley
<sausageandeggs at archlinux.us> wrote:
> Hi All,
> I'm uploading a pkg for an mpris2 plugin for Kupfer. I don't want to clone
> the whole git repo (seems wasteful and I think half the code there is dead)
> and the only part that I'm interested in is the mpris2 folder. The only way
> I've found of checking out part of a repo in is to use the sparse checkout
> trick.
> The question I have is whether or not it's OK to use this in a PKGBUILD or
> not, what say ye wise men?!
>  PKGBUILD below for reference (depends on pkgs I haven't uploaded yet if you
> try building)
>
> Thanks
> Simon
> --
>
> # Contributor: sausageandeggs <sausageandeggs at archlinux.us>
>
> pkgname=kupfer-mpris2-plugin
> pkgver=20111221
> pkgrel=1
> pkgdesc="Control mpris compatable media players from Kupfer"
> arch=(any)
> url="https://github.com/hugosenari/Kupfer-Plugins"
> license=('GPL')
> depends=('mpris2-git')
> makedepends=('git')
>
> _gitroot="git://github.com/hugosenari/Kupfer-Plugins"
> _gitname="Kupfer-Plugins"
>
> build() {
>  cd "${srcdir}"
>
>  msg "Connecting to GIT server..."
>
>  if [ -d ${_gitname} ] ; then
>    cd ${_gitname} && git pull ${_gitname} master
>    msg "The local files are updated."
>  else
>    mkdir ${_gitname}
>    cd ${_gitname}
>    git init
>    git remote add ${_gitname} ${_gitroot}
>    git config core.sparsecheckout true
>    echo mpris2-player >> .git/info/sparse-checkout
>    git pull ${_gitname} master
>  fi
>  msg "GIT checkout done or server timeout"
> }
>
> package(){
>  cd "${srcdir}/${_gitname}"
>  install -d ${pkgdir}/usr/share/kupfer/kupfer/plugin
>  install mpris2-player/* ${pkgdir}/usr/share/kupfer/kupfer/plugin/
> }
>
>

AFAIK this will still clone the whole repository. The only difference
is that it will populate only part of the working directory. So you're
only saving on some local decompression, not on transfer volume.


More information about the aur-general mailing list