You are not logged in.

#1 2013-04-02 16:43:24

tobi-fankhaenel
Member
Registered: 2012-01-08
Posts: 10

First PKGBUILD (anki-git), review welcome

According to a discussion at https://anki.tenderapp.com/discussions/ … arch-linux , a bug in Qt appears to have broken some functionality in Anki. There is a workaround in the git repo, but until the next stable version is released, the sidebar in the deck browser will not work.

Because I use Anki heavily, and because I also like my Arch install up-to-date, I endeavored to write my first PKGBUILD. It is basically a combination of the current one for anki and an ankiqt-git package from last year, before Anki had a major overhaul.

Since this is my first PKGBUILD, I would very much welcome some opinions before submitting it to the AUR. The install file is simply the same as the one for anki, but I have nonetheless included it for completeness.

PKGBUILD: http://pastebin.com/4x16AN3B (updated 19:14 GMT)
install file: http://pastebin.com/NEZsA4KB

Last edited by tobi-fankhaenel (2013-04-02 19:15:23)

Offline

#2 2013-04-02 16:52:10

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: First PKGBUILD (anki-git), review welcome

As a best practice, $srcdir and $pkgdir should be double-quoted.

Offline

#3 2013-04-02 18:36:30

tobi-fankhaenel
Member
Registered: 2012-01-08
Posts: 10

Re: First PKGBUILD (anki-git), review welcome

Thanks for the swift reply! I updated the PKGBUILD in the original post.

Offline

#4 2013-04-02 18:47:47

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: First PKGBUILD (anki-git), review welcome

You should remove the line break in the description as the subsequent lines are ignored. It might be pastebin.com which added that line break. You should also remove the -v from the cp inside package(). Other than that it looks good to me.

Offline

#5 2013-04-02 19:16:05

tobi-fankhaenel
Member
Registered: 2012-01-08
Posts: 10

Re: First PKGBUILD (anki-git), review welcome

Thanks for the hint! I have corrected both.

Offline

#6 2013-04-02 19:57:47

tobi-fankhaenel
Member
Registered: 2012-01-08
Posts: 10

Re: First PKGBUILD (anki-git), review welcome

It is submitted, but of course I will correct any errors that are yet found.

Thanks to everyone who reviewed the PKGBUILD, whether they posted corrections or not! Following my intuition of not submitting my first-time PKGBUILD rightaway has paid off :-)

Offline

#7 2013-04-20 00:14:23

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: First PKGBUILD (anki-git), review welcome

Pacman 4.1 is [core], so you can uncomment the part that says it should be uncommented when it's released. tongue

I also prefer install(1) instead of cp(1).

tdy wrote:

As a best practice, $srcdir and $pkgdir should be double-quoted.

In case you're curious, this is done sot that if $srcdir or $pkgdir contain spaces, everything works as expected.
And you should have:

"$pkgdir/usr/bin"

not:

"$pkgdir"/usr/bin

Last edited by hobarrera (2013-04-20 00:16:41)

Offline

#8 2013-04-20 02:59:38

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: First PKGBUILD (anki-git), review welcome

hobarrera wrote:

And you should have:

"$pkgdir/usr/bin"

not:

"$pkgdir"/usr/bin

Doesn't matter. Both are correct.

Offline

#9 2013-04-20 11:46:10

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: First PKGBUILD (anki-git), review welcome

Comments and alterations, untested, just a quick reply.

pkgname=anki-git
pkgver=20130402
pkgver() { # Include a pkgver() function to provide more useful information
  cd "$pkgname"
  git describe | sed 's/-/./g' # Alter where appropriate
} # pkgver= above will be automatically updated based on the result of this function
pkgrel=1
pkgdesc="Helps you remember facts efficiently. Git Version."
url="https://github.com/dae/anki"
license=('GPL')
arch=('any')
depends=('python2-pyqt' 'python2-sqlalchemy' 'python2-simplejson'
      	 'python2-pysqlite' 'python2-beautifulsoup3')
makedepends=('git')
optdepends=('python2-matplotlib: show graphs'
	          'sox: audio recording'
	          'portaudio') # Why is the an optdep? "portaudio: <reason>" (even if it's obvious)
provides=('anki')
conflicts=('anki' 'ankiqt-git')
install=anki-git.install

# pacman 4.1
source=("$pkgname"::git+git://github.com/dae/anki.git) # I like using $pkgname:: for consistency across PKGBUILDs
md5sums=('SKIP')

build() {
  cd "$srcdir/$pkgname"

  sed -i 's|pyuic4 $i -o $py|python2-pyuic4 $i -o $py|' tools/build_ui.sh
  ./tools/build_ui.sh 
  sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' runanki
  rm -f anki.bat
}

package() {
  cd "$srcdir/$pkgname"

  # All of this is horrible practice
  
  # Instead of using cp or mv, use `install' with the appropriate permissions E.g. `install -Dm644 target "$pkgdir"/.../target'
  # if you have to use `cp' use `cp -dp --no-preserve=ownership --target-directory="$pkgdir"/...
}

Last edited by Earnestly (2013-04-20 11:46:40)

Offline

Board footer

Powered by FluxBB