[aur-general] PKGBUILD-git that actually works with branches

Philipp Überbacher hollunder at lavabit.com
Sat May 29 05:34:02 EDT 2010


Excerpts from Allan McRae's message of 2010-05-29 00:41:24 +0200:
> On 29/05/10 04:49, Sebastian Schwarz wrote:
> > On 2010-05-28 at 19:38 +0200, Philipp Überbacher wrote:
> >> That's why I defaulted to "master", but I get the following error:
> >> fatal: git checkout: branch master already exists
> >>
> >> It works, but I need some input on whether and how the default case
> >> can be handled more gracefully.
> >
> > There isn't really a need to create a new branch if you just
> > want to do a checkout.  Simply change
> >
> >      git checkout --track -b  ${_gitbranch} origin/${_gitbranch}
> >
> > in http://pastebin.com/deqgqjJe to
> >
> >      git checkout origin/${_gitbranch}
> >
> > See the amendment of the paste at http://pastebin.com/C8sC7wAe
> >
> 
> I have been using this for my makepkg-git package for ages:
> 
>    if [ -d $_gitname ] ; then
>      cd $_gitname && git pull origin working
>      msg "The local files are updated."
>    else
>      git clone $_gitroot
>      cd $_gitname && git checkout origin/working
>    fi
> 
> Seems to work...
> 
> Allan

This doesn't simply allow you to switch between branches. The current
PKGBUILD-git.proto clones once and then works on a copy. I try to keep
this behavior.

However, I just ran into a potential problem when switching between
branches:

cp: cannot create regular file
`/home/murks/build/mine/pyjacksm-git/src/pyjacksm-build/pyjacksm/.git/objects/pack/pack-17d65751e48b8cabe9a720cabff133d636077bd7.idx':
Permission denied
cp: cannot create regular file
`/home/murks/build/mine/pyjacksm-git/src/pyjacksm-build/pyjacksm/.git/objects/pack/pack-17d65751e48b8cabe9a720cabff133d636077bd7.pack':
Permission denied

The PKGBUILD I test this on currently looks like this:

# Maintainer: Philipp Überbacher <murks at lavabit dot com>
pkgname=pyjacksm-git
pkgver=20100529
pkgrel=1
pkgdesc="A simple manager for jack-session"
arch=('any')
url="http://trac.jackaudio.org/wiki/WalkThrough/User/jack_session"
license=('GPL')
depends=('python')
makedepends=('git')
provides=('pyjacksm')

_gitroot="git://hochstrom.endofinternet.org/pyjacksm.git"
_gitname="pyjacksm"
_gitbranch="master"
#bpjack

build() {
  cd "${srcdir}"
  msg "Connecting to GIT server...."

  if [ -d $_gitname ] ; then
    cd $_gitname && git pull origin
    msg "The local files are updated."
  else
    git clone $_gitroot $_gitname
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."

  cp -r "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"
  #^ Creates a copy that still has remote branches available!
  git checkout ${_gitbranch}

  #
  # BUILD HERE
  #
   
  python setup.py install --root=$pkgdir/ --optimize=1 || return 1
}

-- 

Regards,
Philipp

-----
"Wir stehen selbst enttäuscht und sehn betroffen / Den Vorhang zu und alle Fragen offen." Bertolt Brecht, Der gute Mensch von Sezuan



More information about the aur-general mailing list