You are not logged in.

#1 2014-03-04 20:14:31

daniel_shub
Member
Registered: 2012-06-21
Posts: 81

Review of first PKGBUILD

I have taken over as maintener of the PsychoPy package. I am trying to update the PKGBUILD file and was hoping to get some feedback...

# Maintainer: Daniel E. Shub <Daniel.Shub@nottingham.ac.uk>
# Contributor: Daniel E. Shub <Daniel.Shub@nottingham.ac.uk>
# Contributor: Martin Corley <Martin.Corley@ed.ac.uk>

pkgname=psychopy
pkgver=1.80.00
pkgrel=1
pkgdesc="An experiment builder for neuroscience, psychology and psychophysics"
arch=(any)
url="http://www.psychopy.org"
license=(GPL)
# I think this is the minimal set of dependencies
makedepends=('python2-distribute')
depends=('python2' 'avbin7' 'python2-numpy'
'python2-scipy' 'python2-pyglet<1.2' 'wxpython2.8' 'python2-imaging' 
'python2-matplotlib' 'python2-lxml' 'python2-openpyxl' 'python2-pyo'
'python2-pyparallel')

optdepends=('python2-pyserial: Serial/Parallel port communication'
'parallel-python: parallel processing'
'flac: for working with google speech')
options=(!emptydirs)
source=(http://downloads.sourceforge.net/project/psychpy/PsychoPy/PsychoPy-${pkgver}.zip
python2.patch psychopy psychopy.desktop)
md5sums=('188f897cda154d14ef0322e908e2d4df'
         '10c12d2d3b625195da0d1ef4258e4d3c'
         'd1ade5e4870e8e6f69a4a3480579d135'
         '55ec1a4dd72efd42846413f02f9065bb')

build() {
  cd "${srcdir}"/PsychoPy-${pkgver}
  patch -Np1 -i ../python2.patch
  convert psychopy/app/Resources/psychopy.png -geometry 32x32 ../psychopy.xpm
}
	 

package() {
  cd "$srcdir/PsychoPy-$pkgver"
  python2 setup.py install --root="$pkgdir/" --optimize=1
  # remove this; it's Windows-only
  # rm ${pkgdir}/usr/bin/psychopy_post_inst.py
  install -m 755 ../psychopy "${pkgdir}"/usr/bin/
  install -dm 755 "${pkgdir}"/usr/share/applications/
  install -m 644 ../psychopy.desktop "${pkgdir}"/usr/share/applications/
  install -dm 755 "${pkgdir}"/usr/share/pixmaps/
  install -m 644 ../psychopy.xpm "${pkgdir}"/usr/share/pixmaps/
}

I am not sure I have put the `convert` in the right place or if I am creating and installing the icon and desktop files correctly.

The `psychopy` and `psychopy.desktop` files are pretty boring and the patch file just changes a bunch of python lines to python2. I can include them (or put them on pastebin) if they are useful. I an namcap on the PKGBUILD and it didn't flag any issues, but when I ran it on the package I got a number of "Dependency included and not needed" warnings.

I haven't been able to build or install the package in a  clean chroot since I need to use wget with pacman and I cannot figure out how to install the AUR dependencies.

I also don't understand how/where I upload the new package once I create it with `makepkg --source`.

I think the Wiki has gotten me pretty far but I still fell pretty clueless. Any help (or even links to the Wiki or earlier forum posts) would be appreciated.

Last edited by daniel_shub (2014-03-04 20:15:02)

Offline

#2 2014-03-04 21:46:00

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: Review of first PKGBUILD

Overall, it looks very good. Just a couple of suggestions

1. The patch and convert should be in a prepare function, not the build function. Since there's nothing else in the build function, you can just rename it.
2. This is a style choice only, but I prefer to use the -D option of `install` to create the dirs when you're only installing one file. ie:

  install -dm 755 "${pkgdir}"/usr/share/applications/
  install -m 644 ../psychopy.desktop "${pkgdir}"/usr/share/applications/

Can simply be:

  install -Dm644 ../psychopy.desktop "${pkgdir}"/usr/share/applications/psychopy.desktop

It will create the dir and install the file for you.

Now, your other questions.

I prefer to use sed to change python shebangs, it's more robust if something changes in the files being patched. Without looking at the files in question or your patches, usually something like this will do it if they use /usr/bin/env python:

sed -i 's/env python$/&2/' <filenames>

If there's a lot of files, you can use find with the -exec option to run sed.

Namcap doesn't do all that well with python deps, so the warnings you're seeing are normal.

To install an AUR package into a clean chroot, the easiest way I've found is to already have the packages built, then run it as:

extra-x86_64-build -- -I <file> -I <anotherfile>

This will install the package files specified into the chroot before installing the other deps.

On the main AUR page, there's a Submit link at the top.

Last edited by Scimmia (2014-03-04 21:47:49)

Offline

Board footer

Powered by FluxBB